@augment-vir/node 31.17.1 → 31.19.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.
@@ -18,5 +18,10 @@ export async function doesPrismaDiffExist(schemaFilePath, env = {}) {
18
18
  return !!(await getPrismaDiff(schemaFilePath, env));
19
19
  }
20
20
  export async function resetDevPrismaDatabase(schemaFilePath, env = {}) {
21
- await runPrismaCommand({ command: 'migrate reset --force' }, schemaFilePath, env);
21
+ await runPrismaCommand({
22
+ command: 'db push --accept-data-loss --skip-generate',
23
+ hideLogs: true,
24
+ ignoreExitCode: true,
25
+ }, schemaFilePath, env);
26
+ await runPrismaCommand({ command: 'migrate reset --force --skip-generate --skip-seed' }, schemaFilePath, env);
22
27
  }
@@ -1,3 +1,4 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/common';
1
2
  import { type ShellOutput } from '../augments/terminal/shell.js';
2
3
  /**
3
4
  * All commands in the Prisma CLI that support the `--no-hints` flag, used to turn off ads.
@@ -14,10 +15,13 @@ export declare const prismaCommandsThatSupportNoHints: string[];
14
15
  * @category Package : @augment-vir/node
15
16
  * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
16
17
  */
17
- export declare function runPrismaCommand({ command, ignoreExitCode, }: {
18
+ export declare function runPrismaCommand({ command, ignoreExitCode, hideLogs, }: {
18
19
  command: string;
19
- ignoreExitCode?: boolean | undefined;
20
- },
20
+ } & PartialWithUndefined<{
21
+ /** If `true`, prevents errors from being thrown if this command exits with a non-0 status. */
22
+ ignoreExitCode: boolean;
23
+ hideLogs: boolean;
24
+ }>,
21
25
  /** Set to `undefined` to omit the `--schema` flag. */
22
26
  schemaFilePath: string | undefined, env?: Record<string, string> | undefined): Promise<Readonly<ShellOutput>>;
23
27
  export declare function verifyOutput(schemaFilePath: string, shellOutput: Readonly<ShellOutput>, ignoreExitCode: boolean): Readonly<ShellOutput>;
@@ -18,7 +18,7 @@ export const prismaCommandsThatSupportNoHints = ['generate'];
18
18
  * @category Package : @augment-vir/node
19
19
  * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
20
20
  */
21
- export async function runPrismaCommand({ command, ignoreExitCode = false, },
21
+ export async function runPrismaCommand({ command, ignoreExitCode = false, hideLogs = false, },
22
22
  /** Set to `undefined` to omit the `--schema` flag. */
23
23
  schemaFilePath, env = {}) {
24
24
  const schemaFileArgs = schemaFilePath
@@ -43,7 +43,7 @@ schemaFilePath, env = {}) {
43
43
  ...process.env,
44
44
  ...env,
45
45
  },
46
- hookUpToConsole: true,
46
+ hookUpToConsole: !hideLogs,
47
47
  cwd: schemaFilePath ? dirname(schemaFilePath) : process.cwd(),
48
48
  });
49
49
  return verifyOutput(schemaFilePath || '', result, ignoreExitCode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/node",
3
- "version": "31.17.1",
3
+ "version": "31.19.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",
@@ -38,19 +38,19 @@
38
38
  "test:update": "npm test"
39
39
  },
40
40
  "dependencies": {
41
- "@augment-vir/assert": "^31.17.1",
42
- "@augment-vir/common": "^31.17.1",
41
+ "@augment-vir/assert": "^31.19.0",
42
+ "@augment-vir/common": "^31.19.0",
43
43
  "@date-vir/duration": "^7.3.1",
44
44
  "ansi-styles": "^6.2.1",
45
45
  "terminate": "^2.8.0",
46
46
  "tsx": "^4.19.4",
47
- "type-fest": "^4.40.1",
47
+ "type-fest": "^4.41.0",
48
48
  "typed-event-target": "^4.0.4"
49
49
  },
50
50
  "devDependencies": {
51
- "@augment-vir/test": "^31.17.1",
51
+ "@augment-vir/test": "^31.19.0",
52
52
  "@prisma/client": "^6.7.0",
53
- "@types/node": "^22.15.3",
53
+ "@types/node": "^22.15.17",
54
54
  "@web/dev-server-esbuild": "^1.0.4",
55
55
  "@web/test-runner": "^0.20.1",
56
56
  "@web/test-runner-commands": "^0.9.0",
@@ -31,5 +31,18 @@ export async function resetDevPrismaDatabase(
31
31
  schemaFilePath: string,
32
32
  env: Record<string, string> = {},
33
33
  ) {
34
- await runPrismaCommand({command: 'migrate reset --force'}, schemaFilePath, env);
34
+ await runPrismaCommand(
35
+ {
36
+ command: 'db push --accept-data-loss --skip-generate',
37
+ hideLogs: true,
38
+ ignoreExitCode: true,
39
+ },
40
+ schemaFilePath,
41
+ env,
42
+ );
43
+ await runPrismaCommand(
44
+ {command: 'migrate reset --force --skip-generate --skip-seed'},
45
+ schemaFilePath,
46
+ env,
47
+ );
35
48
  }
@@ -1,4 +1,4 @@
1
- import {log, wrapString} from '@augment-vir/common';
1
+ import {log, type PartialWithUndefined, wrapString} from '@augment-vir/common';
2
2
  import {dirname} from 'node:path';
3
3
  import {interpolationSafeWindowsPath} from '../augments/path/os-path.js';
4
4
  import {runShellCommand, type ShellOutput} from '../augments/terminal/shell.js';
@@ -24,10 +24,14 @@ export async function runPrismaCommand(
24
24
  {
25
25
  command,
26
26
  ignoreExitCode = false,
27
+ hideLogs = false,
27
28
  }: {
28
29
  command: string;
29
- ignoreExitCode?: boolean | undefined;
30
- },
30
+ } & PartialWithUndefined<{
31
+ /** If `true`, prevents errors from being thrown if this command exits with a non-0 status. */
32
+ ignoreExitCode: boolean;
33
+ hideLogs: boolean;
34
+ }>,
31
35
  /** Set to `undefined` to omit the `--schema` flag. */
32
36
  schemaFilePath: string | undefined,
33
37
  env: Record<string, string> | undefined = {},
@@ -60,7 +64,7 @@ export async function runPrismaCommand(
60
64
  ...process.env,
61
65
  ...env,
62
66
  },
63
- hookUpToConsole: true,
67
+ hookUpToConsole: !hideLogs,
64
68
  cwd: schemaFilePath ? dirname(schemaFilePath) : process.cwd(),
65
69
  });
66
70