@contember/cli 1.2.0-alpha.9 → 1.2.0-beta.1
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 +2 -2
- package/dist/src/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/src/commands/deploy/DeployCommand.js +3 -10
- package/dist/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.js +1 -1
- package/dist/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.d.ts +1 -0
- package/dist/src/commands/migrations/MigrationDiffCommand.d.ts.map +1 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.js +4 -1
- package/dist/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/src/commands/migrations/MigrationValidationHelper.js +3 -3
- package/dist/src/commands/migrations/MigrationValidationHelper.js.map +1 -1
- package/dist/src/commands/project/ProjectGenerateDocumentation.js +3 -3
- package/dist/src/commands/project/ProjectGenerateDocumentation.js.map +1 -1
- package/dist/src/commands/transfer/ExportCommand.d.ts +17 -0
- package/dist/src/commands/transfer/ExportCommand.d.ts.map +1 -0
- package/dist/src/commands/transfer/ExportCommand.js +58 -0
- package/dist/src/commands/transfer/ExportCommand.js.map +1 -0
- package/dist/src/commands/transfer/ImportCommand.d.ts +16 -0
- package/dist/src/commands/transfer/ImportCommand.d.ts.map +1 -0
- package/dist/src/commands/transfer/ImportCommand.js +54 -0
- package/dist/src/commands/transfer/ImportCommand.js.map +1 -0
- package/dist/src/commands/transfer/TransferCommand.d.ts +17 -0
- package/dist/src/commands/transfer/TransferCommand.d.ts.map +1 -0
- package/dist/src/commands/transfer/TransferCommand.js +60 -0
- package/dist/src/commands/transfer/TransferCommand.js.map +1 -0
- package/dist/src/commands/transfer/index.d.ts +4 -0
- package/dist/src/commands/transfer/index.d.ts.map +1 -0
- package/dist/src/commands/transfer/index.js +20 -0
- package/dist/src/commands/transfer/index.js.map +1 -0
- package/dist/src/commands/transfer/utils.d.ts +26 -0
- package/dist/src/commands/transfer/utils.d.ts.map +1 -0
- package/dist/src/commands/transfer/utils.js +134 -0
- package/dist/src/commands/transfer/utils.js.map +1 -0
- package/dist/src/run.js +6 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/admin.js +1 -1
- package/dist/src/utils/admin.js.map +1 -1
- package/dist/src/utils/commands.d.ts +2 -2
- package/dist/src/utils/commands.d.ts.map +1 -1
- package/dist/src/utils/commands.js +2 -2
- package/dist/src/utils/commands.js.map +1 -1
- package/dist/src/utils/dockerCompose.js +5 -5
- package/dist/src/utils/dockerCompose.js.map +1 -1
- package/dist/src/utils/dsn.d.ts +6 -0
- package/dist/src/utils/dsn.d.ts.map +1 -0
- package/dist/src/utils/dsn.js +17 -0
- package/dist/src/utils/dsn.js.map +1 -0
- package/dist/src/utils/npm.js +8 -8
- package/dist/src/utils/npm.js.map +1 -1
- package/dist/src/utils/project/loadSchema.js +2 -2
- package/dist/src/utils/project/loadSchema.js.map +1 -1
- package/dist/src/utils/project/projectDescribe.js +1 -1
- package/dist/src/utils/project/projectDescribe.js.map +1 -1
- package/dist/src/utils/schema.d.ts +2 -2
- package/dist/src/utils/schema.d.ts.map +1 -1
- package/dist/src/utils/schema.js +3 -3
- package/dist/src/utils/schema.js.map +1 -1
- package/dist/src/utils/stdio.d.ts +2 -0
- package/dist/src/utils/stdio.d.ts.map +1 -0
- package/dist/src/utils/stdio.js +10 -0
- package/dist/src/utils/stdio.js.map +1 -0
- package/dist/src/utils/stream.d.ts +9 -0
- package/dist/src/utils/stream.d.ts.map +1 -0
- package/dist/src/utils/stream.js +41 -0
- package/dist/src/utils/stream.js.map +1 -0
- package/dist/src/utils/workspace.d.ts.map +1 -1
- package/dist/src/utils/workspace.js +1 -2
- package/dist/src/utils/workspace.js.map +1 -1
- package/dist/src/utils/yaml.d.ts +1 -1
- package/dist/src/utils/yaml.d.ts.map +1 -1
- package/dist/src/utils/yaml.js +3 -3
- package/dist/src/utils/yaml.js.map +1 -1
- package/package.json +10 -11
- package/src/commands/deploy/DeployCommand.ts +4 -10
- package/src/commands/migrations/MigrationAmendCommand.ts +1 -1
- package/src/commands/migrations/MigrationDiffCommand.ts +6 -1
- package/src/commands/migrations/MigrationValidationHelper.ts +3 -3
- package/src/commands/project/ProjectGenerateDocumentation.ts +2 -2
- package/src/commands/transfer/ExportCommand.ts +72 -0
- package/src/commands/transfer/ImportCommand.ts +61 -0
- package/src/commands/transfer/TransferCommand.ts +71 -0
- package/src/commands/transfer/index.ts +3 -0
- package/src/commands/transfer/utils.ts +135 -0
- package/src/run.ts +6 -0
- package/src/utils/admin.ts +1 -1
- package/src/utils/commands.ts +2 -2
- package/src/utils/dockerCompose.ts +2 -2
- package/src/utils/dsn.ts +13 -0
- package/src/utils/npm.ts +2 -2
- package/src/utils/project/loadSchema.ts +1 -1
- package/src/utils/project/projectDescribe.tsx +1 -1
- package/src/utils/schema.ts +4 -4
- package/src/utils/stdio.ts +6 -0
- package/src/utils/stream.ts +44 -0
- package/src/utils/workspace.ts +1 -2
- package/src/utils/yaml.ts +2 -3
package/dist/src/utils/admin.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.readAdminFiles = exports.AdminClient = void 0;
|
|
7
7
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
|
-
const promises_1 = require("fs/promises");
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
9
|
const token_1 = require("./token");
|
|
10
10
|
class AdminClient {
|
|
11
11
|
constructor(url, apiToken) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../src/utils/admin.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4C;AAC5C
|
|
1
|
+
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,KAAK,EAAE,GAAW,EAAE,SAAiB,EAAE,EAAuB,EAAE;IAC7F,MAAM,KAAK,GAAG,EAAE,CAAA;IAChB,KAAK,MAAM,QAAQ,IAAI,MAAM,IAAA,kBAAO,EAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE;QACnE,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAc,EAAC,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,CAAA;YAC9F,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA;SACvB;aAAM,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE;YAC7B,KAAK,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,IAAI;gBAC5B,IAAI,EAAE,CAAC,MAAM,IAAA,mBAAQ,EAAC,GAAG,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;aACpE,CAAC,CAAA;SACF;KACD;IAED,OAAO,KAAK,CAAA;AACb,CAAC,CAAA;AAfY,QAAA,cAAc,kBAe1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ChildProcessWithoutNullStreams } from 'child_process';
|
|
3
|
-
import { Readable, Writable } from 'stream';
|
|
2
|
+
import { ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
3
|
+
import { Readable, Writable } from 'node:stream';
|
|
4
4
|
export declare type RunningCommand = {
|
|
5
5
|
child: ChildProcessWithoutNullStreams;
|
|
6
6
|
output: Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/utils/commands.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,8BAA8B,EAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/utils/commands.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,8BAA8B,EAAS,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGhD,oBAAY,cAAc,GAAG;IAAE,KAAK,EAAE,8BAA8B,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,CAAA;AAC/F,eAAO,MAAM,UAAU,YACb,MAAM,QACT,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,WACnB;IACR,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,MAAM,CAAC,EAAE,QAAQ,CAAA;IACjB,MAAM,CAAC,EAAE,QAAQ,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,UAAU,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,KACC,cA0CF,CAAA;AAED,qBAAa,iBAAkB,SAAQ,KAAK;aACf,QAAQ,EAAE,MAAM,GAAG,IAAI;aAAkB,MAAM,EAAE,MAAM;gBAAvD,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAkB,MAAM,EAAE,MAAM;CAGnF"}
|
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ChildProcessError = exports.runCommand = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const runCommand = (command, args, options) => {
|
|
10
10
|
const args2 = args.filter((it) => it !== undefined);
|
|
11
11
|
if (!process.env.DISABLE_COMMAND_PRINTING) {
|
|
12
12
|
console.error(chalk_1.default.gray(`$ ${command} ${args2.map(it => `'${it.replace(/'/g, `'\\''`)}'`).join(' ')}`));
|
|
13
13
|
}
|
|
14
|
-
const child = (0,
|
|
14
|
+
const child = (0, node_child_process_1.spawn)(command, args2, {
|
|
15
15
|
cwd: options.cwd,
|
|
16
16
|
env: { ...process.env, ...(options.env || {}) },
|
|
17
17
|
detached: options.detached,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/utils/commands.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/utils/commands.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA0E;AAE1E,kDAAyB;AAGlB,MAAM,UAAU,GAAG,CACzB,OAAe,EACf,IAA4B,EAC5B,OAOC,EACgB,EAAE;IACnB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;IACjE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE;QAC1C,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;KACxG;IACD,MAAM,KAAK,GAAG,IAAA,0BAAK,EAAC,OAAO,EAAE,KAAK,EAAE;QACnC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE;QAC/C,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC1B,CAAC,CAAA;IACF,IAAI,OAAO,CAAC,KAAK,EAAE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QAAQ,MAAM,MAAM,GAAG,CAAC,CAAA;QADzB,aAAQ,GAAR,QAAQ,CAAe;QAAkB,WAAM,GAAN,MAAM,CAAQ;IAEnF,CAAC;CACD;AAJD,8CAIC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateMainDockerComposeConfig = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const cli_common_1 = require("@contember/cli-common");
|
|
6
6
|
const yaml_1 = require("./yaml");
|
|
7
7
|
const MAIN_CONFIGS = ['docker-compose.yaml', 'docker-compose.yml'];
|
|
8
8
|
const resolvePath = async (dir, possibleFileNames, fallbackFileName) => {
|
|
9
9
|
for (const file of possibleFileNames) {
|
|
10
|
-
const path = (0,
|
|
11
|
-
if (await (0,
|
|
10
|
+
const path = (0, node_path_1.join)(dir, file);
|
|
11
|
+
if (await (0, cli_common_1.pathExists)(path)) {
|
|
12
12
|
return path;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
return (0,
|
|
15
|
+
return (0, node_path_1.join)(dir, fallbackFileName);
|
|
16
16
|
};
|
|
17
17
|
const updateMainDockerComposeConfig = async (dir, updater) => {
|
|
18
18
|
const path = process.env.COMPOSE_FILE || (await resolvePath(dir, MAIN_CONFIGS, MAIN_CONFIGS[0]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dockerCompose.js","sourceRoot":"","sources":["../../../src/utils/dockerCompose.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"dockerCompose.js","sourceRoot":"","sources":["../../../src/utils/dockerCompose.ts"],"names":[],"mappings":";;;AAAA,yCAAgC;AAChC,sDAAkD;AAClD,iCAAuD;AAEvD,MAAM,YAAY,GAAG,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,CAAA;AAiBlE,MAAM,WAAW,GAAG,KAAK,EAAE,GAAW,EAAE,iBAA2B,EAAE,gBAAwB,EAAmB,EAAE;IACjH,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE;QACrC,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QAC5B,IAAI,MAAM,IAAA,uBAAU,EAAC,IAAI,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAA;SACX;KACD;IACD,OAAO,IAAA,gBAAI,EAAC,GAAG,EAAE,gBAAgB,CAAC,CAAA;AACnC,CAAC,CAAA;AAEM,MAAM,6BAA6B,GAAG,KAAK,EACjD,GAAW,EACX,OAAgD,EAChC,EAAE;IAClB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAChG,OAAO,IAAA,iBAAU,EAAC,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;AAC1D,CAAC,CAAA;AANY,QAAA,6BAA6B,iCAMzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dsn.d.ts","sourceRoot":"","sources":["../../../src/utils/dsn.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAI;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAUxF,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDsn = void 0;
|
|
4
|
+
const node_url_1 = require("node:url");
|
|
5
|
+
const parseDsn = (dsn) => {
|
|
6
|
+
const uri = new node_url_1.URL(dsn);
|
|
7
|
+
if (uri.protocol !== 'contember:' && uri.protocol !== 'contember-unsecure:') {
|
|
8
|
+
throw 'Invalid DSN';
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
project: uri.username,
|
|
12
|
+
token: uri.password,
|
|
13
|
+
endpoint: (uri.protocol === 'contember-unsecure:' ? 'http://' : 'https://') + uri.host,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.parseDsn = parseDsn;
|
|
17
|
+
//# sourceMappingURL=dsn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dsn.js","sourceRoot":"","sources":["../../../src/utils/dsn.ts"],"names":[],"mappings":";;;AAAA,uCAA8B;AAEvB,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAuD,EAAE;IAC5F,MAAM,GAAG,GAAG,IAAI,cAAG,CAAC,GAAG,CAAC,CAAA;IACxB,IAAI,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,GAAG,CAAC,QAAQ,KAAK,qBAAqB,EAAE;QAC5E,MAAM,aAAa,CAAA;KACnB;IACD,OAAO;QACN,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,KAAK,EAAE,GAAG,CAAC,QAAQ;QACnB,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,IAAI;KACtF,CAAA;AACF,CAAC,CAAA;AAVY,QAAA,QAAQ,YAUpB"}
|
package/dist/src/utils/npm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateNpmPackages = void 0;
|
|
4
|
-
const fs_extra_1 = require("fs-extra");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const commands_1 = require("./commands");
|
|
7
4
|
const cli_common_1 = require("@contember/cli-common");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const commands_1 = require("./commands");
|
|
7
|
+
const cli_common_2 = require("@contember/cli-common");
|
|
8
8
|
const install = async (hasYarn, packages, isDev, dir) => {
|
|
9
9
|
const [cmd, ...args] = hasYarn
|
|
10
10
|
? ['yarn', 'add', isDev ? '--dev' : undefined, '--ignore-workspace-root-check']
|
|
@@ -24,10 +24,10 @@ const install = async (hasYarn, packages, isDev, dir) => {
|
|
|
24
24
|
console.log('npm update done');
|
|
25
25
|
};
|
|
26
26
|
const updateNpmPackages = async (packages, workspaceDirectory) => {
|
|
27
|
-
const hasYarn = await (0,
|
|
27
|
+
const hasYarn = await (0, cli_common_1.pathExists)((0, node_path_1.join)(workspaceDirectory, 'yarn.lock'));
|
|
28
28
|
const processPackageFile = async (dir) => {
|
|
29
|
-
const packageJsonFile = (0,
|
|
30
|
-
if (!(await (0,
|
|
29
|
+
const packageJsonFile = (0, node_path_1.join)(dir, 'package.json');
|
|
30
|
+
if (!(await (0, cli_common_1.pathExists)(packageJsonFile))) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -44,10 +44,10 @@ const updateNpmPackages = async (packages, workspaceDirectory) => {
|
|
|
44
44
|
const dirsPromise = packageJson.workspaces.map(async (it) => {
|
|
45
45
|
if (it.substr(-1) === '*') {
|
|
46
46
|
const baseDir = it.substring(0, it.length - 1);
|
|
47
|
-
return await (0,
|
|
47
|
+
return await (0, cli_common_2.listDirectories)(baseDir);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
return [(0,
|
|
50
|
+
return [(0, node_path_1.join)(dir, it)];
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
const workspaceDirs = (await Promise.all(dirsPromise)).flatMap(it => it);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/utils/npm.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../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E,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;oBAC9C,OAAO,MAAM,IAAA,4BAAe,EAAC,OAAO,CAAC,CAAA;iBACrC;qBAAM;oBACN,OAAO,CAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAA;iBACtB;YACF,CAAC,CAAC,CAAA;YACF,MAAM,aAAa,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;YACxE,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;gBAChC,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAA;aAC7B;SACD;IACF,CAAC,CAAA;IACD,MAAM,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;AAC7C,CAAC,CAAA;AAjCY,QAAA,iBAAiB,qBAiC7B"}
|
|
@@ -25,12 +25,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.loadSchema = void 0;
|
|
27
27
|
const esbuild = __importStar(require("esbuild"));
|
|
28
|
-
const
|
|
28
|
+
const node_path_1 = require("node:path");
|
|
29
29
|
const vm2_1 = require("vm2");
|
|
30
30
|
const schema_utils_1 = require("@contember/schema-utils");
|
|
31
31
|
const loadSchema = async (project) => {
|
|
32
32
|
const response = await esbuild.build({
|
|
33
|
-
entryPoints: [(0,
|
|
33
|
+
entryPoints: [(0, node_path_1.join)(project.apiDir, 'index.ts')],
|
|
34
34
|
platform: 'node',
|
|
35
35
|
bundle: true,
|
|
36
36
|
treeShaking: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadSchema.js","sourceRoot":"","sources":["../../../../src/utils/project/loadSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,iDAAkC;AAClC
|
|
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,CAAC,KAAK,CAAC;QACpC,WAAW,EAAE,CAAC,IAAA,gBAAI,EAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC/C,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,KAAK;QACZ,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;AAnBY,QAAA,UAAU,cAmBtB"}
|
|
@@ -7,7 +7,7 @@ exports.renderProjectInfoHtml = void 0;
|
|
|
7
7
|
const preact_1 = require("preact");
|
|
8
8
|
const preact_render_to_string_1 = __importDefault(require("preact-render-to-string"));
|
|
9
9
|
const ProjectInfo_1 = require("./components/ProjectInfo");
|
|
10
|
-
const promises_1 = require("fs/promises");
|
|
10
|
+
const promises_1 = require("node:fs/promises");
|
|
11
11
|
const renderProjectInfoHtml = async (schema, projectName) => {
|
|
12
12
|
const html = (0, preact_render_to_string_1.default)((0, preact_1.h)(ProjectInfo_1.ProjectInfo, { schema: schema, projectName: projectName }));
|
|
13
13
|
const css = await (0, promises_1.readFile)(__dirname + '/resources/out.css');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectDescribe.js","sourceRoot":"","sources":["../../../../src/utils/project/projectDescribe.tsx"],"names":[],"mappings":";;;;;;AACA,mCAA0B;AAC1B,sFAA4C;AAC5C,0DAAsD;AACtD
|
|
1
|
+
{"version":3,"file":"projectDescribe.js","sourceRoot":"","sources":["../../../../src/utils/project/projectDescribe.tsx"],"names":[],"mappings":";;;;;;AACA,mCAA0B;AAC1B,sFAA4C;AAC5C,0DAAsD;AACtD,+CAA2C;AAEpC,MAAM,qBAAqB,GAAG,KAAK,EAAE,MAAc,EAAE,WAAmB,EAAE,EAAE;IAClF,MAAM,IAAI,GAAG,IAAA,iCAAM,EAAC,gBAAC,yBAAW,IAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAI,CAAC,CAAA;IAE9E,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAQ,EAAC,SAAS,GAAG,oBAAoB,CAAC,CAAA;IAC5D,OAAO;;;;;UAKE,GAAG;UACH,WAAW;;;EAGnB,IAAI;;;CAGL,CAAA;AAED,CAAC,CAAA;AAlBY,QAAA,qBAAqB,yBAkBjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ValidationError } from '@contember/schema-utils';
|
|
1
|
+
import { SchemaValidatorSkippedErrors, ValidationError } from '@contember/schema-utils';
|
|
2
2
|
import { Schema } from '@contember/schema';
|
|
3
3
|
export declare const printValidationErrors: (errors: ValidationError[], message?: string) => void;
|
|
4
|
-
export declare const validateSchemaAndPrintErrors: (schema: Schema, message?: string) => boolean;
|
|
4
|
+
export declare const validateSchemaAndPrintErrors: (schema: Schema, message?: string, skippedErrors?: SchemaValidatorSkippedErrors[]) => 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;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,4BAA4B,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACxG,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,kBAAkB,4BAA4B,EAAE,KAAG,OAI/H,CAAA"}
|
package/dist/src/utils/schema.js
CHANGED
|
@@ -8,13 +8,13 @@ const printValidationErrors = (errors, message) => {
|
|
|
8
8
|
}
|
|
9
9
|
console.group(message || 'Schema is invalid:');
|
|
10
10
|
for (const err of errors) {
|
|
11
|
-
console.log(err.path.join('.')
|
|
11
|
+
console.log(`${err.path.join('.')}: [${err.code}] ${err.message}`);
|
|
12
12
|
}
|
|
13
13
|
console.groupEnd();
|
|
14
14
|
};
|
|
15
15
|
exports.printValidationErrors = printValidationErrors;
|
|
16
|
-
const validateSchemaAndPrintErrors = (schema, message) => {
|
|
17
|
-
const errors = schema_utils_1.SchemaValidator.validate(schema);
|
|
16
|
+
const validateSchemaAndPrintErrors = (schema, message, skippedErrors) => {
|
|
17
|
+
const errors = schema_utils_1.SchemaValidator.validate(schema, skippedErrors);
|
|
18
18
|
(0, exports.printValidationErrors)(errors, message);
|
|
19
19
|
return errors.length === 0;
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":";;;AAAA,0DAAwG;AAGjG,MAAM,qBAAqB,GAAG,CAAC,MAAyB,EAAE,OAAgB,EAAE,EAAE;IACpF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAM;KACN;IACD,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,oBAAoB,CAAC,CAAA;IAC9C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACzB,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;KAClE;IACD,OAAO,CAAC,QAAQ,EAAE,CAAA;AACnB,CAAC,CAAA;AATY,QAAA,qBAAqB,yBASjC;AAEM,MAAM,4BAA4B,GAAG,CAAC,MAAc,EAAE,OAAgB,EAAE,aAA8C,EAAW,EAAE;IACzI,MAAM,MAAM,GAAG,8BAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IAC9D,IAAA,6BAAqB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAA;AAC3B,CAAC,CAAA;AAJY,QAAA,4BAA4B,gCAIxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/utils/stdio.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,YAAa,MAAM,SAIhD,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteStdoutLine = void 0;
|
|
4
|
+
const rewriteStdoutLine = (message) => {
|
|
5
|
+
process.stdout.clearLine(0);
|
|
6
|
+
process.stdout.cursorTo(0);
|
|
7
|
+
process.stdout.write(message);
|
|
8
|
+
};
|
|
9
|
+
exports.rewriteStdoutLine = rewriteStdoutLine;
|
|
10
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +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;AAJY,QAAA,iBAAiB,qBAI7B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Stream, Transform } from 'node:stream';
|
|
3
|
+
import { Buffer } from 'node:buffer';
|
|
4
|
+
export declare class LineTransform extends Transform {
|
|
5
|
+
private chunks;
|
|
6
|
+
constructor(transform: (line: string) => string);
|
|
7
|
+
}
|
|
8
|
+
export declare const readStream: (stream: Stream) => Promise<Buffer>;
|
|
9
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/utils/stream.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,qBAAa,aAAc,SAAQ,SAAS;IAC3C,OAAO,CAAC,MAAM,CAAe;gBAEjB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;CA4B/C;AAGD,eAAO,MAAM,UAAU,WAAkB,MAAM,oBAK7C,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readStream = exports.LineTransform = void 0;
|
|
4
|
+
const node_stream_1 = require("node:stream");
|
|
5
|
+
const node_buffer_1 = require("node:buffer");
|
|
6
|
+
class LineTransform extends node_stream_1.Transform {
|
|
7
|
+
constructor(transform) {
|
|
8
|
+
super({
|
|
9
|
+
transform: (chunk, encoding, done) => {
|
|
10
|
+
while (true) {
|
|
11
|
+
const eolIndex = chunk.indexOf('\n');
|
|
12
|
+
if (eolIndex < 0) {
|
|
13
|
+
this.chunks.push(chunk);
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
this.chunks.push(chunk.slice(0, eolIndex));
|
|
17
|
+
chunk = chunk.slice(eolIndex + 1);
|
|
18
|
+
this.push(transform(node_buffer_1.Buffer.concat(this.chunks).toString('utf8')) + '\n', 'utf8');
|
|
19
|
+
this.chunks = [];
|
|
20
|
+
}
|
|
21
|
+
return done();
|
|
22
|
+
},
|
|
23
|
+
flush: done => {
|
|
24
|
+
if (this.chunks.length) {
|
|
25
|
+
this.push(transform(node_buffer_1.Buffer.concat(this.chunks).toString('utf8')), 'utf8');
|
|
26
|
+
return done();
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
this.chunks = [];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.LineTransform = LineTransform;
|
|
34
|
+
const readStream = async (stream) => new Promise((resolve, reject) => {
|
|
35
|
+
const chunks = [];
|
|
36
|
+
stream.on('error', err => reject(err));
|
|
37
|
+
stream.on('data', chunk => chunks.push(chunk));
|
|
38
|
+
stream.on('end', () => resolve(node_buffer_1.Buffer.concat(chunks)));
|
|
39
|
+
});
|
|
40
|
+
exports.readStream = readStream;
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YACF,CAAC;SACD,CAAC,CAAA;QA5BK,WAAM,GAAa,EAAE,CAAA;IA6B7B,CAAC;CACD;AA/BD,sCA+BC;AAGM,MAAM,UAAU,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE,CAAC,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC3F,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IACtC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,oBAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AACvD,CAAC,CAAC,CAAA;AALW,QAAA,UAAU,cAKrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/utils/workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/utils/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAGxF,eAAO,MAAM,yBAAyB,cAAqB,SAAS,cAAc,MAAM,KAAG,QAAQ,MAAM,GAAG,IAAI,CAiB/G,CAAA"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateWorkspaceApiVersion = void 0;
|
|
4
|
-
const fs_extra_1 = require("fs-extra");
|
|
5
4
|
const cli_common_1 = require("@contember/cli-common");
|
|
6
5
|
const yaml_1 = require("./yaml");
|
|
7
6
|
const updateWorkspaceApiVersion = async (workspace, newVersion) => {
|
|
8
7
|
const possiblePaths = (0, cli_common_1.formatWorkspaceConfigPath)(workspace.directory);
|
|
9
8
|
for (const configPath of possiblePaths) {
|
|
10
|
-
if (await (0,
|
|
9
|
+
if (await (0, cli_common_1.pathExists)(configPath)) {
|
|
11
10
|
await (0, yaml_1.updateYaml)(configPath, data => {
|
|
12
11
|
return {
|
|
13
12
|
...data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../src/utils/workspace.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../src/utils/workspace.ts"],"names":[],"mappings":";;;AAAA,sDAAwF;AACxF,iCAAmC;AAE5B,MAAM,yBAAyB,GAAG,KAAK,EAAE,SAAoB,EAAE,UAAkB,EAA0B,EAAE;IACnH,MAAM,aAAa,GAAG,IAAA,sCAAyB,EAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IACpE,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE;QACvC,IAAI,MAAM,IAAA,uBAAU,EAAC,UAAU,CAAC,EAAE;YACjC,MAAM,IAAA,iBAAU,EAAC,UAAU,EAAE,IAAI,CAAC,EAAE;gBACnC,OAAO;oBACN,GAAG,IAAI;oBACP,GAAG,EAAE;wBACJ,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;wBACjD,OAAO,EAAE,UAAU;qBACnB;iBACD,CAAA;YACF,CAAC,CAAC,CAAA;YACF,OAAO,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;SACnD;KACD;IACD,OAAO,IAAI,CAAA;AACZ,CAAC,CAAA;AAjBY,QAAA,yBAAyB,6BAiBrC"}
|
package/dist/src/utils/yaml.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONObject } from '@contember/cli-common
|
|
1
|
+
import { JSONObject } from '@contember/cli-common';
|
|
2
2
|
export declare type JsonUpdateCallback<Value = JSONObject> = (data: Partial<Value>, utils: {
|
|
3
3
|
merge: (a: JSONObject, b: JSONObject) => JSONObject;
|
|
4
4
|
}) => Value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../../src/utils/yaml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../../src/utils/yaml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6B,MAAM,uBAAuB,CAAA;AAM7E,oBAAY,kBAAkB,CAAC,KAAK,GAAG,UAAU,IAAI,CACpD,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EACpB,KAAK,EAAE;IAAE,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,KAAK,UAAU,CAAA;CAAE,KAC1D,KAAK,CAAA;AAEV,eAAO,MAAM,UAAU,6BAChB,MAAM,gDAEH;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,kBAoBpC,CAAA"}
|
package/dist/src/utils/yaml.js
CHANGED
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.updateYaml = void 0;
|
|
7
|
-
const
|
|
7
|
+
const cli_common_1 = require("@contember/cli-common");
|
|
8
8
|
const cjs_1 = __importDefault(require("yawn-yaml/cjs"));
|
|
9
9
|
const config_loader_1 = require("@contember/config-loader");
|
|
10
10
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
11
|
-
const promises_1 = require("fs/promises");
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
12
|
const updateYaml = async (path, updater, options = {}) => {
|
|
13
13
|
let config = '';
|
|
14
|
-
if (await (0,
|
|
14
|
+
if (await (0, cli_common_1.pathExists)(path)) {
|
|
15
15
|
config = await (0, promises_1.readFile)(path, { encoding: 'utf8' });
|
|
16
16
|
}
|
|
17
17
|
else if (options.createMissing !== true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../../src/utils/yaml.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../../src/utils/yaml.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6E;AAC7E,wDAAgC;AAChC,4DAAiD;AACjD,sDAA4B;AAC5B,+CAAsD;AAO/C,MAAM,UAAU,GAAG,KAAK,EAC9B,IAAY,EACZ,OAAkC,EAClC,UAAuC,EAAE,EACxC,EAAE;IACH,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,IAAI,MAAM,IAAA,uBAAU,EAAC,IAAI,CAAC,EAAE;QAC3B,MAAM,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAA;KACnD;SAAM,IAAI,OAAO,CAAC,aAAa,KAAK,IAAI,EAAE;QAC1C,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,kBAAkB,CAAC,CAAA;KAC/C;IAED,IAAI,SAAS,GAAG,EAAE,CAAA;IAClB,MAAM,UAAU,GAAG,EAAE,KAAK,EAAE,CAAC,CAAa,EAAE,CAAa,EAAE,EAAE,CAAC,sBAAM,CAAC,KAAK,CAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;IACjG,IAAI,MAAM,EAAE;QACX,MAAM,IAAI,GAAG,IAAI,aAAI,CAAC,MAAM,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QAC1C,SAAS,GAAG,IAAI,CAAC,IAAI,CAAA;KACrB;SAAM;QACN,SAAS,GAAG,iBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAA;KAChD;IAED,MAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AAvBY,QAAA,UAAU,cAuBtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/cli",
|
|
3
|
-
"version": "1.2.0-
|
|
3
|
+
"version": "1.2.0-beta.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contember": "./dist/src/run.js"
|
|
@@ -13,24 +13,23 @@
|
|
|
13
13
|
"@types/fs-extra": "^9.0.3",
|
|
14
14
|
"@types/js-yaml": "^4.0.1",
|
|
15
15
|
"@types/prompts": "^2.0.1",
|
|
16
|
+
"@types/node": "^18",
|
|
16
17
|
"autoprefixer": "^10.4.5",
|
|
17
18
|
"postcss": "^8.4.12",
|
|
18
19
|
"tailwindcss": "^3.0.24"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|
|
21
|
-
"@contember/cli-common": "^1.2.0-
|
|
22
|
-
"@contember/config-loader": "^1.2.0-
|
|
23
|
-
"@contember/
|
|
24
|
-
"@contember/
|
|
25
|
-
"@contember/
|
|
26
|
-
"@contember/schema": "^1.2.0-
|
|
27
|
-
"@contember/schema-
|
|
28
|
-
"@
|
|
29
|
-
"@contember/schema-utils": "^1.2.0-alpha.9",
|
|
22
|
+
"@contember/cli-common": "^1.2.0-beta.1",
|
|
23
|
+
"@contember/config-loader": "^1.2.0-beta.1",
|
|
24
|
+
"@contember/dic": "^1.2.0-beta.1",
|
|
25
|
+
"@contember/engine-content-api": "^1.2.0-beta.1",
|
|
26
|
+
"@contember/schema": "^1.2.0-beta.1",
|
|
27
|
+
"@contember/schema-migrations": "^1.2.0-beta.1",
|
|
28
|
+
"@contember/schema-utils": "^1.2.0-beta.1",
|
|
29
|
+
"@graphql-tools/schema": "^8.3.5",
|
|
30
30
|
"chalk": "^4.1.2",
|
|
31
31
|
"chalk-table": "^1.0.2",
|
|
32
32
|
"esbuild": "^0.14.54",
|
|
33
|
-
"get-port": "^5.0.0",
|
|
34
33
|
"graphql": "^16.5.0",
|
|
35
34
|
"graphql-request": "^4.3.0",
|
|
36
35
|
"js-yaml": "^4.1.0",
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Command, CommandConfiguration, Input, Project, Workspace } from '@contember/cli-common'
|
|
1
|
+
import { Command, CommandConfiguration, Input, pathExists, Project, Workspace } from '@contember/cli-common'
|
|
2
2
|
import {
|
|
3
3
|
configureExecuteMigrationCommand,
|
|
4
4
|
ExecuteMigrationOptions,
|
|
5
5
|
executeMigrations,
|
|
6
6
|
resolveMigrationStatus,
|
|
7
7
|
} from '../migrations/MigrationExecuteHelper'
|
|
8
|
-
import { pathExists } from 'fs-extra'
|
|
9
8
|
import { interactiveResolveApiToken, TenantClient } from '../../utils/tenant'
|
|
10
9
|
import { interactiveResolveInstanceEnvironmentFromInput } from '../../utils/instance'
|
|
11
10
|
import { SystemClient } from '../../utils/system'
|
|
12
11
|
import { MigrationsContainerFactory } from '../../MigrationsContainer'
|
|
13
12
|
import { AdminClient, readAdminFiles } from '../../utils/admin'
|
|
14
|
-
import { URL } from 'url'
|
|
13
|
+
import { URL } from 'node:url'
|
|
15
14
|
import prompts from 'prompts'
|
|
16
15
|
import { createMigrationStatusTable } from '../../utils/migrations'
|
|
17
16
|
import { maskToken } from '../../utils/token'
|
|
17
|
+
import { parseDsn } from '../../utils/dsn'
|
|
18
18
|
|
|
19
19
|
type Args = {
|
|
20
20
|
dsn: string
|
|
@@ -53,13 +53,7 @@ export class DeployCommand extends Command<Args, Options> {
|
|
|
53
53
|
|
|
54
54
|
let remoteProject = input.getOption('remote-project') || project.name
|
|
55
55
|
if (dsn) {
|
|
56
|
-
|
|
57
|
-
if (uri.protocol !== 'contember:' && uri.protocol !== 'contember-unsecure:') {
|
|
58
|
-
throw 'Invalid deploy DSN'
|
|
59
|
-
}
|
|
60
|
-
remoteProject = uri.username
|
|
61
|
-
apiTokenFromDsn = uri.password
|
|
62
|
-
adminEndpoint = (uri.protocol === 'contember-unsecure:' ? 'http://' : 'https://') + uri.host
|
|
56
|
+
({ project: remoteProject, endpoint: adminEndpoint, token: apiTokenFromDsn } = parseDsn(dsn))
|
|
63
57
|
}
|
|
64
58
|
const instance = await interactiveResolveInstanceEnvironmentFromInput(this.workspace, apiUrl ?? (adminEndpoint ? adminEndpoint + '/_api' : undefined))
|
|
65
59
|
const apiToken = await interactiveResolveApiToken({ workspace: this.workspace, instance, apiToken: apiTokenFromDsn })
|
|
@@ -92,7 +92,7 @@ export class MigrationAmendCommand extends Command<Args, Options> {
|
|
|
92
92
|
emptySchema,
|
|
93
93
|
version => version < amendMigration.version,
|
|
94
94
|
)
|
|
95
|
-
const newSchema = await schemaMigrator.applyModifications(
|
|
95
|
+
const { meta, ...newSchema } = await schemaMigrator.applyModifications(
|
|
96
96
|
prevSchema,
|
|
97
97
|
[...amendMigration.modifications, ...intermediateResult.migration.modifications],
|
|
98
98
|
amendMigration.formatVersion,
|
|
@@ -18,6 +18,7 @@ type Args = {
|
|
|
18
18
|
type Options = {
|
|
19
19
|
execute?: true
|
|
20
20
|
yes?: true
|
|
21
|
+
'skip-initial-schema-validation'?: true
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export class MigrationDiffCommand extends Command<Args, Options> {
|
|
@@ -38,6 +39,8 @@ export class MigrationDiffCommand extends Command<Args, Options> {
|
|
|
38
39
|
.option('yes')
|
|
39
40
|
.valueNone()
|
|
40
41
|
.description('Do not ask for confirmation.')
|
|
42
|
+
|
|
43
|
+
configuration.option('skip-initial-schema-validation')
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
protected async execute(input: Input<Args, Options>): Promise<number> {
|
|
@@ -56,7 +59,9 @@ export class MigrationDiffCommand extends Command<Args, Options> {
|
|
|
56
59
|
try {
|
|
57
60
|
const migrationName = input.getArgument('migrationName')
|
|
58
61
|
const initialSchema = await schemaVersionBuilder.buildSchema()
|
|
59
|
-
const result = await migrationCreator.prepareMigration(initialSchema, schema, migrationName
|
|
62
|
+
const result = await migrationCreator.prepareMigration(initialSchema, schema, migrationName, {
|
|
63
|
+
skipInitialSchemaValidation: input.getOption('skip-initial-schema-validation') === true,
|
|
64
|
+
})
|
|
60
65
|
if (result === null) {
|
|
61
66
|
console.log('Nothing to do')
|
|
62
67
|
return 0
|
|
@@ -22,9 +22,9 @@ export const validateMigrations = async (
|
|
|
22
22
|
}
|
|
23
23
|
throw e
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
projectValid
|
|
25
|
+
const errorMessage = `Migration ${migration.name} produces invalid schema:`
|
|
26
|
+
projectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, migration.skippedErrors)
|
|
27
|
+
&& projectValid
|
|
28
28
|
}
|
|
29
29
|
return projectValid
|
|
30
30
|
}
|
|
@@ -2,8 +2,8 @@ import { Command, CommandConfiguration, Input, Workspace } from '@contember/cli-
|
|
|
2
2
|
import { validateSchemaAndPrintErrors } from '../../utils/schema'
|
|
3
3
|
import { loadSchema } from '../../utils/project/loadSchema'
|
|
4
4
|
import { renderProjectInfoHtml } from '../../utils/project/projectDescribe'
|
|
5
|
-
import { writeFile } from 'fs/promises'
|
|
6
|
-
import { join } from 'path'
|
|
5
|
+
import { writeFile } from 'node:fs/promises'
|
|
6
|
+
import { join } from 'node:path'
|
|
7
7
|
|
|
8
8
|
type Args = {
|
|
9
9
|
project?: string
|