@zenstackhq/cli 3.0.0-alpha.1 → 3.0.0-alpha.10

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.
@@ -1,23 +1,22 @@
1
-
2
- 
3
- > @zenstackhq/cli@3.0.0-alpha.1 build /Users/yiming/git/zenstack/zenstack-v3/packages/cli
4
- > tsup-node
5
-
6
- CLI Building entry: {"index":"src/index.ts"}
7
- CLI Using tsconfig: tsconfig.json
8
- CLI tsup v8.3.5
9
- CLI Using tsup config: /Users/yiming/git/zenstack/zenstack-v3/packages/cli/tsup.config.ts
10
- CLI Target: esnext
11
- CLI Cleaning output folder
12
- ESM Build start
13
- CJS Build start
14
- ESM dist/index.js 14.02 KB
15
- ESM dist/index.js.map 27.76 KB
16
- ESM ⚡️ Build success in 51ms
17
- CJS dist/index.cjs 15.95 KB
18
- CJS dist/index.cjs.map 27.84 KB
19
- CJS ⚡️ Build success in 51ms
20
- DTS Build start
21
- DTS ⚡️ Build success in 1226ms
22
- DTS dist/index.d.ts 108.00 B
23
- DTS dist/index.d.cts 108.00 B
1
+
2
+ > @zenstackhq/cli@3.0.0-alpha.10 build /home/runner/work/zenstack-v3/zenstack-v3/packages/cli
3
+ > tsup-node
4
+
5
+ CLI Building entry: {"index":"src/index.ts"}
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.0
8
+ CLI Using tsup config: /home/runner/work/zenstack-v3/zenstack-v3/packages/cli/tsup.config.ts
9
+ CLI Target: esnext
10
+ CLI Cleaning output folder
11
+ ESM Build start
12
+ CJS Build start
13
+ ESM dist/index.js 17.39 KB
14
+ ESM dist/index.js.map 35.93 KB
15
+ ESM ⚡️ Build success in 91ms
16
+ CJS dist/index.cjs 20.63 KB
17
+ CJS dist/index.cjs.map 36.14 KB
18
+ CJS ⚡️ Build success in 91ms
19
+ DTS Build start
20
+ DTS ⚡️ Build success in 3366ms
21
+ DTS dist/index.d.ts 108.00 B
22
+ DTS dist/index.d.cts 108.00 B
package/bin/cli CHANGED
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node --no-warnings
1
+ #!/usr/bin/env node
2
2
 
3
3
  import '../dist/index.js';
package/dist/index.cjs CHANGED
@@ -6,9 +6,6 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __commonJS = (cb, mod) => function __require() {
10
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
- };
12
9
  var __export = (target, all) => {
13
10
  for (var name in all)
14
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -31,69 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
28
  ));
32
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
30
 
34
- // package.json
35
- var require_package = __commonJS({
36
- "package.json"(exports2, module2) {
37
- module2.exports = {
38
- name: "@zenstackhq/cli",
39
- publisher: "zenstack",
40
- displayName: "ZenStack CLI",
41
- description: "FullStack database toolkit with built-in access control and automatic API generation.",
42
- version: "3.0.0-alpha.1",
43
- type: "module",
44
- author: {
45
- name: "ZenStack Team"
46
- },
47
- homepage: "https://zenstack.dev",
48
- license: "MIT",
49
- keywords: [
50
- "orm",
51
- "fullstack",
52
- "react",
53
- "typescript",
54
- "data modeling"
55
- ],
56
- bin: {
57
- zenstack: "bin/cli"
58
- },
59
- scripts: {
60
- build: "tsup-node",
61
- watch: "tsup-node --watch",
62
- lint: "eslint src --ext ts",
63
- test: "vitest",
64
- pack: "pnpm pack"
65
- },
66
- dependencies: {
67
- "@types/node": "^20.0.0",
68
- "@zenstackhq/language": "workspace:*",
69
- "@zenstackhq/sdk": "workspace:*",
70
- "async-exit-hook": "^2.0.1",
71
- colors: "1.4.0",
72
- commander: "^8.3.0",
73
- langium: "~3.3.0",
74
- ora: "^5.4.1",
75
- "package-manager-detector": "^1.3.0",
76
- "tiny-invariant": "^1.3.3",
77
- "ts-pattern": "^4.3.0"
78
- },
79
- peerDependencies: {
80
- prisma: "^6.0.0",
81
- typescript: "^5.0.0"
82
- },
83
- devDependencies: {
84
- "@types/async-exit-hook": "^2.0.0",
85
- "@types/better-sqlite3": "^7.6.13",
86
- "@types/semver": "^7.3.13",
87
- "@types/tmp": "^0.2.6",
88
- "@zenstackhq/runtime": "workspace:*",
89
- "@zenstackhq/testtools": "workspace:*",
90
- "better-sqlite3": "^11.8.1",
91
- tmp: "^0.2.3"
92
- }
93
- };
94
- }
95
- });
96
-
97
31
  // src/index.ts
98
32
  var src_exports = {};
99
33
  __export(src_exports, {
@@ -105,7 +39,7 @@ var import_colors5 = __toESM(require("colors"), 1);
105
39
  var import_commander = require("commander");
106
40
 
107
41
  // src/actions/db.ts
108
- var import_node_path2 = __toESM(require("path"), 1);
42
+ var import_node_fs2 = __toESM(require("fs"), 1);
109
43
 
110
44
  // src/utils/exec-utils.ts
111
45
  var import_child_process = require("child_process");
@@ -130,7 +64,12 @@ function execPackage(cmd, options) {
130
64
  __name(execPackage, "execPackage");
131
65
 
132
66
  // src/actions/action-utils.ts
67
+ var import_common_helpers = require("@zenstackhq/common-helpers");
68
+ var import_language = require("@zenstackhq/language");
69
+ var import_sdk = require("@zenstackhq/sdk");
70
+ var import_colors = __toESM(require("colors"), 1);
133
71
  var import_node_fs = __toESM(require("fs"), 1);
72
+ var import_node_path = __toESM(require("path"), 1);
134
73
 
135
74
  // src/cli-error.ts
136
75
  var CliError = class extends Error {
@@ -140,8 +79,6 @@ var CliError = class extends Error {
140
79
  };
141
80
 
142
81
  // src/actions/action-utils.ts
143
- var import_language = require("@zenstackhq/language");
144
- var import_colors = __toESM(require("colors"), 1);
145
82
  function getSchemaFile(file) {
146
83
  if (file) {
147
84
  if (!import_node_fs.default.existsSync(file)) {
@@ -149,6 +86,13 @@ function getSchemaFile(file) {
149
86
  }
150
87
  return file;
151
88
  }
89
+ const pkgJsonConfig = getPkgJsonConfig(process.cwd());
90
+ if (pkgJsonConfig.schema) {
91
+ if (!import_node_fs.default.existsSync(pkgJsonConfig.schema)) {
92
+ throw new CliError(`Schema file not found: ${pkgJsonConfig.schema}`);
93
+ }
94
+ return pkgJsonConfig.schema;
95
+ }
152
96
  if (import_node_fs.default.existsSync("./zenstack/schema.zmodel")) {
153
97
  return "./zenstack/schema.zmodel";
154
98
  } else if (import_node_fs.default.existsSync("./schema.zmodel")) {
@@ -178,42 +122,130 @@ function handleSubProcessError(err) {
178
122
  }
179
123
  }
180
124
  __name(handleSubProcessError, "handleSubProcessError");
125
+ async function generateTempPrismaSchema(zmodelPath) {
126
+ const model = await loadSchemaDocument(zmodelPath);
127
+ const prismaSchema = await new import_sdk.PrismaSchemaGenerator(model).generate();
128
+ const prismaSchemaFile = import_node_path.default.resolve(import_node_path.default.dirname(zmodelPath), "~schema.prisma");
129
+ import_node_fs.default.writeFileSync(prismaSchemaFile, prismaSchema);
130
+ return prismaSchemaFile;
131
+ }
132
+ __name(generateTempPrismaSchema, "generateTempPrismaSchema");
133
+ function getPkgJsonConfig(startPath) {
134
+ const result = {
135
+ schema: void 0,
136
+ output: void 0
137
+ };
138
+ const pkgJsonFile = (0, import_common_helpers.findUp)([
139
+ "package.json"
140
+ ], startPath, false);
141
+ if (!pkgJsonFile) {
142
+ return result;
143
+ }
144
+ let pkgJson = void 0;
145
+ try {
146
+ pkgJson = JSON.parse(import_node_fs.default.readFileSync(pkgJsonFile, "utf8"));
147
+ } catch {
148
+ return result;
149
+ }
150
+ if (pkgJson.zenstack && typeof pkgJson.zenstack === "object") {
151
+ result.schema = pkgJson.zenstack.schema && import_node_path.default.resolve(import_node_path.default.dirname(pkgJsonFile), pkgJson.zenstack.schema);
152
+ result.output = pkgJson.zenstack.output && import_node_path.default.resolve(import_node_path.default.dirname(pkgJsonFile), pkgJson.zenstack.output);
153
+ }
154
+ return result;
155
+ }
156
+ __name(getPkgJsonConfig, "getPkgJsonConfig");
157
+
158
+ // src/actions/db.ts
159
+ async function run(command, options) {
160
+ switch (command) {
161
+ case "push":
162
+ await runPush(options);
163
+ break;
164
+ }
165
+ }
166
+ __name(run, "run");
167
+ async function runPush(options) {
168
+ const schemaFile = getSchemaFile(options.schema);
169
+ const prismaSchemaFile = await generateTempPrismaSchema(schemaFile);
170
+ try {
171
+ const cmd = [
172
+ "prisma db push",
173
+ ` --schema "${prismaSchemaFile}"`,
174
+ options.acceptDataLoss ? " --accept-data-loss" : "",
175
+ options.forceReset ? " --force-reset" : "",
176
+ " --skip-generate"
177
+ ].join("");
178
+ try {
179
+ await execPackage(cmd);
180
+ } catch (err) {
181
+ handleSubProcessError(err);
182
+ }
183
+ } finally {
184
+ if (import_node_fs2.default.existsSync(prismaSchemaFile)) {
185
+ import_node_fs2.default.unlinkSync(prismaSchemaFile);
186
+ }
187
+ }
188
+ }
189
+ __name(runPush, "runPush");
181
190
 
182
191
  // src/actions/generate.ts
192
+ var import_common_helpers2 = require("@zenstackhq/common-helpers");
183
193
  var import_ast = require("@zenstackhq/language/ast");
184
- var import_sdk = require("@zenstackhq/sdk");
194
+ var import_sdk2 = require("@zenstackhq/sdk");
185
195
  var import_colors2 = __toESM(require("colors"), 1);
186
- var import_node_fs2 = __toESM(require("fs"), 1);
187
- var import_node_path = __toESM(require("path"), 1);
188
- var import_tiny_invariant = __toESM(require("tiny-invariant"), 1);
189
- async function run(options) {
196
+ var import_node_fs3 = __toESM(require("fs"), 1);
197
+ var import_node_path2 = __toESM(require("path"), 1);
198
+ async function run2(options) {
190
199
  const schemaFile = getSchemaFile(options.schema);
191
200
  const model = await loadSchemaDocument(schemaFile);
192
- const outputPath = options.output ?? import_node_path.default.dirname(schemaFile);
193
- const tsSchemaFile = import_node_path.default.join(outputPath, "schema.ts");
194
- await new import_sdk.TsSchemaGenerator().generate(schemaFile, [], tsSchemaFile);
201
+ const outputPath = getOutputPath(options, schemaFile);
202
+ const tsSchemaFile = import_node_path2.default.join(outputPath, "schema.ts");
203
+ await new import_sdk2.TsSchemaGenerator().generate(schemaFile, [], tsSchemaFile);
195
204
  await runPlugins(model, outputPath, tsSchemaFile);
196
- const prismaSchema = await new import_sdk.PrismaSchemaGenerator(model).generate();
197
- import_node_fs2.default.writeFileSync(import_node_path.default.join(outputPath, "schema.prisma"), prismaSchema);
205
+ if (options.savePrismaSchema) {
206
+ const prismaSchema = await new import_sdk2.PrismaSchemaGenerator(model).generate();
207
+ let prismaSchemaFile = import_node_path2.default.join(outputPath, "schema.prisma");
208
+ if (typeof options.savePrismaSchema === "string") {
209
+ prismaSchemaFile = import_node_path2.default.resolve(outputPath, options.savePrismaSchema);
210
+ import_node_fs3.default.mkdirSync(import_node_path2.default.dirname(prismaSchemaFile), {
211
+ recursive: true
212
+ });
213
+ }
214
+ import_node_fs3.default.writeFileSync(prismaSchemaFile, prismaSchema);
215
+ }
198
216
  if (!options.silent) {
199
217
  console.log(import_colors2.default.green("Generation completed successfully."));
200
218
  console.log(`You can now create a ZenStack client with it.
201
219
 
202
- \`\`\`
220
+ \`\`\`ts
203
221
  import { ZenStackClient } from '@zenstackhq/runtime';
204
222
  import { schema } from '${outputPath}/schema';
205
223
 
206
- const client = new ZenStackClient(schema);
224
+ const client = new ZenStackClient(schema, {
225
+ dialectConfig: { ... }
226
+ });
207
227
  \`\`\`
208
228
  `);
209
229
  }
210
230
  }
211
- __name(run, "run");
231
+ __name(run2, "run");
232
+ function getOutputPath(options, schemaFile) {
233
+ if (options.output) {
234
+ return options.output;
235
+ }
236
+ const pkgJsonConfig = getPkgJsonConfig(process.cwd());
237
+ if (pkgJsonConfig.output) {
238
+ return pkgJsonConfig.output;
239
+ } else {
240
+ return import_node_path2.default.dirname(schemaFile);
241
+ }
242
+ }
243
+ __name(getOutputPath, "getOutputPath");
212
244
  async function runPlugins(model, outputPath, tsSchemaFile) {
213
245
  const plugins = model.declarations.filter(import_ast.isPlugin);
214
246
  for (const plugin of plugins) {
215
247
  const providerField = plugin.fields.find((f) => f.name === "provider");
216
- (0, import_tiny_invariant.default)(providerField, `Plugin ${plugin.name} does not have a provider field`);
248
+ (0, import_common_helpers2.invariant)(providerField, `Plugin ${plugin.name} does not have a provider field`);
217
249
  const provider = providerField.value.value;
218
250
  let useProvider = provider;
219
251
  if (useProvider.startsWith("@core/")) {
@@ -230,33 +262,6 @@ async function runPlugins(model, outputPath, tsSchemaFile) {
230
262
  }
231
263
  __name(runPlugins, "runPlugins");
232
264
 
233
- // src/actions/db.ts
234
- async function run2(command, options) {
235
- const schemaFile = getSchemaFile(options.schema);
236
- await run({
237
- schema: schemaFile,
238
- silent: true
239
- });
240
- const prismaSchemaFile = import_node_path2.default.join(import_node_path2.default.dirname(schemaFile), "schema.prisma");
241
- switch (command) {
242
- case "push":
243
- await runPush(prismaSchemaFile, options);
244
- break;
245
- }
246
- }
247
- __name(run2, "run");
248
- async function runPush(prismaSchemaFile, options) {
249
- const cmd = `prisma db push --schema "${prismaSchemaFile}"${options.acceptDataLoss ? " --accept-data-loss" : ""}${options.forceReset ? " --force-reset" : ""} --skip-generate`;
250
- try {
251
- await execPackage(cmd, {
252
- stdio: "inherit"
253
- });
254
- } catch (err) {
255
- handleSubProcessError(err);
256
- }
257
- }
258
- __name(runPush, "runPush");
259
-
260
265
  // src/actions/info.ts
261
266
  var import_colors3 = __toESM(require("colors"), 1);
262
267
  var import_node_path3 = __toESM(require("path"), 1);
@@ -288,7 +293,7 @@ async function getZenStackPackages(projectPath) {
288
293
  type: "json"
289
294
  }
290
295
  })).default;
291
- } catch (err) {
296
+ } catch {
292
297
  return [];
293
298
  }
294
299
  const packages = Array.from(new Set([
@@ -319,7 +324,7 @@ __name(getZenStackPackages, "getZenStackPackages");
319
324
 
320
325
  // src/actions/init.ts
321
326
  var import_colors4 = __toESM(require("colors"), 1);
322
- var import_node_fs3 = __toESM(require("fs"), 1);
327
+ var import_node_fs4 = __toESM(require("fs"), 1);
323
328
  var import_node_path4 = __toESM(require("path"), 1);
324
329
  var import_ora = __toESM(require("ora"), 1);
325
330
  var import_package_manager_detector = require("package-manager-detector");
@@ -357,7 +362,7 @@ model Post {
357
362
  async function run4(projectPath) {
358
363
  const packages = [
359
364
  {
360
- name: "@zenstackhq@cli@next",
365
+ name: "@zenstackhq/cli@next",
361
366
  dev: true
362
367
  },
363
368
  {
@@ -395,11 +400,11 @@ async function run4(projectPath) {
395
400
  }
396
401
  }
397
402
  const generationFolder = "zenstack";
398
- if (!import_node_fs3.default.existsSync(import_node_path4.default.join(projectPath, generationFolder))) {
399
- import_node_fs3.default.mkdirSync(import_node_path4.default.join(projectPath, generationFolder));
403
+ if (!import_node_fs4.default.existsSync(import_node_path4.default.join(projectPath, generationFolder))) {
404
+ import_node_fs4.default.mkdirSync(import_node_path4.default.join(projectPath, generationFolder));
400
405
  }
401
- if (!import_node_fs3.default.existsSync(import_node_path4.default.join(projectPath, generationFolder, "schema.zmodel"))) {
402
- import_node_fs3.default.writeFileSync(import_node_path4.default.join(projectPath, generationFolder, "schema.zmodel"), STARTER_ZMODEL);
406
+ if (!import_node_fs4.default.existsSync(import_node_path4.default.join(projectPath, generationFolder, "schema.zmodel"))) {
407
+ import_node_fs4.default.writeFileSync(import_node_path4.default.join(projectPath, generationFolder, "schema.zmodel"), STARTER_ZMODEL);
403
408
  } else {
404
409
  console.log(import_colors4.default.yellow("Schema file already exists. Skipping generation of sample."));
405
410
  }
@@ -410,35 +415,42 @@ async function run4(projectPath) {
410
415
  __name(run4, "run");
411
416
 
412
417
  // src/actions/migrate.ts
413
- var import_node_path5 = __toESM(require("path"), 1);
418
+ var import_node_fs5 = __toESM(require("fs"), 1);
414
419
  async function run5(command, options) {
415
420
  const schemaFile = getSchemaFile(options.schema);
416
- await run({
417
- schema: schemaFile,
418
- silent: true
419
- });
420
- const prismaSchemaFile = import_node_path5.default.join(import_node_path5.default.dirname(schemaFile), "schema.prisma");
421
- switch (command) {
422
- case "dev":
423
- await runDev(prismaSchemaFile, options);
424
- break;
425
- case "reset":
426
- await runReset(prismaSchemaFile, options);
427
- break;
428
- case "deploy":
429
- await runDeploy(prismaSchemaFile, options);
430
- break;
431
- case "status":
432
- await runStatus(prismaSchemaFile, options);
433
- break;
421
+ const prismaSchemaFile = await generateTempPrismaSchema(schemaFile);
422
+ try {
423
+ switch (command) {
424
+ case "dev":
425
+ await runDev(prismaSchemaFile, options);
426
+ break;
427
+ case "reset":
428
+ await runReset(prismaSchemaFile, options);
429
+ break;
430
+ case "deploy":
431
+ await runDeploy(prismaSchemaFile, options);
432
+ break;
433
+ case "status":
434
+ await runStatus(prismaSchemaFile, options);
435
+ break;
436
+ }
437
+ } finally {
438
+ if (import_node_fs5.default.existsSync(prismaSchemaFile)) {
439
+ import_node_fs5.default.unlinkSync(prismaSchemaFile);
440
+ }
434
441
  }
435
442
  }
436
443
  __name(run5, "run");
437
- async function runDev(prismaSchemaFile, _options) {
444
+ async function runDev(prismaSchemaFile, options) {
438
445
  try {
439
- await execPackage(`prisma migrate dev --schema "${prismaSchemaFile}" --skip-generate`, {
440
- stdio: "inherit"
441
- });
446
+ const cmd = [
447
+ "prisma migrate dev",
448
+ ` --schema "${prismaSchemaFile}"`,
449
+ " --skip-generate",
450
+ options.name ? ` --name ${options.name}` : "",
451
+ options.createOnly ? " --create-only" : ""
452
+ ].join("");
453
+ await execPackage(cmd);
442
454
  } catch (err) {
443
455
  handleSubProcessError2(err);
444
456
  }
@@ -446,9 +458,12 @@ async function runDev(prismaSchemaFile, _options) {
446
458
  __name(runDev, "runDev");
447
459
  async function runReset(prismaSchemaFile, options) {
448
460
  try {
449
- await execPackage(`prisma migrate reset --schema "${prismaSchemaFile}"${options.force ? " --force" : ""}`, {
450
- stdio: "inherit"
451
- });
461
+ const cmd = [
462
+ "prisma migrate reset",
463
+ ` --schema "${prismaSchemaFile}"`,
464
+ options.force ? " --force" : ""
465
+ ].join("");
466
+ await execPackage(cmd);
452
467
  } catch (err) {
453
468
  handleSubProcessError2(err);
454
469
  }
@@ -456,9 +471,11 @@ async function runReset(prismaSchemaFile, options) {
456
471
  __name(runReset, "runReset");
457
472
  async function runDeploy(prismaSchemaFile, _options) {
458
473
  try {
459
- await execPackage(`prisma migrate deploy --schema "${prismaSchemaFile}"`, {
460
- stdio: "inherit"
461
- });
474
+ const cmd = [
475
+ "prisma migrate deploy",
476
+ ` --schema "${prismaSchemaFile}"`
477
+ ].join("");
478
+ await execPackage(cmd);
462
479
  } catch (err) {
463
480
  handleSubProcessError2(err);
464
481
  }
@@ -466,9 +483,7 @@ async function runDeploy(prismaSchemaFile, _options) {
466
483
  __name(runDeploy, "runDeploy");
467
484
  async function runStatus(prismaSchemaFile, _options) {
468
485
  try {
469
- await execPackage(`prisma migrate status --schema "${prismaSchemaFile}"`, {
470
- stdio: "inherit"
471
- });
486
+ await execPackage(`prisma migrate status --schema "${prismaSchemaFile}"`);
472
487
  } catch (err) {
473
488
  handleSubProcessError2(err);
474
489
  }
@@ -484,28 +499,29 @@ function handleSubProcessError2(err) {
484
499
  __name(handleSubProcessError2, "handleSubProcessError");
485
500
 
486
501
  // src/utils/version-utils.ts
502
+ var import_node_fs6 = __toESM(require("fs"), 1);
503
+ var import_node_path5 = __toESM(require("path"), 1);
504
+ var import_node_url = require("url");
505
+ var import_meta = {};
487
506
  function getVersion() {
488
507
  try {
489
- return require("../package.json").version;
508
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : import_node_path5.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
509
+ return JSON.parse(import_node_fs6.default.readFileSync(import_node_path5.default.join(_dirname, "../package.json"), "utf8")).version;
490
510
  } catch {
491
- try {
492
- return require_package().version;
493
- } catch {
494
- return void 0;
495
- }
511
+ return void 0;
496
512
  }
497
513
  }
498
514
  __name(getVersion, "getVersion");
499
515
 
500
516
  // src/index.ts
501
517
  var generateAction = /* @__PURE__ */ __name(async (options) => {
502
- await run(options);
518
+ await run2(options);
503
519
  }, "generateAction");
504
520
  var migrateAction = /* @__PURE__ */ __name(async (command, options) => {
505
521
  await run5(command, options);
506
522
  }, "migrateAction");
507
523
  var dbAction = /* @__PURE__ */ __name(async (command, options) => {
508
- await run2(command, options);
524
+ await run(command, options);
509
525
  }, "dbAction");
510
526
  var infoAction = /* @__PURE__ */ __name(async (projectPath) => {
511
527
  await run3(projectPath);
@@ -521,7 +537,7 @@ function createProgram() {
521
537
 
522
538
  Documentation: https://zenstack.dev.`).showHelpAfterError().showSuggestionAfterError();
523
539
  const schemaOption = new import_commander.Option("--schema <file>", `schema file (with extension ${schemaExtensions}). Defaults to "schema.zmodel" unless specified in package.json.`);
524
- program2.command("generate").description("Run code generation.").addOption(schemaOption).addOption(new import_commander.Option("-o, --output <path>", "default output directory for core plugins")).action(generateAction);
540
+ program2.command("generate").description("Run code generation.").addOption(schemaOption).addOption(new import_commander.Option("--silent", "do not print any output")).addOption(new import_commander.Option("--save-prisma-schema [path]", "save a Prisma schema file, by default into the output directory")).addOption(new import_commander.Option("-o, --output <path>", "default output directory for core plugins")).action(generateAction);
525
541
  const migrateCommand = program2.command("migrate").description("Update the database schema with migrations.");
526
542
  migrateCommand.command("dev").addOption(schemaOption).addOption(new import_commander.Option("-n, --name <name>", "migration name")).addOption(new import_commander.Option("--create-only", "only create migration, do not apply")).description("Create a migration from changes in schema and apply it to the database.").action((options) => migrateAction("dev", options));
527
543
  migrateCommand.command("reset").addOption(schemaOption).addOption(new import_commander.Option("--force", "skip the confirmation prompt")).description("Reset your database and apply all migrations, all data will be lost.").action((options) => migrateAction("reset", options));