@contember/cli 1.3.0-rc.1 → 1.3.0-rc.3
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/dist/src/commands/deploy/DeployCommand.d.ts +3 -0
- package/dist/src/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/src/commands/deploy/DeployCommand.js +49 -42
- package/dist/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/src/commands/transfer/ExportCommand.js +1 -1
- package/dist/src/commands/transfer/ImportCommand.js +1 -1
- package/dist/src/commands/transfer/TransferCommand.js +1 -1
- package/dist/src/run.js +7 -4
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/admin.d.ts +1 -1
- package/dist/src/utils/admin.d.ts.map +1 -1
- package/dist/src/utils/admin.js.map +1 -1
- package/dist/src/utils/checkVersions.js +1 -1
- package/dist/src/utils/checkVersions.js.map +1 -1
- package/dist/src/utils/project/loadSchema.d.ts.map +1 -1
- package/dist/src/utils/project/loadSchema.js +1 -0
- package/dist/src/utils/project/loadSchema.js.map +1 -1
- package/dist/src/utils/stdio.d.ts +1 -1
- package/dist/src/utils/stdio.d.ts.map +1 -1
- package/dist/src/utils/stdio.js +6 -3
- package/dist/src/utils/stdio.js.map +1 -1
- package/package.json +8 -8
- package/src/commands/deploy/DeployCommand.ts +69 -47
- package/src/commands/transfer/ExportCommand.ts +2 -2
- package/src/commands/transfer/ImportCommand.ts +2 -2
- package/src/commands/transfer/TransferCommand.ts +2 -2
- package/src/run.ts +11 -5
- package/src/utils/admin.ts +1 -1
- package/src/utils/checkVersions.ts +1 -1
- package/src/utils/project/loadSchema.ts +1 -0
- package/src/utils/stdio.ts +4 -1
|
@@ -3,7 +3,7 @@ export declare class AdminClient {
|
|
|
3
3
|
private readonly apiToken;
|
|
4
4
|
constructor(url: string, apiToken: string);
|
|
5
5
|
static create(url: string, apiToken: string): AdminClient;
|
|
6
|
-
deploy(project: string, files: AdminFiles): Promise<void>;
|
|
6
|
+
deploy(project: string | null, files: AdminFiles): Promise<void>;
|
|
7
7
|
private execute;
|
|
8
8
|
}
|
|
9
9
|
export type AdminFiles = Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/utils/admin.ts"],"names":[],"mappings":"AAIA,qBAAa,WAAW;IACX,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAU,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAtC,GAAG,EAAE,MAAM,EAAmB,QAAQ,EAAE,MAAM;WAE7D,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW;IAInD,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/utils/admin.ts"],"names":[],"mappings":"AAIA,qBAAa,WAAW;IACX,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAU,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAtC,GAAG,EAAE,MAAM,EAAmB,QAAQ,EAAE,MAAM;WAE7D,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW;IAInD,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;YAS/D,OAAO;CAOrB;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAC9D,eAAO,MAAM,cAAc,QAAe,MAAM,WAAU,MAAM,KAAQ,QAAQ,UAAU,CAezF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceR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41,7 @@ const checkVersions = async (workspace) => {
|
|
|
41
41
|
errors.push(`Package ${packageName} defined in ${jsonPath} is not installed.`);
|
|
42
42
|
continue;
|
|
43
43
|
}
|
|
44
|
-
if (!semver.satisfies(pckg.installed.version, pckg.defined.version)) {
|
|
44
|
+
if (pckg.defined.version !== 'workspace:*' && !semver.satisfies(pckg.installed.version, pckg.defined.version)) {
|
|
45
45
|
errors.push(`Package ${packageName}@${pckg.installed.version} does not match constraint ${pckg.defined.version} defined in ${jsonPath}.`);
|
|
46
46
|
continue;
|
|
47
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkVersions.js","sourceRoot":"","sources":["../../../src/utils/checkVersions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAoE;AACpE,yCAA0C;AAC1C,+CAAgC;AAChC,mDAAuF;AAEhF,MAAM,aAAa,GAAG,KAAK,EAAE,SAAoB,EAAE,EAAE;;IAC3D,MAAM,UAAU,GAAG,IAAA,8BAAiB,GAAE,CAAA;IACtC,MAAM,gBAAgB,GAAG,MAAM,SAAS,CAAC,uBAAuB,EAAE,CAAA;IAClE,MAAM,MAAM,GAAa,EAAE,CAAA;IAE3B,KAAK,MAAM,WAAW,IAAI,CAAC,mBAAmB,EAAE,8BAA8B,CAAC,EAAE;QAChF,MAAM,iBAAiB,GAAG,MAAM,gBAAgB,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAA;QACvF,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE;YACrC,MAAM,QAAQ,GAAG,IAAA,oBAAQ,EAAC,SAAS,CAAC,SAAS,EAAE,IAAA,gBAAI,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAA;YAE3F,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACpB,MAAM,CAAC,IAAI,CAAC,WAAW,WAAW,eAAe,QAAQ,oBAAoB,CAAC,CAAA;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,CAAC,KAAK,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACzD,MAAM,CAAC,IAAI,CAAC,kBAAkB,IAAI,eAAe,KAAK,IAAI,OAAO,kCAAkC,UAAU,GAAG,CAAC,CAAA;aACjH;SACD;KACD;IAED,IAAI,MAAM,CAAC,MAAM,EAAE;QAClB,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;yNAE0K,CAAA;KACvN;AACF,CAAC,CAAA;AApDY,QAAA,aAAa,iBAoDzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/project/loadSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM1C,eAAO,MAAM,UAAU,YAAmB,OAAO,KAAG,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"loadSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/project/loadSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM1C,eAAO,MAAM,UAAU,YAAmB,OAAO,KAAG,QAAQ,MAAM,CAoBjE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadSchema.js","sourceRoot":"","sources":["../../../../src/utils/project/loadSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,iDAAkC;AAClC,yCAAgC;AAChC,6BAA4B;AAC5B,0DAAoD;AAE7C,MAAM,UAAU,GAAG,KAAK,EAAE,OAAgB,EAAmB,EAAE;IACrE,MAAM,QAAQ,GAAG,MAAM,OAAO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AM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;QAC1B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,OAAO,EAAE,mBAAmB,CAAC;KAC5D,CAAC,CAAA;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC9C,MAAM,EAAE,GAAG,IAAI,YAAM,CAAC;QACrB,OAAO,EAAE;YACR,OAAO,EAAE,CAAC,GAAG,CAAC;SACd;KACD,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,CAAA;IAC9C,gDAAgD;IAChD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;IACtD,OAAO,IAAA,yBAAU,EAAC,WAAW,CAAC,CAAA;AAC/B,CAAC,CAAA;AApBY,QAAA,UAAU,cAoBtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const printProgressLine: (message: string) => void;
|
|
2
2
|
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/utils/stdio.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,YAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/utils/stdio.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,YAAa,MAAM,SAOhD,CAAA"}
|
package/dist/src/utils/stdio.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.printProgressLine = void 0;
|
|
4
|
+
const printProgressLine = (message) => {
|
|
5
|
+
if (!process.stdout.clearLine) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
5
8
|
process.stdout.clearLine(0);
|
|
6
9
|
process.stdout.cursorTo(0);
|
|
7
10
|
process.stdout.write(message);
|
|
8
11
|
};
|
|
9
|
-
exports.
|
|
12
|
+
exports.printProgressLine = printProgressLine;
|
|
10
13
|
//# sourceMappingURL=stdio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/utils/stdio.ts"],"names":[],"mappings":";;;AAAO,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,EAAE;IACpD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAC9B,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/utils/stdio.ts"],"names":[],"mappings":";;;AAAO,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,EAAE;IACpD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE;QAC9B,OAAM;KACN;IACD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAC9B,CAAC,CAAA;AAPY,QAAA,iBAAiB,qBAO7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/cli",
|
|
3
|
-
"version": "1.3.0-rc.
|
|
3
|
+
"version": "1.3.0-rc.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contember": "./dist/src/run.js"
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"tailwindcss": "^3.0.24"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@contember/cli-common": "1.3.0-rc.
|
|
24
|
-
"@contember/config-loader": "1.3.0-rc.
|
|
25
|
-
"@contember/dic": "1.3.0-rc.
|
|
26
|
-
"@contember/engine-content-api": "1.3.0-rc.
|
|
27
|
-
"@contember/schema": "1.3.0-rc.
|
|
28
|
-
"@contember/schema-migrations": "1.3.0-rc.
|
|
29
|
-
"@contember/schema-utils": "1.3.0-rc.
|
|
23
|
+
"@contember/cli-common": "1.3.0-rc.3",
|
|
24
|
+
"@contember/config-loader": "1.3.0-rc.3",
|
|
25
|
+
"@contember/dic": "1.3.0-rc.3",
|
|
26
|
+
"@contember/engine-content-api": "1.3.0-rc.3",
|
|
27
|
+
"@contember/schema": "1.3.0-rc.3",
|
|
28
|
+
"@contember/schema-migrations": "1.3.0-rc.3",
|
|
29
|
+
"@contember/schema-utils": "1.3.0-rc.3",
|
|
30
30
|
"@graphql-tools/schema": "^8.3.5",
|
|
31
31
|
"chalk": "^4.1.2",
|
|
32
32
|
"chalk-table": "^1.0.2",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input, pathExists,
|
|
1
|
+
import { Command, CommandConfiguration, Input, pathExists, Workspace } from '@contember/cli-common'
|
|
2
2
|
import {
|
|
3
3
|
configureExecuteMigrationCommand,
|
|
4
4
|
ExecuteMigrationOptions,
|
|
@@ -10,7 +10,6 @@ import { interactiveResolveInstanceEnvironmentFromInput } from '../../utils/inst
|
|
|
10
10
|
import { SystemClient } from '../../utils/system'
|
|
11
11
|
import { MigrationsContainerFactory } from '../../MigrationsContainer'
|
|
12
12
|
import { AdminClient, readAdminFiles } from '../../utils/admin'
|
|
13
|
-
import { URL } from 'node:url'
|
|
14
13
|
import prompts from 'prompts'
|
|
15
14
|
import { createMigrationStatusTable } from '../../utils/migrations'
|
|
16
15
|
import { maskToken } from '../../utils/token'
|
|
@@ -23,6 +22,9 @@ type Args = {
|
|
|
23
22
|
|
|
24
23
|
type Options = ExecuteMigrationOptions & {
|
|
25
24
|
admin?: string
|
|
25
|
+
['no-admin']?: boolean
|
|
26
|
+
['no-migrations']?: boolean
|
|
27
|
+
root?: boolean
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export class DeployCommand extends Command<Args, Options> {
|
|
@@ -35,10 +37,16 @@ export class DeployCommand extends Command<Args, Options> {
|
|
|
35
37
|
protected configure(configuration: CommandConfiguration<Args, Options>): void {
|
|
36
38
|
configuration.description('Deploy Contember project')
|
|
37
39
|
configuration.argument('dsn')
|
|
40
|
+
|
|
38
41
|
if (!this.workspace.isSingleProjectMode()) {
|
|
39
42
|
configuration.argument('project').optional()
|
|
40
43
|
}
|
|
44
|
+
|
|
41
45
|
configuration.option('admin').valueRequired()
|
|
46
|
+
configuration.option('root').valueNone()
|
|
47
|
+
configuration.option('no-admin').valueNone()
|
|
48
|
+
configuration.option('no-migrations').valueNone()
|
|
49
|
+
|
|
42
50
|
configureExecuteMigrationCommand(configuration)
|
|
43
51
|
}
|
|
44
52
|
|
|
@@ -52,11 +60,14 @@ export class DeployCommand extends Command<Args, Options> {
|
|
|
52
60
|
let apiTokenFromDsn: string | undefined = undefined
|
|
53
61
|
|
|
54
62
|
let remoteProject = input.getOption('remote-project') || project.name
|
|
63
|
+
|
|
55
64
|
if (dsn) {
|
|
56
65
|
({ project: remoteProject, endpoint: adminEndpoint, token: apiTokenFromDsn } = parseDsn(dsn))
|
|
57
66
|
}
|
|
67
|
+
|
|
58
68
|
const instance = await interactiveResolveInstanceEnvironmentFromInput(this.workspace, apiUrl ?? (adminEndpoint ? adminEndpoint + '/_api' : undefined))
|
|
59
69
|
const apiToken = await interactiveResolveApiToken({ workspace: this.workspace, instance, apiToken: apiTokenFromDsn })
|
|
70
|
+
|
|
60
71
|
console.log('')
|
|
61
72
|
console.log('Contember project deployment configuration:')
|
|
62
73
|
console.log(`Local project name: ${project.name}`)
|
|
@@ -66,67 +77,78 @@ export class DeployCommand extends Command<Args, Options> {
|
|
|
66
77
|
console.log(`Deploy token: ${maskToken(apiToken)}`)
|
|
67
78
|
console.log('')
|
|
68
79
|
|
|
69
|
-
const migrationsDir = project.migrationsDir
|
|
70
|
-
const container = new MigrationsContainerFactory(migrationsDir).create()
|
|
71
|
-
|
|
72
|
-
const tenantClient = TenantClient.create(instance.baseUrl, apiToken)
|
|
73
|
-
await tenantClient.createProject(remoteProject, true)
|
|
74
|
-
const systemClient = SystemClient.create(instance.baseUrl, remoteProject, apiToken)
|
|
75
|
-
|
|
76
80
|
const projectAdminDistDir = `${project.adminDir}/dist`
|
|
77
|
-
|
|
81
|
+
|
|
82
|
+
if (adminEndpoint && input.getOption('no-admin') !== true && !(await pathExists(`${projectAdminDistDir}/index.html`))) {
|
|
78
83
|
throw `Missing ${projectAdminDistDir}/index.html. Please build admin before deploying.`
|
|
79
84
|
}
|
|
80
85
|
|
|
81
|
-
|
|
86
|
+
if (input.getOption('no-migrations') !== true) {
|
|
87
|
+
const migrationsDir = project.migrationsDir
|
|
88
|
+
const container = new MigrationsContainerFactory(migrationsDir).create()
|
|
82
89
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
90
|
+
const tenantClient = TenantClient.create(instance.baseUrl, apiToken)
|
|
91
|
+
await tenantClient.createProject(remoteProject, true)
|
|
92
|
+
const systemClient = SystemClient.create(instance.baseUrl, remoteProject, apiToken)
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
const status = await resolveMigrationStatus(systemClient, container.migrationsResolver, false)
|
|
95
|
+
|
|
96
|
+
if (status.errorMigrations.length > 0) {
|
|
97
|
+
console.error(createMigrationStatusTable(status.errorMigrations))
|
|
98
|
+
throw `Cannot execute migrations`
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (status.migrationsToExecute.length === 0 && !adminEndpoint) {
|
|
102
|
+
console.log('Nothing to do.')
|
|
103
|
+
return 0
|
|
95
104
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
if (!input.getOption('yes')) {
|
|
106
|
+
if (!process.stdin.isTTY) {
|
|
107
|
+
throw 'TTY not available. Pass --yes option to confirm execution.'
|
|
108
|
+
}
|
|
109
|
+
console.log('Following migrations will be executed:')
|
|
110
|
+
console.log(status.migrationsToExecute.length ? status.migrationsToExecute.map(it => it.name).join(' ') : 'none')
|
|
111
|
+
console.log(adminEndpoint ? 'Admin will be deployed.' : 'Admin will NOT be deployed.')
|
|
112
|
+
console.log('(to skip this dialog, you can pass --yes option)')
|
|
113
|
+
console.log('')
|
|
114
|
+
const { ok } = await prompts({
|
|
115
|
+
type: 'confirm',
|
|
116
|
+
name: 'ok',
|
|
117
|
+
message: `Do you want to continue?`,
|
|
118
|
+
})
|
|
119
|
+
if (!ok) {
|
|
120
|
+
return 1
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const migrationExitCode = await executeMigrations({
|
|
124
|
+
migrationDescriber: container.migrationDescriber,
|
|
125
|
+
schemaVersionBuilder: container.schemaVersionBuilder,
|
|
126
|
+
client: systemClient,
|
|
127
|
+
migrations: status.migrationsToExecute,
|
|
128
|
+
requireConfirmation: false,
|
|
129
|
+
force: false,
|
|
105
130
|
})
|
|
106
|
-
|
|
107
|
-
|
|
131
|
+
|
|
132
|
+
if (migrationExitCode !== 0) {
|
|
133
|
+
return migrationExitCode
|
|
108
134
|
}
|
|
109
135
|
}
|
|
110
|
-
const migrationExitCode = await executeMigrations({
|
|
111
|
-
migrationDescriber: container.migrationDescriber,
|
|
112
|
-
schemaVersionBuilder: container.schemaVersionBuilder,
|
|
113
|
-
client: systemClient,
|
|
114
|
-
migrations: status.migrationsToExecute,
|
|
115
|
-
requireConfirmation: false,
|
|
116
|
-
force: false,
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
if (migrationExitCode !== 0) {
|
|
120
|
-
return migrationExitCode
|
|
121
|
-
}
|
|
122
136
|
|
|
123
|
-
if (adminEndpoint) {
|
|
137
|
+
if (adminEndpoint && input.getOption('no-admin') !== true) {
|
|
124
138
|
console.log('Deploying admin...')
|
|
139
|
+
|
|
125
140
|
const client = AdminClient.create(adminEndpoint, apiToken)
|
|
126
141
|
const files = await readAdminFiles(projectAdminDistDir)
|
|
127
|
-
|
|
142
|
+
|
|
143
|
+
// in some cases you need deploy whole folder with custom build etc.
|
|
144
|
+
// with root option you can build app on your own and simply deploy it with subprojects
|
|
145
|
+
await client.deploy(
|
|
146
|
+
input.getOption('root') ? null : remoteProject, files,
|
|
147
|
+
)
|
|
148
|
+
|
|
128
149
|
console.log(`Admin deployed (${files.length} files)`)
|
|
129
150
|
}
|
|
151
|
+
|
|
130
152
|
console.log('')
|
|
131
153
|
console.log('Deployment successful')
|
|
132
154
|
console.log(`API URL: ${instance.baseUrl}`)
|
|
@@ -3,7 +3,7 @@ import { createWriteStream } from 'node:fs'
|
|
|
3
3
|
import { dataExport, resolveProject } from './utils'
|
|
4
4
|
import { maskToken } from '../../utils/token'
|
|
5
5
|
import { pipeline } from 'node:stream/promises'
|
|
6
|
-
import {
|
|
6
|
+
import { printProgressLine } from '../../utils/stdio'
|
|
7
7
|
|
|
8
8
|
type Args = {
|
|
9
9
|
source?: string
|
|
@@ -57,7 +57,7 @@ export class ExportCommand extends Command<Args, Options> {
|
|
|
57
57
|
const currentMb = Math.floor(transferred / 1024 / 1024)
|
|
58
58
|
if (currentMb > lastMbReported) {
|
|
59
59
|
const durationS = Math.floor((Date.now() - start) / 1000)
|
|
60
|
-
|
|
60
|
+
printProgressLine(`transferred ${currentMb} MiB; ${durationS} seconds`)
|
|
61
61
|
lastMbReported = currentMb
|
|
62
62
|
}
|
|
63
63
|
})
|
|
@@ -3,7 +3,7 @@ import { createReadStream } from 'node:fs'
|
|
|
3
3
|
import { createGunzip } from 'node:zlib'
|
|
4
4
|
import { confirmImport, dataImport, resolveProject } from './utils'
|
|
5
5
|
import { maskToken } from '../../utils/token'
|
|
6
|
-
import {
|
|
6
|
+
import { printProgressLine } from '../../utils/stdio'
|
|
7
7
|
import { readStream } from '../../utils/stream'
|
|
8
8
|
|
|
9
9
|
type Args = {
|
|
@@ -47,7 +47,7 @@ export class ImportCommand extends Command<Args, Options> {
|
|
|
47
47
|
const file = input.getArgument('file')
|
|
48
48
|
const baseInputStream = createReadStream(file)
|
|
49
49
|
const stream = (file.endsWith('.gz') ? baseInputStream.pipe(createGunzip()) : baseInputStream)
|
|
50
|
-
const response = await dataImport({ stream: stream, project, printProgress:
|
|
50
|
+
const response = await dataImport({ stream: stream, project, printProgress: printProgressLine })
|
|
51
51
|
console.log('')
|
|
52
52
|
const responseData = JSON.parse((await readStream(response)).toString())
|
|
53
53
|
if (responseData.ok) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-common'
|
|
2
2
|
import { confirmImport, dataExport, dataImport, resolveProject } from './utils'
|
|
3
3
|
import { maskToken } from '../../utils/token'
|
|
4
|
-
import {
|
|
4
|
+
import { printProgressLine } from '../../utils/stdio'
|
|
5
5
|
import { readStream } from '../../utils/stream'
|
|
6
6
|
|
|
7
7
|
type Args = {
|
|
@@ -56,7 +56,7 @@ export class TransferCommand extends Command<Args, Options> {
|
|
|
56
56
|
const includeSystem = input.getOption('include-system') === true
|
|
57
57
|
const exportResponse = (await dataExport({ project: sourceProject, includeSystem, noGzip: true }))
|
|
58
58
|
const importResponse = await dataImport({
|
|
59
|
-
stream: exportResponse, project: targetProject, printProgress:
|
|
59
|
+
stream: exportResponse, project: targetProject, printProgress: printProgressLine,
|
|
60
60
|
})
|
|
61
61
|
console.log('')
|
|
62
62
|
|
package/src/run.ts
CHANGED
|
@@ -27,10 +27,6 @@ import { checkVersions } from './utils/checkVersions';
|
|
|
27
27
|
(async () => {
|
|
28
28
|
const workspace = await Workspace.get(process.cwd())
|
|
29
29
|
|
|
30
|
-
if (!process.env.CONTEMBER_SKIP_VERSION_CHECK) {
|
|
31
|
-
await checkVersions(workspace)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
30
|
const commands: CommandFactoryList = {
|
|
35
31
|
['deploy']: () => new DeployCommand(workspace),
|
|
36
32
|
['version']: () => new VersionCommand(),
|
|
@@ -62,7 +58,17 @@ import { checkVersions } from './utils/checkVersions';
|
|
|
62
58
|
throw `Node >= 12 is required`
|
|
63
59
|
}
|
|
64
60
|
const cliVersion = getPackageVersion()
|
|
65
|
-
const app = new Application(
|
|
61
|
+
const app = new Application(
|
|
62
|
+
commandManager,
|
|
63
|
+
`Contember CLI version ${cliVersion}`,
|
|
64
|
+
{
|
|
65
|
+
beforeRun: async ({ name }) => {
|
|
66
|
+
if (!process.env.CONTEMBER_SKIP_VERSION_CHECK && !['deploy', 'version', 'data:export', 'data:import', 'data:transfer'].includes(name)) {
|
|
67
|
+
await checkVersions(workspace)
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
)
|
|
66
72
|
await app.run(process.argv.slice(2))
|
|
67
73
|
})().catch(e => {
|
|
68
74
|
console.log(e)
|
package/src/utils/admin.ts
CHANGED
|
@@ -9,7 +9,7 @@ export class AdminClient {
|
|
|
9
9
|
return new AdminClient(url, apiToken)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
public async deploy(project: string, files: AdminFiles): Promise<void> {
|
|
12
|
+
public async deploy(project: string | null, files: AdminFiles): Promise<void> {
|
|
13
13
|
const response = await this.execute('_deploy', 'POST', { project, files })
|
|
14
14
|
|
|
15
15
|
if (!response.ok) {
|
|
@@ -17,7 +17,7 @@ export const checkVersions = async (workspace: Workspace) => {
|
|
|
17
17
|
errors.push(`Package ${packageName} defined in ${jsonPath} is not installed.`)
|
|
18
18
|
continue
|
|
19
19
|
}
|
|
20
|
-
if (!semver.satisfies(pckg.installed.version, pckg.defined.version)) {
|
|
20
|
+
if (pckg.defined.version !== 'workspace:*' && !semver.satisfies(pckg.installed.version, pckg.defined.version)) {
|
|
21
21
|
errors.push(`Package ${packageName}@${pckg.installed.version} does not match constraint ${pckg.defined.version} defined in ${jsonPath}.`)
|
|
22
22
|
continue
|
|
23
23
|
}
|
|
@@ -12,6 +12,7 @@ export const loadSchema = async (project: Project): Promise<Schema> => {
|
|
|
12
12
|
bundle: true,
|
|
13
13
|
treeShaking: true,
|
|
14
14
|
write: false,
|
|
15
|
+
loader: { '.sql': 'text' },
|
|
15
16
|
external: ['@contember/admin', 'react', 'react/jsx-runtime'],
|
|
16
17
|
})
|
|
17
18
|
const bundledJs = response.outputFiles[0].text
|
package/src/utils/stdio.ts
CHANGED