@augment-vir/node 31.3.0 → 31.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/augments/npm/find-bin-path.d.ts +12 -0
- package/dist/augments/npm/find-bin-path.js +21 -0
- package/dist/augments/prisma.d.ts +10 -10
- package/dist/augments/prisma.js +11 -11
- package/dist/augments/terminal/run-cli-script.d.ts +4 -2
- package/dist/augments/terminal/run-cli-script.js +15 -5
- package/dist/docker/containers/container-info.d.ts +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/prisma/model-data.d.ts +2 -2
- package/package.json +5 -5
- package/src/augments/npm/find-bin-path.ts +31 -0
- package/src/augments/prisma.ts +11 -11
- package/src/augments/terminal/run-cli-script.ts +17 -6
- package/src/docker/containers/container-info.ts +3 -3
- package/src/index.ts +1 -0
- package/src/prisma/model-data.ts +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds the path to an npm package executable bin by searching in all ancestor `node_modules/.bin`
|
|
3
|
+
* folders, starting at the given `startPath`.
|
|
4
|
+
*
|
|
5
|
+
* @category Node : Npm
|
|
6
|
+
* @category Package : @augment-vir/node
|
|
7
|
+
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
8
|
+
*/
|
|
9
|
+
export declare function findNpmBinPath({ binName, startPath, }: {
|
|
10
|
+
startPath: string;
|
|
11
|
+
binName: string;
|
|
12
|
+
}): string | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { findAncestor } from '../path/ancestor.js';
|
|
4
|
+
/**
|
|
5
|
+
* Finds the path to an npm package executable bin by searching in all ancestor `node_modules/.bin`
|
|
6
|
+
* folders, starting at the given `startPath`.
|
|
7
|
+
*
|
|
8
|
+
* @category Node : Npm
|
|
9
|
+
* @category Package : @augment-vir/node
|
|
10
|
+
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
11
|
+
*/
|
|
12
|
+
export function findNpmBinPath({ binName, startPath, }) {
|
|
13
|
+
const binPath = join('node_modules', '.bin', binName);
|
|
14
|
+
const ancestor = findAncestor(startPath, (ancestor) => {
|
|
15
|
+
return existsSync(join(ancestor, binPath));
|
|
16
|
+
});
|
|
17
|
+
if (!ancestor) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return join(ancestor, binPath);
|
|
21
|
+
}
|
|
@@ -12,17 +12,17 @@ export type { PrismaMigrationStatus } from '../prisma/prisma-migrations.js';
|
|
|
12
12
|
*
|
|
13
13
|
* - Deploy to production
|
|
14
14
|
*
|
|
15
|
-
* -
|
|
15
|
+
* - `prisma.migration.applyProd()`
|
|
16
16
|
* - Update dev environment
|
|
17
17
|
*
|
|
18
|
-
* - Apply migrations:
|
|
18
|
+
* - Apply migrations: `prisma.migration.applyDev`
|
|
19
19
|
*
|
|
20
20
|
* - If throws {@link PrismaMigrationNeededError}, prompt user for a new migration name and pass it to
|
|
21
|
-
*
|
|
22
|
-
* - If throws {@link PrismaResetNeededError}, reset the database with
|
|
21
|
+
* `prisma.migration.create`
|
|
22
|
+
* - If throws {@link PrismaResetNeededError}, reset the database with `prisma.database.resetDev`
|
|
23
23
|
* - Generate client: `prisma.client.isCurrent`
|
|
24
24
|
*
|
|
25
|
-
* - If `false`, run
|
|
25
|
+
* - If `false`, run `prisma.client.generate`
|
|
26
26
|
*
|
|
27
27
|
* @category Prisma : Node
|
|
28
28
|
* @category Package : @augment-vir/node
|
|
@@ -50,7 +50,7 @@ export declare const prisma: {
|
|
|
50
50
|
applyProd: typeof applyPrismaMigrationsToProd;
|
|
51
51
|
/**
|
|
52
52
|
* Apply all migrations. Meant for a development environment, with less protections than
|
|
53
|
-
*
|
|
53
|
+
* `prisma.migration.applyProd()`
|
|
54
54
|
*
|
|
55
55
|
* @throws `PrismaMigrationNeededError` when a new migration is required so the user needs
|
|
56
56
|
* to input a name.
|
|
@@ -70,8 +70,8 @@ export declare const prisma: {
|
|
|
70
70
|
*/
|
|
71
71
|
resetDev: typeof resetDevPrismaDatabase;
|
|
72
72
|
/**
|
|
73
|
-
* Uses
|
|
74
|
-
*
|
|
73
|
+
* Uses `prisma.database.diff` to detect if there are any differences between the current
|
|
74
|
+
* database and the Prisma schema that should control it.
|
|
75
75
|
*/
|
|
76
76
|
hasDiff: typeof doesPrismaDiffExist;
|
|
77
77
|
/**
|
|
@@ -102,8 +102,8 @@ export declare const prisma: {
|
|
|
102
102
|
*/
|
|
103
103
|
isCurrent: typeof isGeneratedPrismaClientCurrent;
|
|
104
104
|
/**
|
|
105
|
-
* Adds a collection of create data to a database through a `PrismaClient` instance.
|
|
106
|
-
* particularly useful for setting up mocks in a mock PrismaClient.
|
|
105
|
+
* Adds a collection of create data entries to a database through a `PrismaClient` instance.
|
|
106
|
+
* This is particularly useful for setting up mocks in a mock PrismaClient.
|
|
107
107
|
*
|
|
108
108
|
* @example
|
|
109
109
|
*
|
package/dist/augments/prisma.js
CHANGED
|
@@ -10,17 +10,17 @@ export * from '../prisma/prisma-errors.js';
|
|
|
10
10
|
*
|
|
11
11
|
* - Deploy to production
|
|
12
12
|
*
|
|
13
|
-
* -
|
|
13
|
+
* - `prisma.migration.applyProd()`
|
|
14
14
|
* - Update dev environment
|
|
15
15
|
*
|
|
16
|
-
* - Apply migrations:
|
|
16
|
+
* - Apply migrations: `prisma.migration.applyDev`
|
|
17
17
|
*
|
|
18
18
|
* - If throws {@link PrismaMigrationNeededError}, prompt user for a new migration name and pass it to
|
|
19
|
-
*
|
|
20
|
-
* - If throws {@link PrismaResetNeededError}, reset the database with
|
|
19
|
+
* `prisma.migration.create`
|
|
20
|
+
* - If throws {@link PrismaResetNeededError}, reset the database with `prisma.database.resetDev`
|
|
21
21
|
* - Generate client: `prisma.client.isCurrent`
|
|
22
22
|
*
|
|
23
|
-
* - If `false`, run
|
|
23
|
+
* - If `false`, run `prisma.client.generate`
|
|
24
24
|
*
|
|
25
25
|
* @category Prisma : Node
|
|
26
26
|
* @category Package : @augment-vir/node
|
|
@@ -48,7 +48,7 @@ export const prisma = {
|
|
|
48
48
|
applyProd: applyPrismaMigrationsToProd,
|
|
49
49
|
/**
|
|
50
50
|
* Apply all migrations. Meant for a development environment, with less protections than
|
|
51
|
-
*
|
|
51
|
+
* `prisma.migration.applyProd()`
|
|
52
52
|
*
|
|
53
53
|
* @throws `PrismaMigrationNeededError` when a new migration is required so the user needs
|
|
54
54
|
* to input a name.
|
|
@@ -68,8 +68,8 @@ export const prisma = {
|
|
|
68
68
|
*/
|
|
69
69
|
resetDev: resetDevPrismaDatabase,
|
|
70
70
|
/**
|
|
71
|
-
* Uses
|
|
72
|
-
*
|
|
71
|
+
* Uses `prisma.database.diff` to detect if there are any differences between the current
|
|
72
|
+
* database and the Prisma schema that should control it.
|
|
73
73
|
*/
|
|
74
74
|
hasDiff: doesPrismaDiffExist,
|
|
75
75
|
/**
|
|
@@ -100,8 +100,8 @@ export const prisma = {
|
|
|
100
100
|
*/
|
|
101
101
|
isCurrent: isGeneratedPrismaClientCurrent,
|
|
102
102
|
/**
|
|
103
|
-
* Adds a collection of create data to a database through a `PrismaClient` instance.
|
|
104
|
-
* particularly useful for setting up mocks in a mock PrismaClient.
|
|
103
|
+
* Adds a collection of create data entries to a database through a `PrismaClient` instance.
|
|
104
|
+
* This is particularly useful for setting up mocks in a mock PrismaClient.
|
|
105
105
|
*
|
|
106
106
|
* @example
|
|
107
107
|
*
|
|
@@ -142,7 +142,7 @@ export const prisma = {
|
|
|
142
142
|
* ]);
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
|
-
addData
|
|
145
|
+
addData,
|
|
146
146
|
/**
|
|
147
147
|
* Dump data from the current database through a `PrismaClient` instance.
|
|
148
148
|
*
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* @category Package : @augment-vir/node
|
|
7
7
|
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
8
8
|
*/
|
|
9
|
-
export declare const ExtensionToRunner: Record<string, string
|
|
9
|
+
export declare const ExtensionToRunner: Record<string, string | {
|
|
10
|
+
npx: string;
|
|
11
|
+
}>;
|
|
10
12
|
/**
|
|
11
13
|
* Runs a script path as if it had been run directly, as much as possible.
|
|
12
14
|
*
|
|
@@ -14,7 +16,7 @@ export declare const ExtensionToRunner: Record<string, string>;
|
|
|
14
16
|
* @category Package : @augment-vir/node
|
|
15
17
|
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
16
18
|
*/
|
|
17
|
-
export declare function runCliScript(
|
|
19
|
+
export declare function runCliScript(scriptPath: string,
|
|
18
20
|
/** This should just be `__filename` (for CJS) or `import.meta.filename` (for ESM). */
|
|
19
21
|
cliScriptFilePath: string,
|
|
20
22
|
/**
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* node:coverage disable */
|
|
2
2
|
/** This file cannot be tested because it calls `process.exit`. */
|
|
3
|
-
import {
|
|
3
|
+
import { check } from '@augment-vir/assert';
|
|
4
|
+
import { dirname, extname } from 'node:path';
|
|
5
|
+
import { findNpmBinPath } from '../npm/find-bin-path.js';
|
|
4
6
|
import { interpolationSafeWindowsPath } from '../path/os-path.js';
|
|
5
7
|
import { extractRelevantArgs } from './relevant-args.js';
|
|
6
8
|
import { runShellCommand } from './shell.js';
|
|
@@ -12,7 +14,9 @@ import { runShellCommand } from './shell.js';
|
|
|
12
14
|
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
13
15
|
*/
|
|
14
16
|
export const ExtensionToRunner = {
|
|
15
|
-
'.ts':
|
|
17
|
+
'.ts': {
|
|
18
|
+
npx: 'tsx',
|
|
19
|
+
},
|
|
16
20
|
'.js': 'node',
|
|
17
21
|
'.sh': 'bash',
|
|
18
22
|
};
|
|
@@ -23,7 +27,7 @@ export const ExtensionToRunner = {
|
|
|
23
27
|
* @category Package : @augment-vir/node
|
|
24
28
|
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
25
29
|
*/
|
|
26
|
-
export async function runCliScript(
|
|
30
|
+
export async function runCliScript(scriptPath,
|
|
27
31
|
/** This should just be `__filename` (for CJS) or `import.meta.filename` (for ESM). */
|
|
28
32
|
cliScriptFilePath,
|
|
29
33
|
/**
|
|
@@ -36,12 +40,18 @@ binName) {
|
|
|
36
40
|
binName,
|
|
37
41
|
fileName: cliScriptFilePath,
|
|
38
42
|
});
|
|
39
|
-
const extension = extname(
|
|
43
|
+
const extension = extname(scriptPath);
|
|
40
44
|
const runner = ExtensionToRunner[extension];
|
|
41
45
|
if (!runner) {
|
|
42
46
|
throw new Error("No runner configured for file extension '${extension}' in '${path}'");
|
|
43
47
|
}
|
|
44
|
-
const
|
|
48
|
+
const runnerPath = check.isString(runner)
|
|
49
|
+
? runner
|
|
50
|
+
: findNpmBinPath({
|
|
51
|
+
binName: runner.npx,
|
|
52
|
+
startPath: dirname(cliScriptFilePath),
|
|
53
|
+
}) || runner.npx;
|
|
54
|
+
const results = await runShellCommand(interpolationSafeWindowsPath([runnerPath, scriptPath, ...args].join(' ')), {
|
|
45
55
|
hookUpToConsole: true,
|
|
46
56
|
});
|
|
47
57
|
process.exit(results.exitCode || 0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JsonCompatibleArray, JsonCompatibleObject } from '@augment-vir/common';
|
|
2
2
|
import type { DockerContainerStatus } from './container-status.js';
|
|
3
3
|
/**
|
|
4
|
-
* Properties on {@link DockerContainerInfo}.State, retrieved from
|
|
4
|
+
* Properties on {@link DockerContainerInfo}.State, retrieved from `docker.container.getInfo()`.
|
|
5
5
|
*
|
|
6
6
|
* @category Node : Docker : Util
|
|
7
7
|
* @category Package : @augment-vir/node
|
|
@@ -22,8 +22,8 @@ export type DockerContainerInfoState = {
|
|
|
22
22
|
};
|
|
23
23
|
/** This type signature is incomplete. Add to it as necessary. */
|
|
24
24
|
/**
|
|
25
|
-
* Properties on the output from
|
|
26
|
-
* the way, particularly most of properties with nested objects.
|
|
25
|
+
* Properties on the output from `docker.container.getInfo()`. Not all these properties are filled
|
|
26
|
+
* in all the way, particularly most of properties with nested objects.
|
|
27
27
|
*
|
|
28
28
|
* @category Node : Docker : Util
|
|
29
29
|
* @category Package : @augment-vir/node
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './augments/fs/read-dir.js';
|
|
|
6
6
|
export * from './augments/fs/read-file.js';
|
|
7
7
|
export * from './augments/fs/symlink.js';
|
|
8
8
|
export * from './augments/fs/write.js';
|
|
9
|
+
export * from './augments/npm/find-bin-path.js';
|
|
9
10
|
export * from './augments/npm/query-workspace.js';
|
|
10
11
|
export * from './augments/npm/read-package-json.js';
|
|
11
12
|
export * from './augments/os/operating-system.js';
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './augments/fs/read-dir.js';
|
|
|
6
6
|
export * from './augments/fs/read-file.js';
|
|
7
7
|
export * from './augments/fs/symlink.js';
|
|
8
8
|
export * from './augments/fs/write.js';
|
|
9
|
+
export * from './augments/npm/find-bin-path.js';
|
|
9
10
|
export * from './augments/npm/query-workspace.js';
|
|
10
11
|
export * from './augments/npm/read-package-json.js';
|
|
11
12
|
export * from './augments/os/operating-system.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BasePrismaClient, PrismaAllModelsCreate, type PartialWithUndefined, type PrismaAllBasicModels, type PrismaModelName } from '@augment-vir/common';
|
|
2
2
|
import type { IsAny } from 'type-fest';
|
|
3
3
|
/**
|
|
4
|
-
* Params for
|
|
5
|
-
* {@link PrismaAllModelsCreate} for sequential data creation.
|
|
4
|
+
* Params for `prisma.client.addData()`. This is similar to {@link PrismaAllModelsCreate} but allows
|
|
5
|
+
* an array of {@link PrismaAllModelsCreate} for sequential data creation.
|
|
6
6
|
*
|
|
7
7
|
* @category Prisma : Node
|
|
8
8
|
* @category Package : @augment-vir/node
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/node",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.5.0",
|
|
4
4
|
"description": "A collection of augments, helpers types, functions, and classes only for Node.js (backend) JavaScript environments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"augment",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"test:update": "npm test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@augment-vir/assert": "^31.
|
|
41
|
-
"@augment-vir/common": "^31.
|
|
40
|
+
"@augment-vir/assert": "^31.5.0",
|
|
41
|
+
"@augment-vir/common": "^31.5.0",
|
|
42
42
|
"@date-vir/duration": "^7.1.1",
|
|
43
43
|
"ansi-styles": "^6.2.1",
|
|
44
44
|
"terminate": "^2.8.0",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"typed-event-target": "^4.0.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@augment-vir/test": "^31.
|
|
49
|
+
"@augment-vir/test": "^31.5.0",
|
|
50
50
|
"@prisma/client": "^6.1.0",
|
|
51
|
-
"@types/node": "^22.10.
|
|
51
|
+
"@types/node": "^22.10.5",
|
|
52
52
|
"@web/dev-server-esbuild": "^1.0.3",
|
|
53
53
|
"@web/test-runner": "^0.19.0",
|
|
54
54
|
"@web/test-runner-commands": "^0.9.0",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {existsSync} from 'node:fs';
|
|
2
|
+
import {join} from 'node:path';
|
|
3
|
+
import {findAncestor} from '../path/ancestor.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Finds the path to an npm package executable bin by searching in all ancestor `node_modules/.bin`
|
|
7
|
+
* folders, starting at the given `startPath`.
|
|
8
|
+
*
|
|
9
|
+
* @category Node : Npm
|
|
10
|
+
* @category Package : @augment-vir/node
|
|
11
|
+
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
12
|
+
*/
|
|
13
|
+
export function findNpmBinPath({
|
|
14
|
+
binName,
|
|
15
|
+
startPath,
|
|
16
|
+
}: {
|
|
17
|
+
startPath: string;
|
|
18
|
+
binName: string;
|
|
19
|
+
}): string | undefined {
|
|
20
|
+
const binPath = join('node_modules', '.bin', binName);
|
|
21
|
+
|
|
22
|
+
const ancestor = findAncestor(startPath, (ancestor) => {
|
|
23
|
+
return existsSync(join(ancestor, binPath));
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (!ancestor) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return join(ancestor, binPath);
|
|
31
|
+
}
|
package/src/augments/prisma.ts
CHANGED
|
@@ -29,17 +29,17 @@ export type {PrismaMigrationStatus} from '../prisma/prisma-migrations.js';
|
|
|
29
29
|
*
|
|
30
30
|
* - Deploy to production
|
|
31
31
|
*
|
|
32
|
-
* -
|
|
32
|
+
* - `prisma.migration.applyProd()`
|
|
33
33
|
* - Update dev environment
|
|
34
34
|
*
|
|
35
|
-
* - Apply migrations:
|
|
35
|
+
* - Apply migrations: `prisma.migration.applyDev`
|
|
36
36
|
*
|
|
37
37
|
* - If throws {@link PrismaMigrationNeededError}, prompt user for a new migration name and pass it to
|
|
38
|
-
*
|
|
39
|
-
* - If throws {@link PrismaResetNeededError}, reset the database with
|
|
38
|
+
* `prisma.migration.create`
|
|
39
|
+
* - If throws {@link PrismaResetNeededError}, reset the database with `prisma.database.resetDev`
|
|
40
40
|
* - Generate client: `prisma.client.isCurrent`
|
|
41
41
|
*
|
|
42
|
-
* - If `false`, run
|
|
42
|
+
* - If `false`, run `prisma.client.generate`
|
|
43
43
|
*
|
|
44
44
|
* @category Prisma : Node
|
|
45
45
|
* @category Package : @augment-vir/node
|
|
@@ -67,7 +67,7 @@ export const prisma = {
|
|
|
67
67
|
applyProd: applyPrismaMigrationsToProd,
|
|
68
68
|
/**
|
|
69
69
|
* Apply all migrations. Meant for a development environment, with less protections than
|
|
70
|
-
*
|
|
70
|
+
* `prisma.migration.applyProd()`
|
|
71
71
|
*
|
|
72
72
|
* @throws `PrismaMigrationNeededError` when a new migration is required so the user needs
|
|
73
73
|
* to input a name.
|
|
@@ -87,8 +87,8 @@ export const prisma = {
|
|
|
87
87
|
*/
|
|
88
88
|
resetDev: resetDevPrismaDatabase,
|
|
89
89
|
/**
|
|
90
|
-
* Uses
|
|
91
|
-
*
|
|
90
|
+
* Uses `prisma.database.diff` to detect if there are any differences between the current
|
|
91
|
+
* database and the Prisma schema that should control it.
|
|
92
92
|
*/
|
|
93
93
|
hasDiff: doesPrismaDiffExist,
|
|
94
94
|
/**
|
|
@@ -119,8 +119,8 @@ export const prisma = {
|
|
|
119
119
|
*/
|
|
120
120
|
isCurrent: isGeneratedPrismaClientCurrent,
|
|
121
121
|
/**
|
|
122
|
-
* Adds a collection of create data to a database through a `PrismaClient` instance.
|
|
123
|
-
* particularly useful for setting up mocks in a mock PrismaClient.
|
|
122
|
+
* Adds a collection of create data entries to a database through a `PrismaClient` instance.
|
|
123
|
+
* This is particularly useful for setting up mocks in a mock PrismaClient.
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
126
|
*
|
|
@@ -161,7 +161,7 @@ export const prisma = {
|
|
|
161
161
|
* ]);
|
|
162
162
|
* ```
|
|
163
163
|
*/
|
|
164
|
-
addData
|
|
164
|
+
addData,
|
|
165
165
|
/**
|
|
166
166
|
* Dump data from the current database through a `PrismaClient` instance.
|
|
167
167
|
*
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* node:coverage disable */
|
|
2
2
|
/** This file cannot be tested because it calls `process.exit`. */
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {check} from '@augment-vir/assert';
|
|
5
|
+
import {dirname, extname} from 'node:path';
|
|
6
|
+
import {findNpmBinPath} from '../npm/find-bin-path.js';
|
|
5
7
|
import {interpolationSafeWindowsPath} from '../path/os-path.js';
|
|
6
8
|
import {extractRelevantArgs} from './relevant-args.js';
|
|
7
9
|
import {runShellCommand} from './shell.js';
|
|
@@ -13,8 +15,10 @@ import {runShellCommand} from './shell.js';
|
|
|
13
15
|
* @category Package : @augment-vir/node
|
|
14
16
|
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
15
17
|
*/
|
|
16
|
-
export const ExtensionToRunner: Record<string, string> = {
|
|
17
|
-
'.ts':
|
|
18
|
+
export const ExtensionToRunner: Record<string, string | {npx: string}> = {
|
|
19
|
+
'.ts': {
|
|
20
|
+
npx: 'tsx',
|
|
21
|
+
},
|
|
18
22
|
'.js': 'node',
|
|
19
23
|
'.sh': 'bash',
|
|
20
24
|
};
|
|
@@ -27,7 +31,7 @@ export const ExtensionToRunner: Record<string, string> = {
|
|
|
27
31
|
* @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
|
|
28
32
|
*/
|
|
29
33
|
export async function runCliScript(
|
|
30
|
-
|
|
34
|
+
scriptPath: string,
|
|
31
35
|
/** This should just be `__filename` (for CJS) or `import.meta.filename` (for ESM). */
|
|
32
36
|
cliScriptFilePath: string,
|
|
33
37
|
/**
|
|
@@ -42,7 +46,7 @@ export async function runCliScript(
|
|
|
42
46
|
fileName: cliScriptFilePath,
|
|
43
47
|
});
|
|
44
48
|
|
|
45
|
-
const extension = extname(
|
|
49
|
+
const extension = extname(scriptPath);
|
|
46
50
|
|
|
47
51
|
const runner = ExtensionToRunner[extension];
|
|
48
52
|
|
|
@@ -50,8 +54,15 @@ export async function runCliScript(
|
|
|
50
54
|
throw new Error("No runner configured for file extension '${extension}' in '${path}'");
|
|
51
55
|
}
|
|
52
56
|
|
|
57
|
+
const runnerPath = check.isString(runner)
|
|
58
|
+
? runner
|
|
59
|
+
: findNpmBinPath({
|
|
60
|
+
binName: runner.npx,
|
|
61
|
+
startPath: dirname(cliScriptFilePath),
|
|
62
|
+
}) || runner.npx;
|
|
63
|
+
|
|
53
64
|
const results = await runShellCommand(
|
|
54
|
-
interpolationSafeWindowsPath([
|
|
65
|
+
interpolationSafeWindowsPath([runnerPath, scriptPath, ...args].join(' ')),
|
|
55
66
|
{
|
|
56
67
|
hookUpToConsole: true,
|
|
57
68
|
},
|
|
@@ -3,7 +3,7 @@ import {runShellCommand} from '../../augments/terminal/shell.js';
|
|
|
3
3
|
import type {DockerContainerStatus} from './container-status.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Properties on {@link DockerContainerInfo}.State, retrieved from
|
|
6
|
+
* Properties on {@link DockerContainerInfo}.State, retrieved from `docker.container.getInfo()`.
|
|
7
7
|
*
|
|
8
8
|
* @category Node : Docker : Util
|
|
9
9
|
* @category Package : @augment-vir/node
|
|
@@ -26,8 +26,8 @@ export type DockerContainerInfoState = {
|
|
|
26
26
|
/** This type signature is incomplete. Add to it as necessary. */
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Properties on the output from
|
|
30
|
-
* the way, particularly most of properties with nested objects.
|
|
29
|
+
* Properties on the output from `docker.container.getInfo()`. Not all these properties are filled
|
|
30
|
+
* in all the way, particularly most of properties with nested objects.
|
|
31
31
|
*
|
|
32
32
|
* @category Node : Docker : Util
|
|
33
33
|
* @category Package : @augment-vir/node
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './augments/fs/read-dir.js';
|
|
|
6
6
|
export * from './augments/fs/read-file.js';
|
|
7
7
|
export * from './augments/fs/symlink.js';
|
|
8
8
|
export * from './augments/fs/write.js';
|
|
9
|
+
export * from './augments/npm/find-bin-path.js';
|
|
9
10
|
export * from './augments/npm/query-workspace.js';
|
|
10
11
|
export * from './augments/npm/read-package-json.js';
|
|
11
12
|
export * from './augments/os/operating-system.js';
|
package/src/prisma/model-data.ts
CHANGED
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
import type {IsAny} from 'type-fest';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Params for
|
|
24
|
-
* {@link PrismaAllModelsCreate} for sequential data creation.
|
|
23
|
+
* Params for `prisma.client.addData()`. This is similar to {@link PrismaAllModelsCreate} but allows
|
|
24
|
+
* an array of {@link PrismaAllModelsCreate} for sequential data creation.
|
|
25
25
|
*
|
|
26
26
|
* @category Prisma : Node
|
|
27
27
|
* @category Package : @augment-vir/node
|