@augment-vir/node 31.0.0 → 31.0.1

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.
@@ -65,7 +65,7 @@ export async function resetDirContents(rootDir, contents) {
65
65
  * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
66
66
  */
67
67
  export async function writeDirContents(rootDir, contents) {
68
- await Promise.all(getObjectTypedEntries(contents).map(async ([relativePath, content,]) => {
68
+ await Promise.all(getObjectTypedEntries(contents).map(async ([relativePath, content]) => {
69
69
  const fullPath = join(rootDir, relativePath);
70
70
  if (check.isString(content)) {
71
71
  await writeFileAndDir(fullPath, content);
@@ -37,13 +37,7 @@ export type RelevantArgsInput = {
37
37
  *
38
38
  * ```ts
39
39
  * extractRelevantArgs({
40
- * rawArgs: [
41
- * 'npx',
42
- * 'ts-node',
43
- * './my-script.ts',
44
- * 'arg1',
45
- * '--arg2',
46
- * ], // typically will be process.argv
40
+ * rawArgs: ['npx', 'ts-node', './my-script.ts', 'arg1', '--arg2'], // typically will be process.argv
47
41
  * binName: 'my-script', // should be your package.json "bin" property name, can be undefined
48
42
  * fileName: 'my-script.ts', // should be __filename from the script that will be executed
49
43
  * });
@@ -9,13 +9,7 @@ import { basename } from 'node:path';
9
9
  *
10
10
  * ```ts
11
11
  * extractRelevantArgs({
12
- * rawArgs: [
13
- * 'npx',
14
- * 'ts-node',
15
- * './my-script.ts',
16
- * 'arg1',
17
- * '--arg2',
18
- * ], // typically will be process.argv
12
+ * rawArgs: ['npx', 'ts-node', './my-script.ts', 'arg1', '--arg2'], // typically will be process.argv
19
13
  * binName: 'my-script', // should be your package.json "bin" property name, can be undefined
20
14
  * fileName: 'my-script.ts', // should be __filename from the script that will be executed
21
15
  * });
@@ -41,11 +41,7 @@ binName) {
41
41
  if (!runner) {
42
42
  throw new Error("No runner configured for file extension '${extension}' in '${path}'");
43
43
  }
44
- const results = await runShellCommand(interpolationSafeWindowsPath([
45
- runner,
46
- path,
47
- ...args,
48
- ].join(' ')), {
44
+ const results = await runShellCommand(interpolationSafeWindowsPath([runner, path, ...args].join(' ')), {
49
45
  hookUpToConsole: true,
50
46
  });
51
47
  process.exit(results.exitCode || 0);
@@ -169,10 +169,7 @@ export async function runShellCommand(command, options = {}) {
169
169
  }
170
170
  /* node:coverage enable */
171
171
  shellTarget.destroy();
172
- const rejectionErrorMessage = combineErrors([
173
- new Error(stderr),
174
- ...errors,
175
- ]);
172
+ const rejectionErrorMessage = combineErrors([new Error(stderr), ...errors]);
176
173
  /** Reject now because the "done" listener won't get fired after killing the process. */
177
174
  reject(rejectionErrorMessage);
178
175
  });
@@ -37,7 +37,7 @@ export function makeEnvFlags(envMapping) {
37
37
  if (!envMapping) {
38
38
  return '';
39
39
  }
40
- const flags = Object.entries(envMapping).map(([key, { value, allowInterpolation },]) => {
40
+ const flags = Object.entries(envMapping).map(([key, { value, allowInterpolation }]) => {
41
41
  const quote = allowInterpolation ? '"' : "'";
42
42
  return `-e ${key}=${wrapString({ value, wrapper: quote })}`;
43
43
  });
@@ -4,10 +4,7 @@ export async function runMockLongLivingContainer(containerName, args = {}) {
4
4
  containerName: containerName,
5
5
  detach: true,
6
6
  imageName: 'alpine:3.20.2',
7
- dockerFlags: [
8
- '-i',
9
- '-t',
10
- ],
7
+ dockerFlags: ['-i', '-t'],
11
8
  command: 'sh',
12
9
  platform: 'amd64',
13
10
  ...args,
@@ -11,12 +11,7 @@ imageName, platform) {
11
11
  const command = [
12
12
  'docker',
13
13
  'pull',
14
- ...(platform
15
- ? [
16
- '--platform',
17
- platform,
18
- ]
19
- : []),
14
+ ...(platform ? ['--platform', platform] : []),
20
15
  wrapString({ value: imageName, wrapper: "'" }),
21
16
  ].join(' ');
22
17
  await runShellCommand(command, {
@@ -8,7 +8,7 @@ export async function addData(prismaClient, data) {
8
8
  }
9
9
  async function addModelDataObject(prismaClient, data) {
10
10
  /** Add the mock data to the mock prisma client. */
11
- await awaitedForEach(getObjectTypedEntries(data), async ([modelName, mockData,]) => {
11
+ await awaitedForEach(getObjectTypedEntries(data), async ([modelName, mockData]) => {
12
12
  /**
13
13
  * This type is dumbed down to just `AnyObject[]` because the union of all possible
14
14
  * model data is just way too big (and not helpful as the inputs to this function are
@@ -37,10 +37,7 @@ async function addModelDataObject(prismaClient, data) {
37
37
  }
38
38
  });
39
39
  }
40
- const prismockKeys = [
41
- 'getData',
42
- 'setData',
43
- ];
40
+ const prismockKeys = ['getData', 'setData'];
44
41
  export function getAllPrismaModelNames(prismaClient) {
45
42
  return Object.keys(prismaClient)
46
43
  .filter((key) => !key.startsWith('$') && !key.startsWith('_') && !prismockKeys.includes(key))
@@ -13,12 +13,7 @@ var DbChangeRequired;
13
13
  DbChangeRequired["ResetNeeded"] = "reset-needed";
14
14
  })(DbChangeRequired || (DbChangeRequired = {}));
15
15
  export async function applyPrismaMigrationsToDev(schemaFilePath, env = {}) {
16
- const command = [
17
- 'prisma',
18
- 'migrate',
19
- 'dev',
20
- `--schema='${schemaFilePath}'`,
21
- ].join(' ');
16
+ const command = ['prisma', 'migrate', 'dev', `--schema='${schemaFilePath}'`].join(' ');
22
17
  log.faint(`> ${command}`);
23
18
  let dbRequirement = undefined;
24
19
  const result = await runShellCommand(command, {
@@ -76,7 +71,7 @@ export async function getMigrationStatus(schemaFilePath, env = {}) {
76
71
  foundNotAppliedMigrations = true;
77
72
  }
78
73
  else {
79
- const [, countMatch,] = safeMatch(line, /^([\d,]+) migrations? found in/);
74
+ const [, countMatch] = safeMatch(line, /^([\d,]+) migrations? found in/);
80
75
  if (countMatch) {
81
76
  listedMigrations.totalMigrations = toEnsuredNumber(countMatch);
82
77
  }
@@ -2,28 +2,16 @@ import { log } from '@augment-vir/common';
2
2
  import { interpolationSafeWindowsPath } from '../augments/path/os-path.js';
3
3
  import { runShellCommand } from '../augments/terminal/shell.js';
4
4
  import { PrismaSchemaError } from './prisma-errors.js';
5
- const prismaCommandsThatSupportNoHints = [
6
- 'generate',
7
- ];
5
+ const prismaCommandsThatSupportNoHints = ['generate'];
8
6
  export async function runPrismaCommand({ command, ignoreExitCode = false, },
9
7
  /** Set to `undefined` to omit the `--schema` flag. */
10
8
  schemaFilePath, env = {}) {
11
- const schemaFileArgs = schemaFilePath
12
- ? [
13
- '--schema',
14
- schemaFilePath,
15
- ]
16
- : [];
9
+ const schemaFileArgs = schemaFilePath ? ['--schema', schemaFilePath] : [];
17
10
  /** Disable Prisma's in-CLI ads. */
18
11
  const noHintsArg = prismaCommandsThatSupportNoHints.some((commandName) => command.startsWith(commandName))
19
12
  ? '--no-hints'
20
13
  : '';
21
- const fullCommand = [
22
- 'prisma',
23
- command,
24
- ...schemaFileArgs,
25
- noHintsArg,
26
- ].join(' ');
14
+ const fullCommand = ['prisma', command, ...schemaFileArgs, noHintsArg].join(' ');
27
15
  log.faint(`> ${fullCommand}`);
28
16
  const result = await runShellCommand(interpolationSafeWindowsPath(fullCommand), {
29
17
  env: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/node",
3
- "version": "31.0.0",
3
+ "version": "31.0.1",
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.0.0",
41
- "@augment-vir/common": "^31.0.0",
40
+ "@augment-vir/assert": "^31.0.1",
41
+ "@augment-vir/common": "^31.0.1",
42
42
  "@date-vir/duration": "^7.0.1",
43
43
  "ansi-styles": "^6.2.1",
44
44
  "terminate": "^2.8.0",
@@ -46,7 +46,7 @@
46
46
  "typed-event-target": "^4.0.2"
47
47
  },
48
48
  "devDependencies": {
49
- "@augment-vir/test": "^31.0.0",
49
+ "@augment-vir/test": "^31.0.1",
50
50
  "@prisma/client": "^5.22.0",
51
51
  "@types/node": "^22.10.0",
52
52
  "@web/dev-server-esbuild": "^1.0.3",