@zenstackhq/cli 3.0.0-alpha.26 → 3.0.0-alpha.28
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/.turbo/turbo-build.log +8 -8
- package/dist/index.cjs +165 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +169 -66
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/actions/{validate.ts → check.ts} +1 -1
- package/src/actions/generate.ts +85 -35
- package/src/actions/index.ts +2 -2
- package/src/index.ts +16 -19
- package/src/plugins/index.ts +2 -0
- package/src/plugins/prisma.ts +21 -0
- package/src/plugins/typescript.ts +21 -0
- package/test/{validate.test.ts → check.test.ts} +6 -6
- package/test/generate.test.ts +0 -12
- package/test/plugins/custom-plugin.test.ts +50 -0
- package/test/plugins/prisma-plugin.test.ts +60 -0
- package/tsconfig.json +0 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @zenstackhq/cli@3.0.0-alpha.
|
|
2
|
+
> @zenstackhq/cli@3.0.0-alpha.28 build /home/runner/work/zenstack-v3/zenstack-v3/packages/cli
|
|
3
3
|
> tsc --noEmit && tsup-node
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts"}
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
13
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m26.78 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m48.65 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 129ms
|
|
16
|
+
[32mESM[39m [1mdist/index.js [22m[32m23.19 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m48.28 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 131ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 3413ms
|
|
21
21
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m108.00 B[39m
|
|
22
22
|
[32mDTS[39m [1mdist/index.d.cts [22m[32m108.00 B[39m
|
package/dist/index.cjs
CHANGED
|
@@ -217,32 +217,73 @@ __name(runPush, "runPush");
|
|
|
217
217
|
// src/actions/generate.ts
|
|
218
218
|
var import_common_helpers = require("@zenstackhq/common-helpers");
|
|
219
219
|
var import_ast2 = require("@zenstackhq/language/ast");
|
|
220
|
-
var
|
|
220
|
+
var import_utils = require("@zenstackhq/language/utils");
|
|
221
221
|
var import_colors2 = __toESM(require("colors"), 1);
|
|
222
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
223
|
+
var import_ora = __toESM(require("ora"), 1);
|
|
224
|
+
|
|
225
|
+
// src/plugins/index.ts
|
|
226
|
+
var plugins_exports = {};
|
|
227
|
+
__export(plugins_exports, {
|
|
228
|
+
prisma: () => prisma_default,
|
|
229
|
+
typescript: () => typescript_default
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// src/plugins/prisma.ts
|
|
233
|
+
var import_sdk2 = require("@zenstackhq/sdk");
|
|
222
234
|
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
223
235
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
236
|
+
var plugin = {
|
|
237
|
+
name: "Prisma Schema Generator",
|
|
238
|
+
statusText: "Generating Prisma schema",
|
|
239
|
+
async generate({ model, defaultOutputPath, pluginOptions }) {
|
|
240
|
+
let outDir = defaultOutputPath;
|
|
241
|
+
if (typeof pluginOptions["output"] === "string") {
|
|
242
|
+
outDir = import_node_path2.default.resolve(defaultOutputPath, pluginOptions["output"]);
|
|
243
|
+
if (!import_node_fs3.default.existsSync(outDir)) {
|
|
244
|
+
import_node_fs3.default.mkdirSync(outDir, {
|
|
245
|
+
recursive: true
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const prismaSchema = await new import_sdk2.PrismaSchemaGenerator(model).generate();
|
|
250
|
+
import_node_fs3.default.writeFileSync(import_node_path2.default.join(outDir, "schema.prisma"), prismaSchema);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
var prisma_default = plugin;
|
|
254
|
+
|
|
255
|
+
// src/plugins/typescript.ts
|
|
256
|
+
var import_sdk3 = require("@zenstackhq/sdk");
|
|
257
|
+
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
258
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
259
|
+
var plugin2 = {
|
|
260
|
+
name: "TypeScript Schema Generator",
|
|
261
|
+
statusText: "Generating TypeScript schema",
|
|
262
|
+
async generate({ model, defaultOutputPath, pluginOptions }) {
|
|
263
|
+
let outDir = defaultOutputPath;
|
|
264
|
+
if (typeof pluginOptions["output"] === "string") {
|
|
265
|
+
outDir = import_node_path3.default.resolve(defaultOutputPath, pluginOptions["output"]);
|
|
266
|
+
if (!import_node_fs4.default.existsSync(outDir)) {
|
|
267
|
+
import_node_fs4.default.mkdirSync(outDir, {
|
|
268
|
+
recursive: true
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
await new import_sdk3.TsSchemaGenerator().generate(model, outDir);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
var typescript_default = plugin2;
|
|
276
|
+
|
|
277
|
+
// src/actions/generate.ts
|
|
224
278
|
async function run2(options) {
|
|
225
279
|
const start = Date.now();
|
|
226
280
|
const schemaFile = getSchemaFile(options.schema);
|
|
227
281
|
const model = await loadSchemaDocument(schemaFile);
|
|
228
282
|
const outputPath = getOutputPath(options, schemaFile);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const prismaSchema = await new import_sdk2.PrismaSchemaGenerator(model).generate();
|
|
234
|
-
let prismaSchemaFile = import_node_path2.default.join(outputPath, "schema.prisma");
|
|
235
|
-
if (typeof options.savePrismaSchema === "string") {
|
|
236
|
-
prismaSchemaFile = import_node_path2.default.resolve(outputPath, options.savePrismaSchema);
|
|
237
|
-
import_node_fs3.default.mkdirSync(import_node_path2.default.dirname(prismaSchemaFile), {
|
|
238
|
-
recursive: true
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
import_node_fs3.default.writeFileSync(prismaSchemaFile, prismaSchema);
|
|
242
|
-
}
|
|
243
|
-
if (!options.silent) {
|
|
244
|
-
console.log(import_colors2.default.green(`Generation completed successfully in ${Date.now() - start}ms.`));
|
|
245
|
-
console.log(`You can now create a ZenStack client with it.
|
|
283
|
+
await runPlugins(schemaFile, model, outputPath);
|
|
284
|
+
console.log(import_colors2.default.green(`Generation completed successfully in ${Date.now() - start}ms.
|
|
285
|
+
`));
|
|
286
|
+
console.log(`You can now create a ZenStack client with it.
|
|
246
287
|
|
|
247
288
|
\`\`\`ts
|
|
248
289
|
import { ZenStackClient } from '@zenstackhq/runtime';
|
|
@@ -252,7 +293,6 @@ const client = new ZenStackClient(schema, {
|
|
|
252
293
|
dialect: { ... }
|
|
253
294
|
});
|
|
254
295
|
\`\`\``);
|
|
255
|
-
}
|
|
256
296
|
}
|
|
257
297
|
__name(run2, "run");
|
|
258
298
|
function getOutputPath(options, schemaFile) {
|
|
@@ -263,34 +303,93 @@ function getOutputPath(options, schemaFile) {
|
|
|
263
303
|
if (pkgJsonConfig.output) {
|
|
264
304
|
return pkgJsonConfig.output;
|
|
265
305
|
} else {
|
|
266
|
-
return
|
|
306
|
+
return import_node_path4.default.dirname(schemaFile);
|
|
267
307
|
}
|
|
268
308
|
}
|
|
269
309
|
__name(getOutputPath, "getOutputPath");
|
|
270
|
-
async function runPlugins(model, outputPath
|
|
310
|
+
async function runPlugins(schemaFile, model, outputPath) {
|
|
271
311
|
const plugins = model.declarations.filter(import_ast2.isPlugin);
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
312
|
+
const processedPlugins = [];
|
|
313
|
+
for (const plugin3 of plugins) {
|
|
314
|
+
const provider = getPluginProvider(plugin3);
|
|
315
|
+
let cliPlugin;
|
|
316
|
+
if (provider.startsWith("@core/")) {
|
|
317
|
+
cliPlugin = plugins_exports[provider.slice("@core/".length)];
|
|
318
|
+
if (!cliPlugin) {
|
|
319
|
+
throw new CliError(`Unknown core plugin: ${provider}`);
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
let moduleSpec = provider;
|
|
323
|
+
if (moduleSpec.startsWith(".")) {
|
|
324
|
+
moduleSpec = import_node_path4.default.resolve(import_node_path4.default.dirname(schemaFile), moduleSpec);
|
|
325
|
+
}
|
|
326
|
+
try {
|
|
327
|
+
cliPlugin = (await import(moduleSpec)).default;
|
|
328
|
+
} catch (error) {
|
|
329
|
+
throw new CliError(`Failed to load plugin ${provider}: ${error}`);
|
|
330
|
+
}
|
|
279
331
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
model,
|
|
284
|
-
outputPath,
|
|
285
|
-
tsSchemaFile
|
|
332
|
+
processedPlugins.push({
|
|
333
|
+
cliPlugin,
|
|
334
|
+
pluginOptions: getPluginOptions(plugin3)
|
|
286
335
|
});
|
|
287
336
|
}
|
|
337
|
+
const defaultPlugins = [
|
|
338
|
+
typescript_default
|
|
339
|
+
].reverse();
|
|
340
|
+
defaultPlugins.forEach((d) => {
|
|
341
|
+
if (!processedPlugins.some((p) => p.cliPlugin === d)) {
|
|
342
|
+
processedPlugins.push({
|
|
343
|
+
cliPlugin: d,
|
|
344
|
+
pluginOptions: {}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
for (const { cliPlugin, pluginOptions } of processedPlugins) {
|
|
349
|
+
(0, import_common_helpers.invariant)(typeof cliPlugin.generate === "function", `Plugin ${cliPlugin.name} does not have a generate function`);
|
|
350
|
+
const spinner = (0, import_ora.default)(cliPlugin.statusText ?? `Running plugin ${cliPlugin.name}`).start();
|
|
351
|
+
try {
|
|
352
|
+
await cliPlugin.generate({
|
|
353
|
+
schemaFile,
|
|
354
|
+
model,
|
|
355
|
+
defaultOutputPath: outputPath,
|
|
356
|
+
pluginOptions
|
|
357
|
+
});
|
|
358
|
+
spinner.succeed();
|
|
359
|
+
} catch (err) {
|
|
360
|
+
spinner.fail();
|
|
361
|
+
console.error(err);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
288
364
|
}
|
|
289
365
|
__name(runPlugins, "runPlugins");
|
|
366
|
+
function getPluginProvider(plugin3) {
|
|
367
|
+
const providerField = plugin3.fields.find((f) => f.name === "provider");
|
|
368
|
+
(0, import_common_helpers.invariant)(providerField, `Plugin ${plugin3.name} does not have a provider field`);
|
|
369
|
+
const provider = providerField.value.value;
|
|
370
|
+
return provider;
|
|
371
|
+
}
|
|
372
|
+
__name(getPluginProvider, "getPluginProvider");
|
|
373
|
+
function getPluginOptions(plugin3) {
|
|
374
|
+
const result = {};
|
|
375
|
+
for (const field of plugin3.fields) {
|
|
376
|
+
if (field.name === "provider") {
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
const value = (0, import_utils.getLiteral)(field.value) ?? (0, import_utils.getLiteralArray)(field.value);
|
|
380
|
+
if (value === void 0) {
|
|
381
|
+
console.warn(`Plugin "${plugin3.name}" option "${field.name}" has unsupported value, skipping`);
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
result[field.name] = value;
|
|
385
|
+
}
|
|
386
|
+
return result;
|
|
387
|
+
}
|
|
388
|
+
__name(getPluginOptions, "getPluginOptions");
|
|
290
389
|
|
|
291
390
|
// src/actions/info.ts
|
|
292
391
|
var import_colors3 = __toESM(require("colors"), 1);
|
|
293
|
-
var
|
|
392
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
294
393
|
async function run3(projectPath) {
|
|
295
394
|
const packages = await getZenStackPackages(projectPath);
|
|
296
395
|
if (!packages) {
|
|
@@ -312,9 +411,9 @@ async function run3(projectPath) {
|
|
|
312
411
|
__name(run3, "run");
|
|
313
412
|
async function getZenStackPackages(projectPath) {
|
|
314
413
|
let pkgJson;
|
|
315
|
-
const resolvedPath =
|
|
414
|
+
const resolvedPath = import_node_path5.default.resolve(projectPath);
|
|
316
415
|
try {
|
|
317
|
-
pkgJson = (await import(
|
|
416
|
+
pkgJson = (await import(import_node_path5.default.join(resolvedPath, "package.json"), {
|
|
318
417
|
with: {
|
|
319
418
|
type: "json"
|
|
320
419
|
}
|
|
@@ -350,9 +449,9 @@ __name(getZenStackPackages, "getZenStackPackages");
|
|
|
350
449
|
|
|
351
450
|
// src/actions/init.ts
|
|
352
451
|
var import_colors4 = __toESM(require("colors"), 1);
|
|
353
|
-
var
|
|
354
|
-
var
|
|
355
|
-
var
|
|
452
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
453
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
454
|
+
var import_ora2 = __toESM(require("ora"), 1);
|
|
356
455
|
var import_package_manager_detector = require("package-manager-detector");
|
|
357
456
|
|
|
358
457
|
// src/actions/templates.ts
|
|
@@ -414,7 +513,7 @@ async function run4(projectPath) {
|
|
|
414
513
|
if (!resolved) {
|
|
415
514
|
throw new CliError(`Unable to determine how to install package "${pkg.name}". Please install it manually.`);
|
|
416
515
|
}
|
|
417
|
-
const spinner = (0,
|
|
516
|
+
const spinner = (0, import_ora2.default)(`Installing "${pkg.name}"`).start();
|
|
418
517
|
try {
|
|
419
518
|
execSync(`${resolved.command} ${resolved.args.join(" ")}`, {
|
|
420
519
|
cwd: projectPath
|
|
@@ -426,11 +525,11 @@ async function run4(projectPath) {
|
|
|
426
525
|
}
|
|
427
526
|
}
|
|
428
527
|
const generationFolder = "zenstack";
|
|
429
|
-
if (!
|
|
430
|
-
|
|
528
|
+
if (!import_node_fs5.default.existsSync(import_node_path6.default.join(projectPath, generationFolder))) {
|
|
529
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.join(projectPath, generationFolder));
|
|
431
530
|
}
|
|
432
|
-
if (!
|
|
433
|
-
|
|
531
|
+
if (!import_node_fs5.default.existsSync(import_node_path6.default.join(projectPath, generationFolder, "schema.zmodel"))) {
|
|
532
|
+
import_node_fs5.default.writeFileSync(import_node_path6.default.join(projectPath, generationFolder, "schema.zmodel"), STARTER_ZMODEL);
|
|
434
533
|
} else {
|
|
435
534
|
console.log(import_colors4.default.yellow("Schema file already exists. Skipping generation of sample."));
|
|
436
535
|
}
|
|
@@ -441,11 +540,11 @@ async function run4(projectPath) {
|
|
|
441
540
|
__name(run4, "run");
|
|
442
541
|
|
|
443
542
|
// src/actions/migrate.ts
|
|
444
|
-
var
|
|
445
|
-
var
|
|
543
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
544
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
446
545
|
async function run5(command, options) {
|
|
447
546
|
const schemaFile = getSchemaFile(options.schema);
|
|
448
|
-
const prismaSchemaDir = options.migrations ?
|
|
547
|
+
const prismaSchemaDir = options.migrations ? import_node_path7.default.dirname(options.migrations) : void 0;
|
|
449
548
|
const prismaSchemaFile = await generateTempPrismaSchema(schemaFile, prismaSchemaDir);
|
|
450
549
|
try {
|
|
451
550
|
switch (command) {
|
|
@@ -466,8 +565,8 @@ async function run5(command, options) {
|
|
|
466
565
|
break;
|
|
467
566
|
}
|
|
468
567
|
} finally {
|
|
469
|
-
if (
|
|
470
|
-
|
|
568
|
+
if (import_node_fs6.default.existsSync(prismaSchemaFile)) {
|
|
569
|
+
import_node_fs6.default.unlinkSync(prismaSchemaFile);
|
|
471
570
|
}
|
|
472
571
|
}
|
|
473
572
|
}
|
|
@@ -546,7 +645,7 @@ function handleSubProcessError2(err) {
|
|
|
546
645
|
}
|
|
547
646
|
__name(handleSubProcessError2, "handleSubProcessError");
|
|
548
647
|
|
|
549
|
-
// src/actions/
|
|
648
|
+
// src/actions/check.ts
|
|
550
649
|
var import_colors5 = __toESM(require("colors"), 1);
|
|
551
650
|
async function run6(options) {
|
|
552
651
|
const schemaFile = getSchemaFile(options.schema);
|
|
@@ -561,14 +660,14 @@ async function run6(options) {
|
|
|
561
660
|
__name(run6, "run");
|
|
562
661
|
|
|
563
662
|
// src/utils/version-utils.ts
|
|
564
|
-
var
|
|
565
|
-
var
|
|
663
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
664
|
+
var import_node_path8 = __toESM(require("path"), 1);
|
|
566
665
|
var import_node_url = require("url");
|
|
567
666
|
var import_meta = {};
|
|
568
667
|
function getVersion() {
|
|
569
668
|
try {
|
|
570
|
-
const _dirname = typeof __dirname !== "undefined" ? __dirname :
|
|
571
|
-
return JSON.parse(
|
|
669
|
+
const _dirname = typeof __dirname !== "undefined" ? __dirname : import_node_path8.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
670
|
+
return JSON.parse(import_node_fs7.default.readFileSync(import_node_path8.default.join(_dirname, "../package.json"), "utf8")).version;
|
|
572
671
|
} catch {
|
|
573
672
|
return void 0;
|
|
574
673
|
}
|
|
@@ -591,30 +690,30 @@ var infoAction = /* @__PURE__ */ __name(async (projectPath) => {
|
|
|
591
690
|
var initAction = /* @__PURE__ */ __name(async (projectPath) => {
|
|
592
691
|
await run4(projectPath);
|
|
593
692
|
}, "initAction");
|
|
594
|
-
var
|
|
693
|
+
var checkAction = /* @__PURE__ */ __name(async (options) => {
|
|
595
694
|
await run6(options);
|
|
596
|
-
}, "
|
|
695
|
+
}, "checkAction");
|
|
597
696
|
function createProgram() {
|
|
598
697
|
const program2 = new import_commander.Command("zenstack");
|
|
599
698
|
program2.version(getVersion(), "-v --version", "display CLI version");
|
|
600
699
|
const schemaExtensions = import_language2.ZModelLanguageMetaData.fileExtensions.join(", ");
|
|
601
|
-
program2.description(`${import_colors6.default.bold.blue("\u03B6")} ZenStack is
|
|
700
|
+
program2.description(`${import_colors6.default.bold.blue("\u03B6")} ZenStack is the data layer for modern TypeScript apps.
|
|
602
701
|
|
|
603
702
|
Documentation: https://zenstack.dev.`).showHelpAfterError().showSuggestionAfterError();
|
|
604
|
-
const schemaOption = new import_commander.Option("--schema <file>", `schema file (with extension ${schemaExtensions}). Defaults to "schema.zmodel" unless specified in package.json.`);
|
|
605
|
-
program2.command("generate").description("Run code generation.").addOption(schemaOption).addOption(new import_commander.Option("
|
|
606
|
-
const migrateCommand = program2.command("migrate").description("
|
|
607
|
-
const migrationsOption = new import_commander.Option("--migrations <path>",
|
|
703
|
+
const schemaOption = new import_commander.Option("--schema <file>", `schema file (with extension ${schemaExtensions}). Defaults to "zenstack/schema.zmodel" unless specified in package.json.`);
|
|
704
|
+
program2.command("generate").description("Run code generation plugins.").addOption(schemaOption).addOption(new import_commander.Option("-o, --output <path>", "default output directory for code generation")).action(generateAction);
|
|
705
|
+
const migrateCommand = program2.command("migrate").description("Run database schema migration related tasks.");
|
|
706
|
+
const migrationsOption = new import_commander.Option("--migrations <path>", 'path that contains the "migrations" directory');
|
|
608
707
|
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")).addOption(migrationsOption).description("Create a migration from changes in schema and apply it to the database.").action((options) => migrateAction("dev", options));
|
|
609
708
|
migrateCommand.command("reset").addOption(schemaOption).addOption(new import_commander.Option("--force", "skip the confirmation prompt")).addOption(migrationsOption).description("Reset your database and apply all migrations, all data will be lost.").action((options) => migrateAction("reset", options));
|
|
610
709
|
migrateCommand.command("deploy").addOption(schemaOption).addOption(migrationsOption).description("Deploy your pending migrations to your production/staging database.").action((options) => migrateAction("deploy", options));
|
|
611
710
|
migrateCommand.command("status").addOption(schemaOption).addOption(migrationsOption).description("Check the status of your database migrations.").action((options) => migrateAction("status", options));
|
|
612
|
-
migrateCommand.command("resolve").addOption(schemaOption).addOption(migrationsOption).addOption(new import_commander.Option("--applied <migration>", "record a specific migration as applied")).addOption(new import_commander.Option("--rolled-back <migration>", "record a specific migration as rolled back")).description("Resolve issues with database migrations in deployment databases").action((options) => migrateAction("resolve", options));
|
|
711
|
+
migrateCommand.command("resolve").addOption(schemaOption).addOption(migrationsOption).addOption(new import_commander.Option("--applied <migration>", "record a specific migration as applied")).addOption(new import_commander.Option("--rolled-back <migration>", "record a specific migration as rolled back")).description("Resolve issues with database migrations in deployment databases.").action((options) => migrateAction("resolve", options));
|
|
613
712
|
const dbCommand = program2.command("db").description("Manage your database schema during development.");
|
|
614
|
-
dbCommand.command("push").description("Push the state from your schema to your database").addOption(schemaOption).addOption(new import_commander.Option("--accept-data-loss", "ignore data loss warnings")).addOption(new import_commander.Option("--force-reset", "force a reset of the database before push")).action((options) => dbAction("push", options));
|
|
615
|
-
program2.command("info").description("Get information of installed ZenStack
|
|
713
|
+
dbCommand.command("push").description("Push the state from your schema to your database.").addOption(schemaOption).addOption(new import_commander.Option("--accept-data-loss", "ignore data loss warnings")).addOption(new import_commander.Option("--force-reset", "force a reset of the database before push")).action((options) => dbAction("push", options));
|
|
714
|
+
program2.command("info").description("Get information of installed ZenStack packages.").argument("[path]", "project path", ".").action(infoAction);
|
|
616
715
|
program2.command("init").description("Initialize an existing project for ZenStack.").argument("[path]", "project path", ".").action(initAction);
|
|
617
|
-
program2.command("
|
|
716
|
+
program2.command("check").description("Check a ZModel schema for syntax or semantic errors.").addOption(schemaOption).action(checkAction);
|
|
618
717
|
return program2;
|
|
619
718
|
}
|
|
620
719
|
__name(createProgram, "createProgram");
|