@contember/cli 1.2.0-alpha.1 → 1.2.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.
- package/Dockerfile +3 -2
- package/build.sh +1 -0
- package/dist/src/commands/deploy/DeployCommand.d.ts +3 -1
- package/dist/src/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/src/commands/deploy/DeployCommand.js +15 -15
- package/dist/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationAmendCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.js +8 -2
- package/dist/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationCreateHelper.d.ts +5 -4
- package/dist/src/commands/migrations/MigrationCreateHelper.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationCreateHelper.js +2 -9
- package/dist/src/commands/migrations/MigrationCreateHelper.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.d.ts +4 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationDescribeCommand.js +8 -3
- package/dist/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationDiffCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.js +9 -2
- package/dist/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationExecuteCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationExecuteCommand.js +8 -5
- package/dist/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationRebaseCommand.d.ts +4 -2
- package/dist/src/commands/migrations/MigrationRebaseCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationRebaseCommand.js +8 -2
- package/dist/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.d.ts +4 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationStatusCommand.js +8 -3
- package/dist/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/src/commands/migrations/SystemApiClientResolver.d.ts +3 -3
- package/dist/src/commands/migrations/SystemApiClientResolver.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectCreateCommand.d.ts +3 -0
- package/dist/src/commands/project/ProjectCreateCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectCreateCommand.js +5 -1
- package/dist/src/commands/project/ProjectCreateCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectGenerateDocumentation.d.ts +4 -2
- package/dist/src/commands/project/ProjectGenerateDocumentation.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectGenerateDocumentation.js +8 -4
- package/dist/src/commands/project/ProjectGenerateDocumentation.js.map +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.d.ts +4 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js +10 -6
- package/dist/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/src/commands/project/ProjectValidateCommand.d.ts +4 -2
- package/dist/src/commands/project/ProjectValidateCommand.d.ts.map +1 -1
- package/dist/src/commands/project/ProjectValidateCommand.js +8 -5
- package/dist/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/src/commands/tenant/CreateApiKeyCommand.d.ts +3 -0
- package/dist/src/commands/tenant/CreateApiKeyCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/CreateApiKeyCommand.js +5 -2
- package/dist/src/commands/tenant/CreateApiKeyCommand.js.map +1 -1
- package/dist/src/commands/tenant/InviteCommand.d.ts +3 -0
- package/dist/src/commands/tenant/InviteCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/InviteCommand.js +5 -2
- package/dist/src/commands/tenant/InviteCommand.js.map +1 -1
- package/dist/src/commands/tenant/ResetPasswordCommand.d.ts +3 -0
- package/dist/src/commands/tenant/ResetPasswordCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/ResetPasswordCommand.js +5 -2
- package/dist/src/commands/tenant/ResetPasswordCommand.js.map +1 -1
- package/dist/src/commands/tenant/SignInCommand.d.ts +3 -0
- package/dist/src/commands/tenant/SignInCommand.d.ts.map +1 -1
- package/dist/src/commands/tenant/SignInCommand.js +5 -2
- package/dist/src/commands/tenant/SignInCommand.js.map +1 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.d.ts +3 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.d.ts.map +1 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.js +5 -1
- package/dist/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
- package/dist/src/run.js +22 -23
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/instance/interactiveUtils.d.ts +1 -1
- package/dist/src/utils/instance/interactiveUtils.d.ts.map +1 -1
- package/dist/src/utils/project/resources/out.css +97 -14
- package/dist/src/utils/schema.d.ts +2 -2
- package/dist/src/utils/schema.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/commands/deploy/DeployCommand.ts +20 -15
- package/src/commands/migrations/MigrationAmendCommand.ts +12 -3
- package/src/commands/migrations/MigrationCreateHelper.ts +2 -7
- package/src/commands/migrations/MigrationDescribeCommand.ts +11 -3
- package/src/commands/migrations/MigrationDiffCommand.ts +14 -4
- package/src/commands/migrations/MigrationExecuteCommand.ts +11 -6
- package/src/commands/migrations/MigrationRebaseCommand.ts +13 -3
- package/src/commands/migrations/MigrationStatusCommand.ts +11 -3
- package/src/commands/project/ProjectCreateCommand.ts +7 -1
- package/src/commands/project/ProjectGenerateDocumentation.ts +12 -7
- package/src/commands/project/ProjectPrintSchemaCommand.ts +12 -5
- package/src/commands/project/ProjectValidateCommand.ts +11 -6
- package/src/commands/tenant/CreateApiKeyCommand.ts +7 -1
- package/src/commands/tenant/InviteCommand.ts +7 -1
- package/src/commands/tenant/ResetPasswordCommand.ts +7 -1
- package/src/commands/tenant/SignInCommand.ts +7 -1
- package/src/commands/workspace/WorkspaceUpdateApiCommand.ts +7 -1
- package/src/run.ts +24 -26
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { InstanceApiEnvironment } from './environment';
|
|
2
2
|
import { Workspace } from '@contember/cli-common';
|
|
3
|
-
export declare const interactiveResolveInstanceEnvironmentFromInput: (workspace: Workspace, instance?: string
|
|
3
|
+
export declare const interactiveResolveInstanceEnvironmentFromInput: (workspace: Workspace, instance?: string) => Promise<InstanceApiEnvironment>;
|
|
4
4
|
//# sourceMappingURL=interactiveUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactiveUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/instance/interactiveUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAgBjD,eAAO,MAAM,8CAA8C,cAC/C,SAAS,
|
|
1
|
+
{"version":3,"file":"interactiveUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/instance/interactiveUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAgBjD,eAAO,MAAM,8CAA8C,cAC/C,SAAS,aACT,MAAM,KACf,QAAQ,sBAAsB,CAkBhC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
! tailwindcss v3.
|
|
2
|
+
! tailwindcss v3.1.8 | MIT License | https://tailwindcss.com
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -187,6 +187,8 @@ textarea {
|
|
|
187
187
|
/* 1 */
|
|
188
188
|
font-size: 100%;
|
|
189
189
|
/* 1 */
|
|
190
|
+
font-weight: inherit;
|
|
191
|
+
/* 1 */
|
|
190
192
|
line-height: inherit;
|
|
191
193
|
/* 1 */
|
|
192
194
|
color: inherit;
|
|
@@ -353,13 +355,6 @@ input::-moz-placeholder, textarea::-moz-placeholder {
|
|
|
353
355
|
/* 2 */
|
|
354
356
|
}
|
|
355
357
|
|
|
356
|
-
input:-ms-input-placeholder, textarea:-ms-input-placeholder {
|
|
357
|
-
opacity: 1;
|
|
358
|
-
/* 1 */
|
|
359
|
-
color: #9ca3af;
|
|
360
|
-
/* 2 */
|
|
361
|
-
}
|
|
362
|
-
|
|
363
358
|
input::placeholder,
|
|
364
359
|
textarea::placeholder {
|
|
365
360
|
opacity: 1;
|
|
@@ -415,15 +410,103 @@ video {
|
|
|
415
410
|
height: auto;
|
|
416
411
|
}
|
|
417
412
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
413
|
+
*, ::before, ::after {
|
|
414
|
+
--tw-border-spacing-x: 0;
|
|
415
|
+
--tw-border-spacing-y: 0;
|
|
416
|
+
--tw-translate-x: 0;
|
|
417
|
+
--tw-translate-y: 0;
|
|
418
|
+
--tw-rotate: 0;
|
|
419
|
+
--tw-skew-x: 0;
|
|
420
|
+
--tw-skew-y: 0;
|
|
421
|
+
--tw-scale-x: 1;
|
|
422
|
+
--tw-scale-y: 1;
|
|
423
|
+
--tw-pan-x: ;
|
|
424
|
+
--tw-pan-y: ;
|
|
425
|
+
--tw-pinch-zoom: ;
|
|
426
|
+
--tw-scroll-snap-strictness: proximity;
|
|
427
|
+
--tw-ordinal: ;
|
|
428
|
+
--tw-slashed-zero: ;
|
|
429
|
+
--tw-numeric-figure: ;
|
|
430
|
+
--tw-numeric-spacing: ;
|
|
431
|
+
--tw-numeric-fraction: ;
|
|
432
|
+
--tw-ring-inset: ;
|
|
433
|
+
--tw-ring-offset-width: 0px;
|
|
434
|
+
--tw-ring-offset-color: #fff;
|
|
435
|
+
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
436
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
437
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
438
|
+
--tw-shadow: 0 0 #0000;
|
|
439
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
440
|
+
--tw-blur: ;
|
|
441
|
+
--tw-brightness: ;
|
|
442
|
+
--tw-contrast: ;
|
|
443
|
+
--tw-grayscale: ;
|
|
444
|
+
--tw-hue-rotate: ;
|
|
445
|
+
--tw-invert: ;
|
|
446
|
+
--tw-saturate: ;
|
|
447
|
+
--tw-sepia: ;
|
|
448
|
+
--tw-drop-shadow: ;
|
|
449
|
+
--tw-backdrop-blur: ;
|
|
450
|
+
--tw-backdrop-brightness: ;
|
|
451
|
+
--tw-backdrop-contrast: ;
|
|
452
|
+
--tw-backdrop-grayscale: ;
|
|
453
|
+
--tw-backdrop-hue-rotate: ;
|
|
454
|
+
--tw-backdrop-invert: ;
|
|
455
|
+
--tw-backdrop-opacity: ;
|
|
456
|
+
--tw-backdrop-saturate: ;
|
|
457
|
+
--tw-backdrop-sepia: ;
|
|
458
|
+
}
|
|
421
459
|
|
|
422
|
-
|
|
423
|
-
|
|
460
|
+
::-webkit-backdrop {
|
|
461
|
+
--tw-border-spacing-x: 0;
|
|
462
|
+
--tw-border-spacing-y: 0;
|
|
463
|
+
--tw-translate-x: 0;
|
|
464
|
+
--tw-translate-y: 0;
|
|
465
|
+
--tw-rotate: 0;
|
|
466
|
+
--tw-skew-x: 0;
|
|
467
|
+
--tw-skew-y: 0;
|
|
468
|
+
--tw-scale-x: 1;
|
|
469
|
+
--tw-scale-y: 1;
|
|
470
|
+
--tw-pan-x: ;
|
|
471
|
+
--tw-pan-y: ;
|
|
472
|
+
--tw-pinch-zoom: ;
|
|
473
|
+
--tw-scroll-snap-strictness: proximity;
|
|
474
|
+
--tw-ordinal: ;
|
|
475
|
+
--tw-slashed-zero: ;
|
|
476
|
+
--tw-numeric-figure: ;
|
|
477
|
+
--tw-numeric-spacing: ;
|
|
478
|
+
--tw-numeric-fraction: ;
|
|
479
|
+
--tw-ring-inset: ;
|
|
480
|
+
--tw-ring-offset-width: 0px;
|
|
481
|
+
--tw-ring-offset-color: #fff;
|
|
482
|
+
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
483
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
484
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
485
|
+
--tw-shadow: 0 0 #0000;
|
|
486
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
487
|
+
--tw-blur: ;
|
|
488
|
+
--tw-brightness: ;
|
|
489
|
+
--tw-contrast: ;
|
|
490
|
+
--tw-grayscale: ;
|
|
491
|
+
--tw-hue-rotate: ;
|
|
492
|
+
--tw-invert: ;
|
|
493
|
+
--tw-saturate: ;
|
|
494
|
+
--tw-sepia: ;
|
|
495
|
+
--tw-drop-shadow: ;
|
|
496
|
+
--tw-backdrop-blur: ;
|
|
497
|
+
--tw-backdrop-brightness: ;
|
|
498
|
+
--tw-backdrop-contrast: ;
|
|
499
|
+
--tw-backdrop-grayscale: ;
|
|
500
|
+
--tw-backdrop-hue-rotate: ;
|
|
501
|
+
--tw-backdrop-invert: ;
|
|
502
|
+
--tw-backdrop-opacity: ;
|
|
503
|
+
--tw-backdrop-saturate: ;
|
|
504
|
+
--tw-backdrop-sepia: ;
|
|
424
505
|
}
|
|
425
506
|
|
|
426
|
-
|
|
507
|
+
::backdrop {
|
|
508
|
+
--tw-border-spacing-x: 0;
|
|
509
|
+
--tw-border-spacing-y: 0;
|
|
427
510
|
--tw-translate-x: 0;
|
|
428
511
|
--tw-translate-y: 0;
|
|
429
512
|
--tw-rotate: 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ValidationError } from '@contember/schema-utils';
|
|
2
2
|
import { Schema } from '@contember/schema';
|
|
3
|
-
export declare const printValidationErrors: (errors: ValidationError[], message?: string
|
|
4
|
-
export declare const validateSchemaAndPrintErrors: (schema: Schema, message?: string
|
|
3
|
+
export declare const printValidationErrors: (errors: ValidationError[], message?: string) => void;
|
|
4
|
+
export declare const validateSchemaAndPrintErrors: (schema: Schema, message?: string) => boolean;
|
|
5
5
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,eAAO,MAAM,qBAAqB,WAAY,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,eAAO,MAAM,qBAAqB,WAAY,eAAe,EAAE,YAAY,MAAM,SAShF,CAAA;AAED,eAAO,MAAM,4BAA4B,WAAY,MAAM,YAAY,MAAM,KAAG,OAI/E,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/cli",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contember": "./dist/src/run.js"
|
|
@@ -18,24 +18,23 @@
|
|
|
18
18
|
"tailwindcss": "^3.0.24"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@contember/cli-common": "^1.2.0-alpha.
|
|
22
|
-
"@contember/config-loader": "^1.2.0-alpha.
|
|
23
|
-
"@contember/database-migrations": "^1.2.0-alpha.
|
|
24
|
-
"@contember/dic": "^1.2.0-alpha.
|
|
25
|
-
"@contember/engine-content-api": "^1.2.0-alpha.
|
|
26
|
-
"@contember/schema": "^1.2.0-alpha.
|
|
27
|
-
"@contember/schema-definition": "^1.2.0-alpha.
|
|
28
|
-
"@contember/schema-migrations": "^1.2.0-alpha.
|
|
29
|
-
"@contember/schema-utils": "^1.2.0-alpha.
|
|
30
|
-
"
|
|
31
|
-
"chalk": "^4.1.0",
|
|
21
|
+
"@contember/cli-common": "^1.2.0-alpha.10",
|
|
22
|
+
"@contember/config-loader": "^1.2.0-alpha.10",
|
|
23
|
+
"@contember/database-migrations": "^1.2.0-alpha.10",
|
|
24
|
+
"@contember/dic": "^1.2.0-alpha.10",
|
|
25
|
+
"@contember/engine-content-api": "^1.2.0-alpha.10",
|
|
26
|
+
"@contember/schema": "^1.2.0-alpha.10",
|
|
27
|
+
"@contember/schema-definition": "^1.2.0-alpha.10",
|
|
28
|
+
"@contember/schema-migrations": "^1.2.0-alpha.10",
|
|
29
|
+
"@contember/schema-utils": "^1.2.0-alpha.10",
|
|
30
|
+
"chalk": "^4.1.2",
|
|
32
31
|
"chalk-table": "^1.0.2",
|
|
33
|
-
"esbuild": "^0.14.
|
|
32
|
+
"esbuild": "^0.14.54",
|
|
34
33
|
"get-port": "^5.0.0",
|
|
35
|
-
"graphql": "^
|
|
36
|
-
"graphql-request": "^
|
|
34
|
+
"graphql": "^16.5.0",
|
|
35
|
+
"graphql-request": "^4.3.0",
|
|
37
36
|
"js-yaml": "^4.1.0",
|
|
38
|
-
"node-fetch": "^2.
|
|
37
|
+
"node-fetch": "^2.0",
|
|
39
38
|
"pg": "^8.5.0",
|
|
40
39
|
"preact": "^10.7.1",
|
|
41
40
|
"preact-render-to-string": "^5.2.0",
|
|
@@ -13,7 +13,7 @@ import { MigrationsContainerFactory } from '../../MigrationsContainer'
|
|
|
13
13
|
import { AdminClient, readAdminFiles } from '../../utils/admin'
|
|
14
14
|
import { URL } from 'url'
|
|
15
15
|
import prompts from 'prompts'
|
|
16
|
-
import {
|
|
16
|
+
import { createMigrationStatusTable } from '../../utils/migrations'
|
|
17
17
|
import { maskToken } from '../../utils/token'
|
|
18
18
|
|
|
19
19
|
type Args = {
|
|
@@ -26,32 +26,31 @@ type Options = ExecuteMigrationOptions & {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export class DeployCommand extends Command<Args, Options> {
|
|
29
|
+
constructor(
|
|
30
|
+
private readonly workspace: Workspace,
|
|
31
|
+
) {
|
|
32
|
+
super()
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
30
36
|
configuration.description('Deploy Contember project')
|
|
31
37
|
configuration.argument('dsn')
|
|
32
|
-
|
|
38
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
39
|
+
configuration.argument('project').optional()
|
|
40
|
+
}
|
|
33
41
|
configuration.option('admin').valueRequired()
|
|
34
42
|
configureExecuteMigrationCommand(configuration)
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
protected async execute(input: Input<Args, Options>): Promise<void | number> {
|
|
38
46
|
const [dsn, projectName] = this.getNormalizedInput(input)
|
|
39
|
-
const
|
|
40
|
-
let project: Project
|
|
47
|
+
const project = await this.workspace.projects.getProject(projectName, { fuzzy: true })
|
|
41
48
|
|
|
42
49
|
let apiUrl = input.getOption('instance')
|
|
43
50
|
let adminEndpoint = input.getOption('admin')
|
|
44
51
|
|
|
45
52
|
let apiTokenFromDsn: string | undefined = undefined
|
|
46
|
-
|
|
47
|
-
project = await workspace.projects.getProject(projectName, { fuzzy: true })
|
|
48
|
-
} else {
|
|
49
|
-
const projects = await workspace.projects.listProjects()
|
|
50
|
-
if (projects.length !== 1) {
|
|
51
|
-
throw 'Please specify a local name project'
|
|
52
|
-
}
|
|
53
|
-
project = projects[0]
|
|
54
|
-
}
|
|
53
|
+
|
|
55
54
|
let remoteProject = input.getOption('remote-project') || project.name
|
|
56
55
|
if (dsn) {
|
|
57
56
|
const uri = new URL(dsn)
|
|
@@ -62,8 +61,8 @@ export class DeployCommand extends Command<Args, Options> {
|
|
|
62
61
|
apiTokenFromDsn = uri.password
|
|
63
62
|
adminEndpoint = (uri.protocol === 'contember-unsecure:' ? 'http://' : 'https://') + uri.host
|
|
64
63
|
}
|
|
65
|
-
const instance = await interactiveResolveInstanceEnvironmentFromInput(workspace, apiUrl ?? (adminEndpoint ? adminEndpoint + '/_api' : undefined))
|
|
66
|
-
const apiToken = await interactiveResolveApiToken({ workspace, instance, apiToken: apiTokenFromDsn })
|
|
64
|
+
const instance = await interactiveResolveInstanceEnvironmentFromInput(this.workspace, apiUrl ?? (adminEndpoint ? adminEndpoint + '/_api' : undefined))
|
|
65
|
+
const apiToken = await interactiveResolveApiToken({ workspace: this.workspace, instance, apiToken: apiTokenFromDsn })
|
|
67
66
|
console.log('')
|
|
68
67
|
console.log('Contember project deployment configuration:')
|
|
69
68
|
console.log(`Local project name: ${project.name}`)
|
|
@@ -86,6 +85,12 @@ export class DeployCommand extends Command<Args, Options> {
|
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
const status = await resolveMigrationStatus(systemClient, container.migrationsResolver, false)
|
|
88
|
+
|
|
89
|
+
if (status.errorMigrations.length > 0) {
|
|
90
|
+
console.error(createMigrationStatusTable(status.errorMigrations))
|
|
91
|
+
throw `Cannot execute migrations`
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
if (status.migrationsToExecute.length === 0 && !adminEndpoint) {
|
|
90
95
|
console.log('Nothing to do.')
|
|
91
96
|
return 0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common'
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common'
|
|
2
2
|
import { printValidationErrors } from '../../utils/schema'
|
|
3
3
|
import { InvalidSchemaException } from '@contember/schema-migrations'
|
|
4
4
|
import { executeCreateMigrationCommand } from './MigrationCreateHelper'
|
|
@@ -16,7 +16,7 @@ import { validateMigrations } from './MigrationValidationHelper'
|
|
|
16
16
|
import { loadSchema } from '../../utils/project/loadSchema'
|
|
17
17
|
|
|
18
18
|
type Args = {
|
|
19
|
-
project
|
|
19
|
+
project?: string
|
|
20
20
|
migration?: string
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -26,9 +26,17 @@ type Options = {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export class MigrationAmendCommand extends Command<Args, Options> {
|
|
29
|
+
constructor(
|
|
30
|
+
private readonly workspace: Workspace,
|
|
31
|
+
) {
|
|
32
|
+
super()
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
30
36
|
configuration.description('Amends latest migration')
|
|
31
|
-
|
|
37
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
38
|
+
configuration.argument('project')
|
|
39
|
+
}
|
|
32
40
|
configuration.argument('migration').optional()
|
|
33
41
|
configuration.option('force').description('Ignore migrations order and missing migrations (dev only)')
|
|
34
42
|
configuration //
|
|
@@ -40,6 +48,7 @@ export class MigrationAmendCommand extends Command<Args, Options> {
|
|
|
40
48
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
41
49
|
return await executeCreateMigrationCommand(
|
|
42
50
|
input,
|
|
51
|
+
{ workspace: this.workspace },
|
|
43
52
|
async ({
|
|
44
53
|
schemaVersionBuilder,
|
|
45
54
|
migrationsResolver,
|
|
@@ -11,19 +11,15 @@ import {
|
|
|
11
11
|
import { Workspace, Project } from '@contember/cli-common'
|
|
12
12
|
|
|
13
13
|
type Args = {
|
|
14
|
-
project
|
|
14
|
+
project?: string
|
|
15
15
|
migrationName: string
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
type Options = {}
|
|
19
19
|
|
|
20
|
-
export const configureCreateMigrationCommand = (configuration: CommandConfiguration<Args, Options>) => {
|
|
21
|
-
configuration.argument('project')
|
|
22
|
-
configuration.argument('migrationName')
|
|
23
|
-
}
|
|
24
|
-
|
|
25
20
|
export const executeCreateMigrationCommand = async (
|
|
26
21
|
input: Input<Pick<Args, 'project'>, Options>,
|
|
22
|
+
{ workspace }: {workspace: Workspace},
|
|
27
23
|
createMigrationCallback: (args: {
|
|
28
24
|
workspace: Workspace
|
|
29
25
|
project: Project
|
|
@@ -36,7 +32,6 @@ export const executeCreateMigrationCommand = async (
|
|
|
36
32
|
}) => Promise<number>,
|
|
37
33
|
) => {
|
|
38
34
|
const projectName = input.getArgument('project')
|
|
39
|
-
const workspace = await Workspace.get(process.cwd())
|
|
40
35
|
const allProjects = projectName === '.'
|
|
41
36
|
const projects = allProjects
|
|
42
37
|
? await workspace.projects.listProjects()
|
|
@@ -7,7 +7,7 @@ import { Schema } from '@contember/schema'
|
|
|
7
7
|
import { Workspace } from '@contember/cli-common'
|
|
8
8
|
|
|
9
9
|
type Args = {
|
|
10
|
-
project
|
|
10
|
+
project?: string
|
|
11
11
|
migration?: string
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -48,9 +48,17 @@ let printMigrationDescription = async function (
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export class MigrationDescribeCommand extends Command<Args, Options> {
|
|
51
|
+
constructor(
|
|
52
|
+
private readonly workspace: Workspace,
|
|
53
|
+
) {
|
|
54
|
+
super()
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
52
58
|
configuration.description('Describes a migration')
|
|
53
|
-
|
|
59
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
60
|
+
configuration.argument('project')
|
|
61
|
+
}
|
|
54
62
|
configuration.argument('migration').optional()
|
|
55
63
|
configuration.option('sql-only').valueNone()
|
|
56
64
|
configuration.option('no-sql').valueNone()
|
|
@@ -59,7 +67,7 @@ export class MigrationDescribeCommand extends Command<Args, Options> {
|
|
|
59
67
|
protected async execute(input: Input<Args, Options>): Promise<void> {
|
|
60
68
|
const projectName = input.getArgument('project')
|
|
61
69
|
|
|
62
|
-
const workspace =
|
|
70
|
+
const workspace = this.workspace
|
|
63
71
|
const project = await workspace.projects.getProject(projectName, { fuzzy: true })
|
|
64
72
|
const migrationsDir = await project.migrationsDir
|
|
65
73
|
const container = new MigrationsContainerFactory(migrationsDir).create()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common'
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common'
|
|
2
2
|
import { printValidationErrors } from '../../utils/schema'
|
|
3
3
|
import { InvalidSchemaException } from '@contember/schema-migrations'
|
|
4
|
-
import {
|
|
4
|
+
import { executeCreateMigrationCommand } from './MigrationCreateHelper'
|
|
5
5
|
import { createMigrationStatusTable, printMigrationDescription } from '../../utils/migrations'
|
|
6
6
|
import { executeMigrations, resolveMigrationStatus } from './MigrationExecuteHelper'
|
|
7
7
|
import prompts from 'prompts'
|
|
@@ -11,7 +11,7 @@ import { SystemClient } from '../../utils/system'
|
|
|
11
11
|
import { loadSchema } from '../../utils/project/loadSchema'
|
|
12
12
|
|
|
13
13
|
type Args = {
|
|
14
|
-
project
|
|
14
|
+
project?: string
|
|
15
15
|
migrationName: string
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -21,9 +21,18 @@ type Options = {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export class MigrationDiffCommand extends Command<Args, Options> {
|
|
24
|
+
constructor(
|
|
25
|
+
private readonly workspace: Workspace,
|
|
26
|
+
) {
|
|
27
|
+
super()
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
25
31
|
configuration.description('Creates schema migration diff for given project')
|
|
26
|
-
|
|
32
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
33
|
+
configuration.argument('project')
|
|
34
|
+
}
|
|
35
|
+
configuration.argument('migrationName')
|
|
27
36
|
configuration.option('execute').valueNone()
|
|
28
37
|
configuration //
|
|
29
38
|
.option('yes')
|
|
@@ -34,6 +43,7 @@ export class MigrationDiffCommand extends Command<Args, Options> {
|
|
|
34
43
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
35
44
|
return await executeCreateMigrationCommand(
|
|
36
45
|
input,
|
|
46
|
+
{ workspace: this.workspace },
|
|
37
47
|
async ({
|
|
38
48
|
schemaVersionBuilder,
|
|
39
49
|
migrationsResolver,
|
|
@@ -13,7 +13,7 @@ import { interactiveResolveApiToken, TenantClient } from '../../utils/tenant'
|
|
|
13
13
|
import { SystemClient } from '../../utils/system'
|
|
14
14
|
|
|
15
15
|
type Args = {
|
|
16
|
-
project
|
|
16
|
+
project?: string
|
|
17
17
|
migration?: string
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -22,9 +22,17 @@ type Options = ExecuteMigrationOptions & {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export class MigrationExecuteCommand extends Command<Args, Options> {
|
|
25
|
+
constructor(
|
|
26
|
+
private readonly workspace: Workspace,
|
|
27
|
+
) {
|
|
28
|
+
super()
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
26
32
|
configuration.description('Executes migrations on an instance')
|
|
27
|
-
|
|
33
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
34
|
+
configuration.argument('project')
|
|
35
|
+
}
|
|
28
36
|
configuration.argument('migration').optional()
|
|
29
37
|
configuration.option('force').description('Ignore migrations order and missing migrations (dev only)')
|
|
30
38
|
configureExecuteMigrationCommand(configuration)
|
|
@@ -33,12 +41,9 @@ export class MigrationExecuteCommand extends Command<Args, Options> {
|
|
|
33
41
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
34
42
|
const projectName = input.getArgument('project')
|
|
35
43
|
|
|
36
|
-
const workspace =
|
|
44
|
+
const workspace = this.workspace
|
|
37
45
|
|
|
38
46
|
const allProjects = projectName === '.'
|
|
39
|
-
if (!allProjects) {
|
|
40
|
-
validateProjectName(projectName)
|
|
41
|
-
}
|
|
42
47
|
const remoteProjectOption = input?.getOption('remote-project')
|
|
43
48
|
if (remoteProjectOption && allProjects) {
|
|
44
49
|
throw 'Option remote-project can be used only for a single project'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input } from '@contember/cli-common'
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common'
|
|
2
2
|
import { MigrationVersionHelper } from '@contember/schema-migrations'
|
|
3
3
|
import { executeCreateMigrationCommand } from './MigrationCreateHelper'
|
|
4
4
|
import { getMigrationByName } from '../../utils/migrations'
|
|
@@ -7,7 +7,7 @@ import { emptySchema } from '@contember/schema-utils'
|
|
|
7
7
|
import { validateMigrations } from './MigrationValidationHelper'
|
|
8
8
|
|
|
9
9
|
type Args = {
|
|
10
|
-
project
|
|
10
|
+
project?: string
|
|
11
11
|
migration: string[]
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -16,9 +16,18 @@ type Options = {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export class MigrationRebaseCommand extends Command<Args, Options> {
|
|
19
|
+
constructor(
|
|
20
|
+
private readonly workspace: Workspace,
|
|
21
|
+
) {
|
|
22
|
+
super()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
19
26
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
20
27
|
configuration.description('Rebase migrations on filesystem and in local instance')
|
|
21
|
-
|
|
28
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
29
|
+
configuration.argument('project')
|
|
30
|
+
}
|
|
22
31
|
configuration.argument('migration').variadic()
|
|
23
32
|
configuration //
|
|
24
33
|
.option('yes')
|
|
@@ -29,6 +38,7 @@ export class MigrationRebaseCommand extends Command<Args, Options> {
|
|
|
29
38
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
30
39
|
return await executeCreateMigrationCommand(
|
|
31
40
|
input,
|
|
41
|
+
{ workspace: this.workspace },
|
|
32
42
|
async ({
|
|
33
43
|
schemaVersionBuilder,
|
|
34
44
|
migrationsResolver,
|
|
@@ -8,7 +8,7 @@ import chalk from 'chalk'
|
|
|
8
8
|
import { Workspace } from '@contember/cli-common'
|
|
9
9
|
|
|
10
10
|
type Args = {
|
|
11
|
-
project
|
|
11
|
+
project?: string
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
type Options = {
|
|
@@ -20,9 +20,17 @@ type Options = {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export class MigrationStatusCommand extends Command<Args, Options> {
|
|
23
|
+
constructor(
|
|
24
|
+
private readonly workspace: Workspace,
|
|
25
|
+
) {
|
|
26
|
+
super()
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
24
30
|
configuration.description('Shows status of executed migrations on an instance & sync status')
|
|
25
|
-
|
|
31
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
32
|
+
configuration.argument('project')
|
|
33
|
+
}
|
|
26
34
|
configuration //
|
|
27
35
|
.option('instance')
|
|
28
36
|
.valueRequired()
|
|
@@ -48,7 +56,7 @@ export class MigrationStatusCommand extends Command<Args, Options> {
|
|
|
48
56
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
49
57
|
const projectName = input.getArgument('project')
|
|
50
58
|
|
|
51
|
-
const workspace =
|
|
59
|
+
const workspace = this.workspace
|
|
52
60
|
const project = await workspace.projects.getProject(projectName, { fuzzy: true })
|
|
53
61
|
const migrationsDir = await project.migrationsDir
|
|
54
62
|
const container = new MigrationsContainerFactory(migrationsDir).create()
|
|
@@ -10,6 +10,12 @@ type Options = {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export class ProjectCreateCommand extends Command<Args, Options> {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly workspace: Workspace,
|
|
15
|
+
) {
|
|
16
|
+
super()
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
14
20
|
configuration.description('Creates a new Contember project')
|
|
15
21
|
configuration.argument('project')
|
|
@@ -19,7 +25,7 @@ export class ProjectCreateCommand extends Command<Args, Options> {
|
|
|
19
25
|
protected async execute(input: Input<Args, Options>): Promise<void> {
|
|
20
26
|
const [projectName] = [input.getArgument('project')]
|
|
21
27
|
validateProjectName(projectName)
|
|
22
|
-
const workspace =
|
|
28
|
+
const workspace = this.workspace
|
|
23
29
|
|
|
24
30
|
const template = input.getOption('template')
|
|
25
31
|
await workspace.projects.createProject(projectName, { template })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input,
|
|
1
|
+
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common'
|
|
2
2
|
import { validateSchemaAndPrintErrors } from '../../utils/schema'
|
|
3
3
|
import { loadSchema } from '../../utils/project/loadSchema'
|
|
4
4
|
import { renderProjectInfoHtml } from '../../utils/project/projectDescribe'
|
|
@@ -6,7 +6,7 @@ import { writeFile } from 'fs/promises'
|
|
|
6
6
|
import { join } from 'path'
|
|
7
7
|
|
|
8
8
|
type Args = {
|
|
9
|
-
project
|
|
9
|
+
project?: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
type Options = {
|
|
@@ -14,18 +14,23 @@ type Options = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export class ProjectGenerateDocumentation extends Command<Args, Options> {
|
|
17
|
+
constructor(
|
|
18
|
+
private readonly workspace: Workspace,
|
|
19
|
+
) {
|
|
20
|
+
super()
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
18
24
|
configuration.description('Generates HTML documentation from project schema')
|
|
19
|
-
|
|
25
|
+
if (!this.workspace.isSingleProjectMode()) {
|
|
26
|
+
configuration.argument('project')
|
|
27
|
+
}
|
|
20
28
|
configuration.option('output').valueRequired().description('file name or "stdout"')
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
24
32
|
const projectName = input.getArgument('project')
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
validateProjectName(projectName)
|
|
28
|
-
const project = await workspace.projects.getProject(projectName, { fuzzy: true })
|
|
33
|
+
const project = await this.workspace.projects.getProject(projectName, { fuzzy: true })
|
|
29
34
|
const schema = await loadSchema(project)
|
|
30
35
|
if (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {
|
|
31
36
|
return 1
|