@zuplo/cli 2.2.0 → 2.3.0
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/common/output.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ce8d0e5c-522c-5fe1-8df5-e8925fcb7a3b")}catch(e){}}();
|
|
3
3
|
import * as Sentry from "@sentry/node";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { MAX_WAIT_PENDING_TIME_MS } from "./constants.js";
|
|
@@ -7,7 +7,7 @@ export function printDiagnosticsToConsole(message) {
|
|
|
7
7
|
console.error(chalk.bold.blue(message));
|
|
8
8
|
}
|
|
9
9
|
export function printWarningToConsole(message) {
|
|
10
|
-
console.error(message);
|
|
10
|
+
console.error(chalk.yellow(message));
|
|
11
11
|
}
|
|
12
12
|
export async function printCriticalFailureToConsoleAndExit(message) {
|
|
13
13
|
console.error(chalk.bold.red(message));
|
|
@@ -54,4 +54,4 @@ export function textOrJson(text) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
//# sourceMappingURL=output.js.map
|
|
57
|
-
//# debugId=
|
|
57
|
+
//# debugId=ce8d0e5c-522c-5fe1-8df5-e8925fcb7a3b
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bbc3a878-c332-5d04-a39e-99fa8ed6ff1c")}catch(e){}}();
|
|
3
3
|
import { parse } from "jsonc-parser";
|
|
4
4
|
import { readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import prettier from "prettier";
|
|
7
|
-
import
|
|
7
|
+
import { printWarningToConsole } from "../output.js";
|
|
8
8
|
import { StandardUpgrader } from "./lib.js";
|
|
9
9
|
export class FailedToParseTSConfigJson extends Error {
|
|
10
10
|
constructor() {
|
|
@@ -12,6 +12,24 @@ export class FailedToParseTSConfigJson extends Error {
|
|
|
12
12
|
Object.setPrototypeOf(this, FailedToParseTSConfigJson.prototype);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
const tsConfig = {
|
|
16
|
+
include: ["modules/**/*", ".zuplo/**/*", "tests/**/*"],
|
|
17
|
+
exclude: ["./node_modules", "./dist"],
|
|
18
|
+
compilerOptions: {
|
|
19
|
+
module: "ESNext",
|
|
20
|
+
target: "ES2022",
|
|
21
|
+
moduleResolution: "Bundler",
|
|
22
|
+
lib: ["ESNext", "WebWorker", "Webworker.Iterable"],
|
|
23
|
+
preserveConstEnums: true,
|
|
24
|
+
useUnknownInCatchVariables: false,
|
|
25
|
+
forceConsistentCasingInFileNames: true,
|
|
26
|
+
importHelpers: true,
|
|
27
|
+
removeComments: true,
|
|
28
|
+
esModuleInterop: true,
|
|
29
|
+
strictNullChecks: true,
|
|
30
|
+
noEmit: true,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
15
33
|
export class InvalidTSConfigJson extends Error {
|
|
16
34
|
constructor(message) {
|
|
17
35
|
super(message);
|
|
@@ -32,20 +50,28 @@ export class TSConfigUpgrader extends StandardUpgrader {
|
|
|
32
50
|
"compilerOptions" in tsConfigJson)) {
|
|
33
51
|
return true;
|
|
34
52
|
}
|
|
35
|
-
const { options, errors } = ts.convertCompilerOptionsFromJson(tsConfigJson.compilerOptions, this.normalizedDir);
|
|
36
53
|
const libValue = ["ESNext", "WebWorker", "Webworker.Iterable"];
|
|
37
54
|
const includesAllLibs = (userLibs) => {
|
|
38
55
|
const a = libValue.map((item) => item.toLowerCase());
|
|
39
56
|
const b = userLibs.map((item) => item.toLowerCase());
|
|
40
57
|
return a.every((item) => b.includes(item));
|
|
41
58
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
options
|
|
48
|
-
|
|
59
|
+
if (tsConfigJson.extends) {
|
|
60
|
+
printWarningToConsole("This project uses an advanced tsconfig.json setup. You will need to manually upgrade this file.");
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const options = tsConfigJson.compilerOptions;
|
|
65
|
+
return (options.module?.toLowerCase() !==
|
|
66
|
+
tsConfig.compilerOptions.module.toLowerCase() ||
|
|
67
|
+
options.target?.toLowerCase() !==
|
|
68
|
+
tsConfig.compilerOptions.target.toLowerCase() ||
|
|
69
|
+
options.moduleResolution?.toLowerCase() !==
|
|
70
|
+
tsConfig.compilerOptions.moduleResolution.toLowerCase() ||
|
|
71
|
+
!options.lib ||
|
|
72
|
+
options.baseUrl !== undefined ||
|
|
73
|
+
!includesAllLibs(tsConfigJson.compilerOptions.lib ?? []));
|
|
74
|
+
}
|
|
49
75
|
}
|
|
50
76
|
catch (err) {
|
|
51
77
|
return true;
|
|
@@ -56,52 +82,11 @@ export class TSConfigUpgrader extends StandardUpgrader {
|
|
|
56
82
|
return;
|
|
57
83
|
}
|
|
58
84
|
const tsFilePath = join(this.normalizedDir, "tsconfig.json");
|
|
59
|
-
const tsConfig = {
|
|
60
|
-
include: ["modules/**/*", ".zuplo/**/*", "tests/**/*"],
|
|
61
|
-
exclude: ["./node_modules", "./dist"],
|
|
62
|
-
compilerOptions: {
|
|
63
|
-
module: "ESNext",
|
|
64
|
-
target: "ES2022",
|
|
65
|
-
moduleResolution: "Bundler",
|
|
66
|
-
lib: ["ESNext", "WebWorker", "Webworker.Iterable"],
|
|
67
|
-
preserveConstEnums: true,
|
|
68
|
-
useUnknownInCatchVariables: false,
|
|
69
|
-
forceConsistentCasingInFileNames: true,
|
|
70
|
-
importHelpers: true,
|
|
71
|
-
removeComments: true,
|
|
72
|
-
esModuleInterop: true,
|
|
73
|
-
strictNullChecks: true,
|
|
74
|
-
noEmit: true,
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
85
|
const formatted = await prettier.format(JSON.stringify(tsConfig), {
|
|
78
86
|
parser: "json",
|
|
79
87
|
});
|
|
80
88
|
await writeFile(tsFilePath, formatted);
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
|
-
export const getZuploTsConfigTemplate = () => ({
|
|
84
|
-
include: ["modules/**/*", ".zuplo/**/*", "tests/**/*"],
|
|
85
|
-
exclude: ["./node_modules", "./dist"],
|
|
86
|
-
compilerOptions: {
|
|
87
|
-
baseUrl: ".",
|
|
88
|
-
module: ModuleKind.ESNext,
|
|
89
|
-
target: ScriptTarget.ESNext,
|
|
90
|
-
moduleResolution: ModuleResolutionKind.Bundler,
|
|
91
|
-
lib: ["ESNext", "WebWorker", "Webworker.Iterable"],
|
|
92
|
-
preserveConstEnums: true,
|
|
93
|
-
useUnknownInCatchVariables: false,
|
|
94
|
-
forceConsistentCasingInFileNames: true,
|
|
95
|
-
importHelpers: true,
|
|
96
|
-
removeComments: true,
|
|
97
|
-
esModuleInterop: true,
|
|
98
|
-
strictNullChecks: true,
|
|
99
|
-
experimentalDecorators: true,
|
|
100
|
-
noEmit: true,
|
|
101
|
-
paths: {
|
|
102
|
-
"@app/*": [".zuplo/*"],
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
91
|
//# sourceMappingURL=tsconfig-upgrader.js.map
|
|
107
|
-
//# debugId=
|
|
92
|
+
//# debugId=bbc3a878-c332-5d04-a39e-99fa8ed6ff1c
|