@xylabs/ts-scripts-yarn3 7.0.0-rc.9 → 7.0.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/dist/actions/build.mjs +87 -39
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-docs.mjs +22 -8
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs +11 -5
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs +29 -16
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +63 -32
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile.mjs +76 -50
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs +38 -23
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.mjs +57 -28
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs +31 -16
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +84 -50
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +7 -7
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +6 -10
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +5 -5
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +4 -0
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +84 -50
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +120 -81
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +20 -4
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/findFilesByGlob.mjs +8 -1
- package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -1
- package/dist/actions/deplint/getBasePackageName.mjs +4 -0
- package/dist/actions/deplint/getBasePackageName.mjs.map +1 -1
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +4 -0
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +24 -12
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +16 -9
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +120 -81
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs +57 -26
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +57 -26
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +57 -26
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +57 -26
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +37 -26
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs +54 -36
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +65 -25
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +44 -28
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +14 -5
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +7 -4
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +1555 -966
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +31 -16
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +51 -37
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +48 -33
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +44 -28
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +16 -6
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +16 -6
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +29 -12
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +36 -8
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +341 -185
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +23 -20
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/deepMerge.mjs +5 -0
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +9 -23
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +341 -267
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +26 -3
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +57 -96
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +94 -25
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +321 -123
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +21 -12
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +16 -9
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs +13 -12
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs +507 -347
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +39 -16
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/publint.mjs +9 -6
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +371 -201
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +71 -37
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +29 -17
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +67 -50
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +43 -25
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +63 -40
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +35 -17
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +32 -16
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +46 -27
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs +30 -16
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +27 -16
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +33 -18
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +53 -19
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +31 -16
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +23 -12
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +346 -191
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +348 -191
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +15 -6
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +15 -6
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +28 -12
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +345 -190
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +323 -126
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +346 -191
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +23 -13
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +23 -13
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +17 -11
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +38 -16
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs +12 -12
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +38 -16
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +8 -6
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +372 -203
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +38 -16
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +1351 -1075
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +133 -121
- package/dist/index.mjs +1908 -1460
- package/dist/index.mjs.map +1 -1
- package/dist/lib/checkResult.mjs +5 -2
- package/dist/lib/checkResult.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +24 -9
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/defaultBuildConfig.mjs +6 -2
- package/dist/lib/defaultBuildConfig.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs +9 -3
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +23 -12
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +33 -22
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +33 -22
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +3 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/constants.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs +13 -12
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs +15 -14
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs +8 -3
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +43 -27
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +166 -106
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/jsonFormatters.mjs +5 -2
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +20 -10
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +5 -2
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/processEx.mjs +9 -6
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.mjs +19 -13
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +22 -22
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs +31 -19
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/runXyWithWarning.mjs +5 -2
- package/dist/lib/runXyWithWarning.mjs.map +1 -1
- package/dist/lib/safeExit.mjs +13 -10
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/string/empty.mjs +5 -2
- package/dist/lib/string/empty.mjs.map +1 -1
- package/dist/lib/string/index.mjs +9 -3
- package/dist/lib/string/index.mjs.map +1 -1
- package/dist/lib/string/union.mjs +7 -1
- package/dist/lib/string/union.mjs.map +1 -1
- package/dist/lib/withErrnoException.mjs +7 -4
- package/dist/lib/withErrnoException.mjs.map +1 -1
- package/dist/lib/withError.mjs +5 -2
- package/dist/lib/withError.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +30 -11
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +15 -4
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs +16 -5
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +16 -5
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +14 -3
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/lib/yarn/yarnInitCwd.mjs +5 -2
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
- package/dist/loadPackageConfig.mjs +8 -3
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/index.mjs +1351 -1074
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +9 -3
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +1351 -1074
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +324 -305
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +336 -251
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +161 -99
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +193 -145
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +437 -321
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +5 -2
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +13 -12
- package/dist/actions/compile-types.mjs +0 -153
- package/dist/actions/compile-types.mjs.map +0 -1
package/dist/actions/index.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/actions/build.ts
|
|
2
5
|
import chalk8 from "chalk";
|
|
3
6
|
|
|
4
7
|
// src/lib/checkResult.ts
|
|
5
8
|
import chalk from "chalk";
|
|
6
|
-
var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
9
|
+
var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnFail = false) => {
|
|
7
10
|
if (result) {
|
|
8
11
|
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
9
12
|
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
@@ -12,17 +15,20 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
|
12
15
|
process.exit(result);
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
|
-
};
|
|
18
|
+
}, "checkResult");
|
|
16
19
|
|
|
17
20
|
// src/lib/deleteGlob.ts
|
|
18
21
|
import fs from "fs";
|
|
19
22
|
import { glob } from "glob";
|
|
20
|
-
var deleteGlob = (globPath) => {
|
|
23
|
+
var deleteGlob = /* @__PURE__ */ __name((globPath) => {
|
|
21
24
|
const files = glob.sync(globPath);
|
|
22
25
|
for (const file of files) {
|
|
23
|
-
fs.rmSync(file, {
|
|
26
|
+
fs.rmSync(file, {
|
|
27
|
+
recursive: true,
|
|
28
|
+
force: true
|
|
29
|
+
});
|
|
24
30
|
}
|
|
25
|
-
};
|
|
31
|
+
}, "deleteGlob");
|
|
26
32
|
|
|
27
33
|
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
28
34
|
import { execSync } from "child_process";
|
|
@@ -31,17 +37,17 @@ import { execSync } from "child_process";
|
|
|
31
37
|
import chalk2 from "chalk";
|
|
32
38
|
|
|
33
39
|
// src/lib/withError.ts
|
|
34
|
-
var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
40
|
+
var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
35
41
|
return predicate(ex) ? closure(ex) : void 0;
|
|
36
|
-
};
|
|
42
|
+
}, "withError");
|
|
37
43
|
|
|
38
44
|
// src/lib/withErrnoException.ts
|
|
39
|
-
var withErrnoException = (ex, closure) => {
|
|
45
|
+
var withErrnoException = /* @__PURE__ */ __name((ex, closure) => {
|
|
40
46
|
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
41
|
-
};
|
|
47
|
+
}, "withErrnoException");
|
|
42
48
|
|
|
43
49
|
// src/lib/processEx.ts
|
|
44
|
-
var processEx = (ex) => {
|
|
50
|
+
var processEx = /* @__PURE__ */ __name((ex) => {
|
|
45
51
|
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
46
52
|
const exitCode = withErrnoException(error, (error2) => {
|
|
47
53
|
if (error2.code === "ENOENT") {
|
|
@@ -58,10 +64,10 @@ var processEx = (ex) => {
|
|
|
58
64
|
return -1;
|
|
59
65
|
})();
|
|
60
66
|
process.exit(process.exitCode ?? exitCode);
|
|
61
|
-
};
|
|
67
|
+
}, "processEx");
|
|
62
68
|
|
|
63
69
|
// src/lib/safeExit.ts
|
|
64
|
-
var safeExit = (func, exitOnFail = true) => {
|
|
70
|
+
var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
65
71
|
try {
|
|
66
72
|
const result = func();
|
|
67
73
|
if (result && exitOnFail) {
|
|
@@ -71,8 +77,8 @@ var safeExit = (func, exitOnFail = true) => {
|
|
|
71
77
|
} catch (ex) {
|
|
72
78
|
return processEx(ex);
|
|
73
79
|
}
|
|
74
|
-
};
|
|
75
|
-
var safeExitAsync = async (func, exitOnFail = true) => {
|
|
80
|
+
}, "safeExit");
|
|
81
|
+
var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
|
|
76
82
|
try {
|
|
77
83
|
const result = await func();
|
|
78
84
|
if (result && exitOnFail) {
|
|
@@ -82,22 +88,22 @@ var safeExitAsync = async (func, exitOnFail = true) => {
|
|
|
82
88
|
} catch (ex) {
|
|
83
89
|
return processEx(ex);
|
|
84
90
|
}
|
|
85
|
-
};
|
|
91
|
+
}, "safeExitAsync");
|
|
86
92
|
|
|
87
93
|
// src/lib/dependencies/DuplicateDetector.ts
|
|
88
94
|
import { EOL } from "os";
|
|
89
95
|
import chalk3 from "chalk";
|
|
90
96
|
|
|
91
97
|
// src/lib/jsonFormatters.ts
|
|
92
|
-
var multiLineToJSONArray = (output) => {
|
|
98
|
+
var multiLineToJSONArray = /* @__PURE__ */ __name((output) => {
|
|
93
99
|
const withCommas = output.replaceAll("\r\n", "").replaceAll("\n", ",");
|
|
94
100
|
const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1));
|
|
95
101
|
const collection = `[${cleanCollection}]`;
|
|
96
102
|
return JSON.parse(collection);
|
|
97
|
-
};
|
|
103
|
+
}, "multiLineToJSONArray");
|
|
98
104
|
|
|
99
105
|
// src/lib/dependencies/DuplicateDetector.ts
|
|
100
|
-
var trimVirtualMeta = (value) => {
|
|
106
|
+
var trimVirtualMeta = /* @__PURE__ */ __name((value) => {
|
|
101
107
|
const virtualParts = value.split("virtual:");
|
|
102
108
|
if (virtualParts.length > 1) {
|
|
103
109
|
const hashParts = virtualParts[1].split("#");
|
|
@@ -105,8 +111,8 @@ var trimVirtualMeta = (value) => {
|
|
|
105
111
|
} else {
|
|
106
112
|
return value;
|
|
107
113
|
}
|
|
108
|
-
};
|
|
109
|
-
var trimObjectDependencyVirtualMeta = (obj) => {
|
|
114
|
+
}, "trimVirtualMeta");
|
|
115
|
+
var trimObjectDependencyVirtualMeta = /* @__PURE__ */ __name((obj) => {
|
|
110
116
|
const resultObj = {};
|
|
111
117
|
for (const [key, value] of Object.entries(obj)) {
|
|
112
118
|
resultObj[trimVirtualMeta(key)] = {
|
|
@@ -115,13 +121,19 @@ var trimObjectDependencyVirtualMeta = (obj) => {
|
|
|
115
121
|
};
|
|
116
122
|
}
|
|
117
123
|
return resultObj;
|
|
118
|
-
};
|
|
119
|
-
var trimDependencyVirtualMeta = (dependencies) => {
|
|
124
|
+
}, "trimObjectDependencyVirtualMeta");
|
|
125
|
+
var trimDependencyVirtualMeta = /* @__PURE__ */ __name((dependencies) => {
|
|
120
126
|
return dependencies.map((dependency) => {
|
|
121
|
-
return {
|
|
127
|
+
return {
|
|
128
|
+
children: trimObjectDependencyVirtualMeta(dependency.children),
|
|
129
|
+
value: trimVirtualMeta(dependency.value)
|
|
130
|
+
};
|
|
122
131
|
});
|
|
123
|
-
};
|
|
132
|
+
}, "trimDependencyVirtualMeta");
|
|
124
133
|
var DuplicateDetector = class {
|
|
134
|
+
static {
|
|
135
|
+
__name(this, "DuplicateDetector");
|
|
136
|
+
}
|
|
125
137
|
dependency;
|
|
126
138
|
dependencyEntries;
|
|
127
139
|
constructor(output, dependency) {
|
|
@@ -151,19 +163,21 @@ var DuplicateDetector = class {
|
|
|
151
163
|
acc.duplicateVersions.push(acc.currentVersion);
|
|
152
164
|
}
|
|
153
165
|
acc.duplicateVersions.push(version);
|
|
154
|
-
acc.duplicateVersions = [
|
|
166
|
+
acc.duplicateVersions = [
|
|
167
|
+
...new Set(acc.duplicateVersions)
|
|
168
|
+
];
|
|
155
169
|
}
|
|
156
170
|
return acc;
|
|
157
171
|
}
|
|
158
|
-
resultsFactory = (dependency) => ({
|
|
172
|
+
resultsFactory = /* @__PURE__ */ __name((dependency) => ({
|
|
159
173
|
currentVersion: void 0,
|
|
160
174
|
dependency,
|
|
161
175
|
duplicateVersions: []
|
|
162
|
-
});
|
|
176
|
+
}), "resultsFactory");
|
|
163
177
|
};
|
|
164
178
|
|
|
165
179
|
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
166
|
-
var detectDuplicateDependencies = (depsFromPackageJSON, DefaultDependencies2) => {
|
|
180
|
+
var detectDuplicateDependencies = /* @__PURE__ */ __name((depsFromPackageJSON, DefaultDependencies2) => {
|
|
167
181
|
let exitCode = 0;
|
|
168
182
|
const dependencies = depsFromPackageJSON?.length ? depsFromPackageJSON : DefaultDependencies2;
|
|
169
183
|
return safeExit(() => {
|
|
@@ -194,45 +208,51 @@ var detectDuplicateDependencies = (depsFromPackageJSON, DefaultDependencies2) =>
|
|
|
194
208
|
return exitCode;
|
|
195
209
|
}
|
|
196
210
|
});
|
|
197
|
-
};
|
|
211
|
+
}, "detectDuplicateDependencies");
|
|
198
212
|
|
|
199
213
|
// src/lib/file/constants.ts
|
|
200
214
|
var WINDOWS_NEWLINE_REGEX = /\r\n/g;
|
|
201
215
|
var CROSS_PLATFORM_NEWLINE = "\n";
|
|
202
216
|
|
|
203
217
|
// src/lib/file/fileLines.ts
|
|
204
|
-
import {
|
|
205
|
-
existsSync,
|
|
206
|
-
readFileSync,
|
|
207
|
-
writeFileSync
|
|
208
|
-
} from "fs";
|
|
218
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
209
219
|
|
|
210
220
|
// src/lib/string/empty.ts
|
|
211
|
-
var empty = (value) => value?.trim().length === 0;
|
|
212
|
-
var notEmpty = (value) => !empty(value);
|
|
221
|
+
var empty = /* @__PURE__ */ __name((value) => value?.trim().length === 0, "empty");
|
|
222
|
+
var notEmpty = /* @__PURE__ */ __name((value) => !empty(value), "notEmpty");
|
|
213
223
|
|
|
214
224
|
// src/lib/string/union.ts
|
|
215
|
-
var union = (a, b) => /* @__PURE__ */ new Set([
|
|
225
|
+
var union = /* @__PURE__ */ __name((a, b) => /* @__PURE__ */ new Set([
|
|
226
|
+
...new Set(a),
|
|
227
|
+
...new Set(b)
|
|
228
|
+
]), "union");
|
|
216
229
|
|
|
217
230
|
// src/lib/file/ReadFileSyncOptions.ts
|
|
218
|
-
var defaultReadFileSyncOptions = {
|
|
231
|
+
var defaultReadFileSyncOptions = {
|
|
232
|
+
encoding: "utf8"
|
|
233
|
+
};
|
|
219
234
|
|
|
220
235
|
// src/lib/file/fileLines.ts
|
|
221
|
-
var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [];
|
|
222
|
-
var readNonEmptyLines = (uri, options = defaultReadFileSyncOptions) => readLines(uri, options).filter(notEmpty);
|
|
223
|
-
var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
|
|
236
|
+
var readLines = /* @__PURE__ */ __name((uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [], "readLines");
|
|
237
|
+
var readNonEmptyLines = /* @__PURE__ */ __name((uri, options = defaultReadFileSyncOptions) => readLines(uri, options).filter(notEmpty), "readNonEmptyLines");
|
|
238
|
+
var writeLines = /* @__PURE__ */ __name((uri, lines, options = defaultReadFileSyncOptions) => {
|
|
224
239
|
const existing = existsSync(uri) ? readFileSync(uri, options) : void 0;
|
|
225
240
|
const desired = lines.join(CROSS_PLATFORM_NEWLINE);
|
|
226
241
|
if (existing !== desired) writeFileSync(uri, desired, options);
|
|
227
|
-
};
|
|
242
|
+
}, "writeLines");
|
|
228
243
|
|
|
229
244
|
// src/lib/generateIgnoreFiles.ts
|
|
230
245
|
import chalk4 from "chalk";
|
|
231
246
|
|
|
232
247
|
// src/lib/yarn/isYarnVersionOrGreater.ts
|
|
233
248
|
import { spawnSync } from "child_process";
|
|
234
|
-
var isYarnVersionOrGreater = (major, minor, patch) => {
|
|
235
|
-
const result = spawnSync("yarn", [
|
|
249
|
+
var isYarnVersionOrGreater = /* @__PURE__ */ __name((major, minor, patch) => {
|
|
250
|
+
const result = spawnSync("yarn", [
|
|
251
|
+
"-v"
|
|
252
|
+
], {
|
|
253
|
+
encoding: "utf8",
|
|
254
|
+
shell: true
|
|
255
|
+
});
|
|
236
256
|
const version = result.stdout.toString().replaceAll("\n", "");
|
|
237
257
|
const versionNumbers = version.split(".").map((ver) => Number.parseInt(ver));
|
|
238
258
|
const majorDelta = versionNumbers[0] - major;
|
|
@@ -241,46 +261,61 @@ var isYarnVersionOrGreater = (major, minor, patch) => {
|
|
|
241
261
|
const majorOk = majorDelta >= 0;
|
|
242
262
|
const minorOk = majorDelta > 0 || minorDelta >= 0;
|
|
243
263
|
const patchOk = majorDelta > 0 || minorDelta > 0 || patchDelta >= 0;
|
|
244
|
-
return [
|
|
245
|
-
|
|
264
|
+
return [
|
|
265
|
+
majorOk && minorOk && patchOk,
|
|
266
|
+
version
|
|
267
|
+
];
|
|
268
|
+
}, "isYarnVersionOrGreater");
|
|
246
269
|
|
|
247
270
|
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
248
271
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
249
|
-
var yarnWorkspaces = () => {
|
|
250
|
-
const result = spawnSync2("yarn", [
|
|
272
|
+
var yarnWorkspaces = /* @__PURE__ */ __name(() => {
|
|
273
|
+
const result = spawnSync2("yarn", [
|
|
274
|
+
"workspaces",
|
|
275
|
+
"list",
|
|
276
|
+
"--json",
|
|
277
|
+
"--recursive"
|
|
278
|
+
], {
|
|
279
|
+
encoding: "utf8",
|
|
280
|
+
shell: true
|
|
281
|
+
});
|
|
251
282
|
if (result.error) {
|
|
252
283
|
throw result.error;
|
|
253
284
|
}
|
|
254
285
|
return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
|
|
255
286
|
return JSON.parse(item);
|
|
256
287
|
});
|
|
257
|
-
};
|
|
288
|
+
}, "yarnWorkspaces");
|
|
258
289
|
|
|
259
290
|
// src/lib/yarn/workspace/yarnWorkspace.ts
|
|
260
|
-
var yarnWorkspace = (pkg) => {
|
|
291
|
+
var yarnWorkspace = /* @__PURE__ */ __name((pkg) => {
|
|
261
292
|
const workspace = yarnWorkspaces().find(({ name }) => name === pkg);
|
|
262
293
|
if (!workspace) throw new Error(`Workspace ${pkg} not found`);
|
|
263
294
|
return workspace;
|
|
264
|
-
};
|
|
295
|
+
}, "yarnWorkspace");
|
|
265
296
|
|
|
266
297
|
// src/lib/yarn/yarnInitCwd.ts
|
|
267
|
-
var INIT_CWD = () => {
|
|
298
|
+
var INIT_CWD = /* @__PURE__ */ __name(() => {
|
|
268
299
|
if (!process.env.INIT_CWD) console.error("Missing INIT_CWD");
|
|
269
300
|
return process.env.INIT_CWD;
|
|
270
|
-
};
|
|
301
|
+
}, "INIT_CWD");
|
|
271
302
|
|
|
272
303
|
// src/lib/generateIgnoreFiles.ts
|
|
273
|
-
var localeCompare = (a, b) => a.localeCompare(b);
|
|
274
|
-
var mergeEntries = (a, b) => [
|
|
275
|
-
|
|
304
|
+
var localeCompare = /* @__PURE__ */ __name((a, b) => a.localeCompare(b), "localeCompare");
|
|
305
|
+
var mergeEntries = /* @__PURE__ */ __name((a, b) => [
|
|
306
|
+
...union(a, b)
|
|
307
|
+
].sort(localeCompare), "mergeEntries");
|
|
308
|
+
var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
276
309
|
console.log(chalk4.green(`Generate ${filename3} Files`));
|
|
277
|
-
const
|
|
278
|
-
const workspaces = pkg ? [
|
|
279
|
-
|
|
280
|
-
|
|
310
|
+
const cwd5 = INIT_CWD() ?? ".";
|
|
311
|
+
const workspaces = pkg ? [
|
|
312
|
+
yarnWorkspace(pkg)
|
|
313
|
+
] : yarnWorkspaces();
|
|
314
|
+
const readEntries = /* @__PURE__ */ __name((location) => readNonEmptyLines(`${location}/${filename3}`), "readEntries");
|
|
315
|
+
const writeEntries = /* @__PURE__ */ __name((location, entries) => writeLines(`${location}/${filename3}`, entries), "writeEntries");
|
|
281
316
|
const results = workspaces.map(({ location, name }) => {
|
|
282
317
|
try {
|
|
283
|
-
writeEntries(location, mergeEntries(readEntries(
|
|
318
|
+
writeEntries(location, mergeEntries(readEntries(cwd5), readEntries(location)));
|
|
284
319
|
return 0;
|
|
285
320
|
} catch (ex) {
|
|
286
321
|
const error = ex;
|
|
@@ -290,7 +325,7 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
290
325
|
});
|
|
291
326
|
const succeeded = results.every((result) => result === 0);
|
|
292
327
|
return succeeded ? 0 : 1;
|
|
293
|
-
};
|
|
328
|
+
}, "generateIgnoreFiles");
|
|
294
329
|
|
|
295
330
|
// src/lib/loadConfig.ts
|
|
296
331
|
import chalk5 from "chalk";
|
|
@@ -298,32 +333,39 @@ import { cosmiconfig } from "cosmiconfig";
|
|
|
298
333
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
299
334
|
import deepmerge from "deepmerge";
|
|
300
335
|
var config;
|
|
301
|
-
var loadConfig = async (params) => {
|
|
302
|
-
if (config) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
336
|
+
var loadConfig = /* @__PURE__ */ __name(async (params) => {
|
|
337
|
+
if (config === void 0) {
|
|
338
|
+
const cosmicConfigResult = await cosmiconfig("xy", {
|
|
339
|
+
cache: true,
|
|
340
|
+
loaders: {
|
|
341
|
+
".ts": TypeScriptLoader()
|
|
342
|
+
}
|
|
343
|
+
}).search();
|
|
344
|
+
config = cosmicConfigResult?.config;
|
|
345
|
+
const configFilePath = cosmicConfigResult?.filepath;
|
|
346
|
+
if (configFilePath !== void 0) {
|
|
347
|
+
console.log(chalk5.green(`Loaded config from ${configFilePath}`));
|
|
348
|
+
if (config.verbose) {
|
|
349
|
+
console.log(chalk5.gray(`${JSON.stringify(config, null, 2)}`));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
310
352
|
}
|
|
311
353
|
return deepmerge(config, params ?? {});
|
|
312
|
-
};
|
|
354
|
+
}, "loadConfig");
|
|
313
355
|
|
|
314
356
|
// src/lib/parsedPackageJSON.ts
|
|
315
357
|
import { readFileSync as readFileSync2 } from "fs";
|
|
316
|
-
var parsedPackageJSON = (
|
|
317
|
-
const pathToPackageJSON =
|
|
358
|
+
var parsedPackageJSON = /* @__PURE__ */ __name((path11) => {
|
|
359
|
+
const pathToPackageJSON = path11 ?? process.env.npm_package_json ?? "";
|
|
318
360
|
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
319
361
|
return JSON.parse(packageJSON);
|
|
320
|
-
};
|
|
362
|
+
}, "parsedPackageJSON");
|
|
321
363
|
|
|
322
364
|
// src/lib/runSteps.ts
|
|
323
365
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
324
366
|
import { existsSync as existsSync2 } from "fs";
|
|
325
367
|
import chalk6 from "chalk";
|
|
326
|
-
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
368
|
+
var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages) => {
|
|
327
369
|
return safeExit(() => {
|
|
328
370
|
const pkgName = process.env.npm_package_name;
|
|
329
371
|
console.log(chalk6.green(`${name} [${pkgName}]`));
|
|
@@ -339,7 +381,10 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
339
381
|
const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
|
|
340
382
|
...config2,
|
|
341
383
|
encoding: "utf8",
|
|
342
|
-
env: {
|
|
384
|
+
env: {
|
|
385
|
+
FORCE_COLOR: "3",
|
|
386
|
+
...process.env
|
|
387
|
+
},
|
|
343
388
|
shell: true,
|
|
344
389
|
stdio: "inherit"
|
|
345
390
|
}).status ?? 0;
|
|
@@ -348,13 +393,13 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
348
393
|
}
|
|
349
394
|
return totalStatus;
|
|
350
395
|
}, !!exitOnFail);
|
|
351
|
-
};
|
|
396
|
+
}, "runSteps");
|
|
352
397
|
|
|
353
398
|
// src/lib/runStepsAsync.ts
|
|
354
399
|
import { spawn } from "child_process";
|
|
355
400
|
import { existsSync as existsSync3 } from "fs";
|
|
356
401
|
import chalk7 from "chalk";
|
|
357
|
-
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
402
|
+
var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, message) => {
|
|
358
403
|
return new Promise((resolve) => {
|
|
359
404
|
const [command, args, config2] = step;
|
|
360
405
|
if (message) {
|
|
@@ -366,18 +411,15 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
366
411
|
}
|
|
367
412
|
spawn(command, Array.isArray(args) ? args : args.split(" "), {
|
|
368
413
|
...config2,
|
|
369
|
-
env: {
|
|
414
|
+
env: {
|
|
415
|
+
FORCE_COLOR: "3",
|
|
416
|
+
...process.env
|
|
417
|
+
},
|
|
370
418
|
shell: true,
|
|
371
419
|
stdio: "inherit"
|
|
372
420
|
}).on("close", (code) => {
|
|
373
421
|
if (code) {
|
|
374
|
-
console.error(
|
|
375
|
-
chalk7.red(
|
|
376
|
-
`Command Exited With Non-Zero Result [${chalk7.gray(code)}] | ${chalk7.yellow(command)} ${chalk7.white(
|
|
377
|
-
Array.isArray(args) ? args.join(" ") : args
|
|
378
|
-
)}`
|
|
379
|
-
)
|
|
380
|
-
);
|
|
422
|
+
console.error(chalk7.red(`Command Exited With Non-Zero Result [${chalk7.gray(code)}] | ${chalk7.yellow(command)} ${chalk7.white(Array.isArray(args) ? args.join(" ") : args)}`));
|
|
381
423
|
checkResult(name, code, "error", exitOnFail);
|
|
382
424
|
resolve(code);
|
|
383
425
|
} else {
|
|
@@ -385,8 +427,8 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
385
427
|
}
|
|
386
428
|
});
|
|
387
429
|
});
|
|
388
|
-
};
|
|
389
|
-
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
430
|
+
}, "runStepAsync");
|
|
431
|
+
var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true, messages) => {
|
|
390
432
|
return await safeExitAsync(async () => {
|
|
391
433
|
const pkgName = process.env.npm_package_name;
|
|
392
434
|
console.log(chalk7.green(`${name} [${pkgName}]`));
|
|
@@ -396,67 +438,139 @@ var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
|
396
438
|
}
|
|
397
439
|
return result;
|
|
398
440
|
});
|
|
399
|
-
};
|
|
441
|
+
}, "runStepsAsync");
|
|
400
442
|
|
|
401
443
|
// src/actions/build.ts
|
|
402
|
-
var build = async ({
|
|
403
|
-
incremental,
|
|
404
|
-
jobs,
|
|
405
|
-
target,
|
|
406
|
-
verbose,
|
|
407
|
-
pkg
|
|
408
|
-
}) => {
|
|
444
|
+
var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose, pkg }) => {
|
|
409
445
|
const start = Date.now();
|
|
410
|
-
const pkgOptions = pkg === void 0 ? [] : [
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
const
|
|
414
|
-
|
|
446
|
+
const pkgOptions = pkg === void 0 ? [] : [
|
|
447
|
+
pkg
|
|
448
|
+
];
|
|
449
|
+
const incrementalOptions = incremental ? [
|
|
450
|
+
"-i"
|
|
451
|
+
] : [];
|
|
452
|
+
const verboseOptions = verbose ? [
|
|
453
|
+
"-v"
|
|
454
|
+
] : [];
|
|
455
|
+
const targetOptions = target === void 0 ? [] : [
|
|
456
|
+
"-t",
|
|
457
|
+
target
|
|
458
|
+
];
|
|
459
|
+
const jobsOptions = jobs === void 0 ? [] : [
|
|
460
|
+
"-j",
|
|
461
|
+
`${jobs}`
|
|
462
|
+
];
|
|
415
463
|
if (jobs !== void 0) {
|
|
416
464
|
console.log(chalk8.blue(`Jobs set to [${jobs}]`));
|
|
417
465
|
}
|
|
418
466
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
419
|
-
[
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
467
|
+
[
|
|
468
|
+
"yarn",
|
|
469
|
+
[
|
|
470
|
+
"xy",
|
|
471
|
+
"compile",
|
|
472
|
+
...pkgOptions,
|
|
473
|
+
...targetOptions,
|
|
474
|
+
...verboseOptions,
|
|
475
|
+
...jobsOptions,
|
|
476
|
+
...incrementalOptions,
|
|
477
|
+
"--types",
|
|
478
|
+
"tsup"
|
|
479
|
+
]
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
"yarn",
|
|
483
|
+
[
|
|
484
|
+
"xy",
|
|
485
|
+
"publint",
|
|
486
|
+
...pkgOptions,
|
|
487
|
+
...verboseOptions,
|
|
488
|
+
...jobsOptions,
|
|
489
|
+
...incrementalOptions
|
|
490
|
+
]
|
|
491
|
+
],
|
|
492
|
+
[
|
|
493
|
+
"yarn",
|
|
494
|
+
[
|
|
495
|
+
"xy",
|
|
496
|
+
"deplint",
|
|
497
|
+
...pkgOptions,
|
|
498
|
+
...verboseOptions,
|
|
499
|
+
...jobsOptions,
|
|
500
|
+
...incrementalOptions
|
|
501
|
+
]
|
|
502
|
+
],
|
|
503
|
+
[
|
|
504
|
+
"yarn",
|
|
505
|
+
[
|
|
506
|
+
"xy",
|
|
507
|
+
"lint",
|
|
508
|
+
...pkgOptions,
|
|
509
|
+
...verboseOptions,
|
|
510
|
+
...incrementalOptions
|
|
511
|
+
]
|
|
512
|
+
]
|
|
423
513
|
]);
|
|
424
514
|
console.log(`${chalk8.gray("Built in")} [${chalk8.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk8.gray("seconds")}`);
|
|
425
515
|
return result;
|
|
426
|
-
};
|
|
516
|
+
}, "build");
|
|
427
517
|
|
|
428
518
|
// src/actions/clean.ts
|
|
429
|
-
var clean = async ({ verbose, pkg }) => {
|
|
430
|
-
return pkg ? await cleanPackage({
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
519
|
+
var clean = /* @__PURE__ */ __name(async ({ verbose, pkg }) => {
|
|
520
|
+
return pkg ? await cleanPackage({
|
|
521
|
+
pkg,
|
|
522
|
+
verbose
|
|
523
|
+
}) : cleanAll({
|
|
524
|
+
verbose
|
|
525
|
+
});
|
|
526
|
+
}, "clean");
|
|
527
|
+
var cleanPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
528
|
+
return runStepsAsync(`Clean [${pkg}]`, [
|
|
529
|
+
[
|
|
530
|
+
"yarn",
|
|
531
|
+
[
|
|
532
|
+
"workspace",
|
|
533
|
+
pkg,
|
|
534
|
+
"run",
|
|
535
|
+
"package-clean"
|
|
536
|
+
]
|
|
537
|
+
]
|
|
538
|
+
]);
|
|
539
|
+
}, "cleanPackage");
|
|
540
|
+
var cleanAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
541
|
+
const verboseOptions = verbose ? [
|
|
542
|
+
"--verbose"
|
|
543
|
+
] : [
|
|
544
|
+
"--no-verbose"
|
|
545
|
+
];
|
|
546
|
+
return runStepsAsync("Clean", [
|
|
547
|
+
[
|
|
548
|
+
"yarn",
|
|
549
|
+
[
|
|
550
|
+
"workspaces foreach",
|
|
551
|
+
"-pA",
|
|
552
|
+
"--jobs 64",
|
|
553
|
+
...verboseOptions,
|
|
554
|
+
"run",
|
|
555
|
+
"package-clean"
|
|
556
|
+
]
|
|
557
|
+
]
|
|
558
|
+
]);
|
|
559
|
+
}, "cleanAll");
|
|
439
560
|
|
|
440
561
|
// src/actions/clean-docs.ts
|
|
441
562
|
import path from "path";
|
|
442
563
|
import chalk9 from "chalk";
|
|
443
|
-
var cleanDocs = () => {
|
|
564
|
+
var cleanDocs = /* @__PURE__ */ __name(() => {
|
|
444
565
|
const pkgName = process.env.npm_package_name;
|
|
445
566
|
console.log(chalk9.green(`Cleaning Docs [${pkgName}]`));
|
|
446
567
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
447
568
|
return 0;
|
|
448
|
-
};
|
|
569
|
+
}, "cleanDocs");
|
|
449
570
|
|
|
450
571
|
// src/actions/compile.ts
|
|
451
572
|
import chalk10 from "chalk";
|
|
452
|
-
var compile = ({
|
|
453
|
-
verbose,
|
|
454
|
-
target,
|
|
455
|
-
pkg,
|
|
456
|
-
incremental,
|
|
457
|
-
publint: publint2,
|
|
458
|
-
jobs
|
|
459
|
-
}) => {
|
|
573
|
+
var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint: publint2, jobs }) => {
|
|
460
574
|
return pkg ? compilePackage({
|
|
461
575
|
pkg,
|
|
462
576
|
publint: publint2,
|
|
@@ -469,114 +583,91 @@ var compile = ({
|
|
|
469
583
|
verbose,
|
|
470
584
|
jobs
|
|
471
585
|
});
|
|
472
|
-
};
|
|
473
|
-
var compilePackage = ({ target, pkg }) => {
|
|
474
|
-
const targetOptions = target ? [
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
586
|
+
}, "compile");
|
|
587
|
+
var compilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
|
|
588
|
+
const targetOptions = target ? [
|
|
589
|
+
"-t",
|
|
590
|
+
target
|
|
591
|
+
] : [];
|
|
592
|
+
return runSteps(`Compile [${pkg}]`, [
|
|
593
|
+
[
|
|
594
|
+
"yarn",
|
|
595
|
+
[
|
|
596
|
+
"workspace",
|
|
597
|
+
pkg,
|
|
598
|
+
"run",
|
|
599
|
+
"package-compile",
|
|
600
|
+
...targetOptions
|
|
601
|
+
]
|
|
602
|
+
]
|
|
603
|
+
]);
|
|
604
|
+
}, "compilePackage");
|
|
605
|
+
var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental }) => {
|
|
486
606
|
const start = Date.now();
|
|
487
|
-
const verboseOptions = verbose ? [
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
607
|
+
const verboseOptions = verbose ? [
|
|
608
|
+
"--verbose"
|
|
609
|
+
] : [
|
|
610
|
+
"--no-verbose"
|
|
611
|
+
];
|
|
612
|
+
const targetOptions = target ? [
|
|
613
|
+
"-t",
|
|
614
|
+
target
|
|
615
|
+
] : [];
|
|
616
|
+
const incrementalOptions = incremental ? [
|
|
617
|
+
"--since",
|
|
618
|
+
"-Apt",
|
|
619
|
+
"--topological-dev"
|
|
620
|
+
] : [
|
|
621
|
+
"--parallel",
|
|
622
|
+
"-Apt",
|
|
623
|
+
"--topological-dev"
|
|
624
|
+
];
|
|
625
|
+
const jobsOptions = jobs ? [
|
|
626
|
+
"-j",
|
|
627
|
+
`${jobs}`
|
|
628
|
+
] : [];
|
|
491
629
|
if (jobs) {
|
|
492
630
|
console.log(chalk10.blue(`Jobs set to [${jobs}]`));
|
|
493
631
|
}
|
|
494
632
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
495
|
-
[
|
|
496
|
-
"
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
633
|
+
[
|
|
634
|
+
"yarn",
|
|
635
|
+
[
|
|
636
|
+
"workspaces",
|
|
637
|
+
"foreach",
|
|
638
|
+
...incrementalOptions,
|
|
639
|
+
...jobsOptions,
|
|
640
|
+
...verboseOptions,
|
|
641
|
+
"run",
|
|
642
|
+
"package-compile",
|
|
643
|
+
...targetOptions
|
|
644
|
+
]
|
|
645
|
+
]
|
|
505
646
|
]);
|
|
506
647
|
console.log(`${chalk10.gray("Compiled in")} [${chalk10.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk10.gray("seconds")}`);
|
|
507
648
|
return result;
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
// src/actions/compile-types.ts
|
|
511
|
-
import chalk11 from "chalk";
|
|
512
|
-
var compileTypes = ({
|
|
513
|
-
verbose,
|
|
514
|
-
pkg,
|
|
515
|
-
incremental,
|
|
516
|
-
jobs
|
|
517
|
-
}) => {
|
|
518
|
-
if (verbose) {
|
|
519
|
-
console.log(chalk11.gray("Compiling Types"));
|
|
520
|
-
}
|
|
521
|
-
return pkg ? compileTypesPackage({ pkg, verbose }) : compileTypesAll({
|
|
522
|
-
incremental,
|
|
523
|
-
verbose,
|
|
524
|
-
jobs
|
|
525
|
-
});
|
|
526
|
-
};
|
|
527
|
-
var compileTypesPackage = ({ verbose, pkg }) => {
|
|
528
|
-
if (verbose) {
|
|
529
|
-
console.log(chalk11.gray("Compiling Types [Package]"));
|
|
530
|
-
}
|
|
531
|
-
return runSteps(
|
|
532
|
-
`Compile [${pkg}]`,
|
|
533
|
-
[["yarn", ["workspace", pkg, "run", "package-compile-types"]]]
|
|
534
|
-
);
|
|
535
|
-
};
|
|
536
|
-
var compileTypesAll = ({
|
|
537
|
-
jobs,
|
|
538
|
-
verbose,
|
|
539
|
-
incremental
|
|
540
|
-
}) => {
|
|
541
|
-
if (verbose) {
|
|
542
|
-
console.log(chalk11.gray("Compiling Types [All]"));
|
|
543
|
-
}
|
|
544
|
-
const start = Date.now();
|
|
545
|
-
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
546
|
-
const incrementalOptions = incremental ? ["--since", "-Apt"] : ["--parallel", "-Apt"];
|
|
547
|
-
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
548
|
-
if (jobs) {
|
|
549
|
-
console.log(chalk11.blue(`Jobs set to [${jobs}]`));
|
|
550
|
-
}
|
|
551
|
-
const result = runSteps(`Compile Types ${incremental ? "[Incremental]" : ""} [All]`, [
|
|
552
|
-
["yarn", [
|
|
553
|
-
"workspaces",
|
|
554
|
-
"foreach",
|
|
555
|
-
...incrementalOptions,
|
|
556
|
-
...jobsOptions,
|
|
557
|
-
...verboseOptions,
|
|
558
|
-
"run",
|
|
559
|
-
"package-compile-types"
|
|
560
|
-
]]
|
|
561
|
-
]);
|
|
562
|
-
console.log(`${chalk11.gray("Types Compiled in")} [${chalk11.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk11.gray("seconds")}`);
|
|
563
|
-
return result;
|
|
564
|
-
};
|
|
649
|
+
}, "compileAll");
|
|
565
650
|
|
|
566
651
|
// src/actions/copy-assets.ts
|
|
567
652
|
import path2 from "path/posix";
|
|
568
|
-
import
|
|
653
|
+
import chalk11 from "chalk";
|
|
569
654
|
import cpy from "cpy";
|
|
570
|
-
var copyPackageTargetAssets = async (target, name, location) => {
|
|
655
|
+
var copyPackageTargetAssets = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
571
656
|
try {
|
|
572
|
-
const values = await cpy(
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
657
|
+
const values = await cpy([
|
|
658
|
+
"**/*.jpg",
|
|
659
|
+
"**/*.png",
|
|
660
|
+
"**/*.gif",
|
|
661
|
+
"**/*.svg",
|
|
662
|
+
"**/*.webp",
|
|
663
|
+
"**/*.sass",
|
|
664
|
+
"**/*.scss",
|
|
665
|
+
"**/*.gif",
|
|
666
|
+
"**/*.css"
|
|
667
|
+
], `../dist/${target}`, {
|
|
668
|
+
cwd: path2.join(process.cwd(), location, "src"),
|
|
669
|
+
flat: false
|
|
670
|
+
});
|
|
580
671
|
for (const value of values) {
|
|
581
672
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
582
673
|
}
|
|
@@ -585,27 +676,25 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
585
676
|
console.log(`Copy Failed: ${name}: ${reason}`);
|
|
586
677
|
return 1;
|
|
587
678
|
}
|
|
588
|
-
};
|
|
589
|
-
var copyTargetAssets = async (target, pkg) => {
|
|
679
|
+
}, "copyPackageTargetAssets");
|
|
680
|
+
var copyTargetAssets = /* @__PURE__ */ __name(async (target, pkg) => {
|
|
590
681
|
const workspaces = yarnWorkspaces();
|
|
591
|
-
console.log(
|
|
682
|
+
console.log(chalk11.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
592
683
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
593
684
|
return pkg === void 0 || name === pkg;
|
|
594
685
|
});
|
|
595
686
|
if (workspaceList.length === 0) {
|
|
596
687
|
console.error(`Package not found [${pkg}]`);
|
|
597
688
|
} else {
|
|
598
|
-
const results = await Promise.all(
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
})
|
|
603
|
-
);
|
|
689
|
+
const results = await Promise.all(workspaceList.map(async (workspace) => {
|
|
690
|
+
const { location, name } = workspace;
|
|
691
|
+
return await copyPackageTargetAssets(target, name, location);
|
|
692
|
+
}));
|
|
604
693
|
return results.reduce((prev, result) => prev || result, 0);
|
|
605
694
|
}
|
|
606
695
|
return 0;
|
|
607
|
-
};
|
|
608
|
-
var copyAssets = async ({ target, pkg }) => {
|
|
696
|
+
}, "copyTargetAssets");
|
|
697
|
+
var copyAssets = /* @__PURE__ */ __name(async ({ target, pkg }) => {
|
|
609
698
|
switch (target) {
|
|
610
699
|
case "esm": {
|
|
611
700
|
return await copyTargetAssets("esm", pkg);
|
|
@@ -617,21 +706,38 @@ var copyAssets = async ({ target, pkg }) => {
|
|
|
617
706
|
return await copyTargetAssets("esm", pkg) || await copyTargetAssets("cjs", pkg);
|
|
618
707
|
}
|
|
619
708
|
}
|
|
620
|
-
};
|
|
709
|
+
}, "copyAssets");
|
|
621
710
|
|
|
622
711
|
// src/actions/cycle.ts
|
|
623
712
|
import { cruise } from "dependency-cruiser";
|
|
624
|
-
var cycle = async ({ verbose, pkg } = {}) => {
|
|
625
|
-
return pkg ? cyclePackage({
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
713
|
+
var cycle = /* @__PURE__ */ __name(async ({ verbose, pkg } = {}) => {
|
|
714
|
+
return pkg ? cyclePackage({
|
|
715
|
+
pkg,
|
|
716
|
+
verbose
|
|
717
|
+
}) : await cycleAll({
|
|
718
|
+
verbose
|
|
719
|
+
});
|
|
720
|
+
}, "cycle");
|
|
721
|
+
var cyclePackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
|
|
722
|
+
const verboseOptions = verbose ? [
|
|
723
|
+
"--verbose"
|
|
724
|
+
] : [
|
|
725
|
+
"--no-verbose"
|
|
726
|
+
];
|
|
727
|
+
return runSteps(`Cycle [${pkg}]`, [
|
|
728
|
+
[
|
|
729
|
+
"yarn",
|
|
730
|
+
[
|
|
731
|
+
"workspace",
|
|
732
|
+
pkg,
|
|
733
|
+
"run",
|
|
734
|
+
"package-cycle",
|
|
735
|
+
...verboseOptions
|
|
736
|
+
]
|
|
737
|
+
]
|
|
738
|
+
]);
|
|
739
|
+
}, "cyclePackage");
|
|
740
|
+
var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
635
741
|
const pkgName = process.env.npm_package_name;
|
|
636
742
|
const cruiseOptions = {
|
|
637
743
|
ruleSet: {
|
|
@@ -641,20 +747,26 @@ var cycleAll = async ({ verbose = false }) => {
|
|
|
641
747
|
severity: "error",
|
|
642
748
|
comment: "This dependency creates a circular reference",
|
|
643
749
|
from: {},
|
|
644
|
-
to: {
|
|
750
|
+
to: {
|
|
751
|
+
circular: true
|
|
752
|
+
}
|
|
645
753
|
}
|
|
646
754
|
]
|
|
647
755
|
},
|
|
648
756
|
exclude: "node_modules|packages/.*/packages",
|
|
649
757
|
validate: true,
|
|
650
|
-
doNotFollow: {
|
|
758
|
+
doNotFollow: {
|
|
759
|
+
path: "node_modules|packages/.*/packages"
|
|
760
|
+
},
|
|
651
761
|
tsPreCompilationDeps: false,
|
|
652
762
|
combinedDependencies: true,
|
|
653
763
|
outputType: verbose ? "text" : "err"
|
|
654
764
|
};
|
|
655
765
|
const target = "**/src";
|
|
656
766
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
657
|
-
const result = await cruise([
|
|
767
|
+
const result = await cruise([
|
|
768
|
+
target
|
|
769
|
+
], cruiseOptions);
|
|
658
770
|
if (result.output) {
|
|
659
771
|
console.log(result.output);
|
|
660
772
|
}
|
|
@@ -664,30 +776,52 @@ var cycleAll = async ({ verbose = false }) => {
|
|
|
664
776
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
665
777
|
}
|
|
666
778
|
return result.exitCode;
|
|
667
|
-
};
|
|
779
|
+
}, "cycleAll");
|
|
668
780
|
|
|
669
781
|
// src/actions/dead.ts
|
|
670
|
-
var dead = () => {
|
|
671
|
-
return runSteps("Dead", [
|
|
672
|
-
|
|
782
|
+
var dead = /* @__PURE__ */ __name(() => {
|
|
783
|
+
return runSteps("Dead", [
|
|
784
|
+
[
|
|
785
|
+
"yarn",
|
|
786
|
+
[
|
|
787
|
+
"ts-prune",
|
|
788
|
+
"-p",
|
|
789
|
+
"tsconfig.json"
|
|
790
|
+
]
|
|
791
|
+
]
|
|
792
|
+
]);
|
|
793
|
+
}, "dead");
|
|
673
794
|
|
|
674
795
|
// src/actions/deplint/deplint.ts
|
|
675
|
-
import
|
|
796
|
+
import chalk16 from "chalk";
|
|
676
797
|
|
|
677
798
|
// src/actions/deplint/findFilesByGlob.ts
|
|
678
799
|
import { globSync } from "glob";
|
|
679
|
-
function findFilesByGlob(
|
|
680
|
-
return globSync(pattern, {
|
|
800
|
+
function findFilesByGlob(cwd5, pattern) {
|
|
801
|
+
return globSync(pattern, {
|
|
802
|
+
cwd: cwd5,
|
|
803
|
+
absolute: true
|
|
804
|
+
});
|
|
681
805
|
}
|
|
806
|
+
__name(findFilesByGlob, "findFilesByGlob");
|
|
682
807
|
|
|
683
808
|
// src/actions/deplint/findFiles.ts
|
|
684
|
-
function findFiles(
|
|
685
|
-
const allSourceInclude = [
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
const
|
|
689
|
-
|
|
809
|
+
function findFiles(path11) {
|
|
810
|
+
const allSourceInclude = [
|
|
811
|
+
"./src/**/*.{ts,tsx}"
|
|
812
|
+
];
|
|
813
|
+
const allDistInclude = [
|
|
814
|
+
"./dist/**/*.d.ts",
|
|
815
|
+
"./dist/**/*.{mjs,js,cjs}"
|
|
816
|
+
];
|
|
817
|
+
const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path11, pattern));
|
|
818
|
+
const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path11, pattern));
|
|
819
|
+
return {
|
|
820
|
+
srcFiles,
|
|
821
|
+
distFiles
|
|
822
|
+
};
|
|
690
823
|
}
|
|
824
|
+
__name(findFiles, "findFiles");
|
|
691
825
|
|
|
692
826
|
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
693
827
|
import fs2 from "fs";
|
|
@@ -705,6 +839,7 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
705
839
|
peerDependencies
|
|
706
840
|
};
|
|
707
841
|
}
|
|
842
|
+
__name(getDependenciesFromPackageJson, "getDependenciesFromPackageJson");
|
|
708
843
|
|
|
709
844
|
// src/actions/deplint/getImportsFromFile.ts
|
|
710
845
|
import fs3 from "fs";
|
|
@@ -720,18 +855,13 @@ function getBasePackageName(importName) {
|
|
|
720
855
|
}
|
|
721
856
|
return importNameScrubbed.split("/")[0];
|
|
722
857
|
}
|
|
858
|
+
__name(getBasePackageName, "getBasePackageName");
|
|
723
859
|
|
|
724
860
|
// src/actions/deplint/getImportsFromFile.ts
|
|
725
861
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
726
862
|
const sourceCode = fs3.readFileSync(filePath, "utf8");
|
|
727
863
|
const isMjsFile = filePath.endsWith(".mjs");
|
|
728
|
-
const sourceFile = ts.createSourceFile(
|
|
729
|
-
path4.basename(filePath),
|
|
730
|
-
sourceCode,
|
|
731
|
-
ts.ScriptTarget.Latest,
|
|
732
|
-
true,
|
|
733
|
-
isMjsFile ? ts.ScriptKind.JS : void 0
|
|
734
|
-
);
|
|
864
|
+
const sourceFile = ts.createSourceFile(path4.basename(filePath), sourceCode, ts.ScriptTarget.Latest, true, isMjsFile ? ts.ScriptKind.JS : void 0);
|
|
735
865
|
const imports = [];
|
|
736
866
|
const typeImports = [];
|
|
737
867
|
const isDeclarationFile = filePath.endsWith(".d.ts");
|
|
@@ -756,8 +886,13 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
756
886
|
}
|
|
757
887
|
ts.forEachChild(node, visit);
|
|
758
888
|
}
|
|
889
|
+
__name(visit, "visit");
|
|
759
890
|
visit(sourceFile);
|
|
760
|
-
const importsStartsWithExcludes = [
|
|
891
|
+
const importsStartsWithExcludes = [
|
|
892
|
+
".",
|
|
893
|
+
"#",
|
|
894
|
+
"node:"
|
|
895
|
+
];
|
|
761
896
|
const cleanedImports = imports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
|
|
762
897
|
const cleanedTypeImports = typeImports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
|
|
763
898
|
for (const imp of cleanedImports) {
|
|
@@ -768,23 +903,31 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
768
903
|
typeImportPaths[imp] = typeImportPaths[imp] ?? [];
|
|
769
904
|
typeImportPaths[imp].push(filePath);
|
|
770
905
|
}
|
|
771
|
-
return [
|
|
906
|
+
return [
|
|
907
|
+
cleanedImports,
|
|
908
|
+
cleanedTypeImports
|
|
909
|
+
];
|
|
772
910
|
}
|
|
911
|
+
__name(getImportsFromFile, "getImportsFromFile");
|
|
773
912
|
|
|
774
913
|
// src/actions/deplint/getExternalImportsFromFiles.ts
|
|
775
|
-
var internalImportPrefixes = [
|
|
776
|
-
|
|
914
|
+
var internalImportPrefixes = [
|
|
915
|
+
".",
|
|
916
|
+
"#",
|
|
917
|
+
"node:"
|
|
918
|
+
];
|
|
919
|
+
var removeInternalImports = /* @__PURE__ */ __name((imports) => {
|
|
777
920
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
778
|
-
};
|
|
921
|
+
}, "removeInternalImports");
|
|
779
922
|
function getExternalImportsFromFiles({ srcFiles, distFiles }) {
|
|
780
923
|
const srcImportPaths = {};
|
|
781
924
|
const distImportPaths = {};
|
|
782
925
|
const distTypeImportPaths = {};
|
|
783
|
-
for (const
|
|
926
|
+
for (const path11 of srcFiles) getImportsFromFile(path11, srcImportPaths, srcImportPaths).flat();
|
|
784
927
|
const distTypeFiles = distFiles.filter((file) => file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts"));
|
|
785
928
|
const distCodeFiles = distFiles.filter((file) => !(file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts")));
|
|
786
|
-
for (const
|
|
787
|
-
for (const
|
|
929
|
+
for (const path11 of distCodeFiles) getImportsFromFile(path11, distImportPaths, distImportPaths).flat();
|
|
930
|
+
for (const path11 of distTypeFiles) getImportsFromFile(path11, distTypeImportPaths, distTypeImportPaths).flat();
|
|
788
931
|
const srcImports = Object.keys(srcImportPaths);
|
|
789
932
|
const distImports = Object.keys(distImportPaths);
|
|
790
933
|
const distTypeImports = Object.keys(distTypeImportPaths);
|
|
@@ -801,349 +944,469 @@ function getExternalImportsFromFiles({ srcFiles, distFiles }) {
|
|
|
801
944
|
externalDistTypeImports
|
|
802
945
|
};
|
|
803
946
|
}
|
|
947
|
+
__name(getExternalImportsFromFiles, "getExternalImportsFromFiles");
|
|
804
948
|
|
|
805
949
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
806
950
|
import { builtinModules } from "module";
|
|
807
|
-
import
|
|
808
|
-
function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, {
|
|
809
|
-
externalDistImports,
|
|
810
|
-
externalDistTypeImports,
|
|
811
|
-
distImportPaths
|
|
812
|
-
}) {
|
|
951
|
+
import chalk12 from "chalk";
|
|
952
|
+
function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, { externalDistImports, externalDistTypeImports, distImportPaths }) {
|
|
813
953
|
let unlistedDependencies = 0;
|
|
814
954
|
for (const imp of externalDistImports) {
|
|
815
|
-
if (!dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !builtinModules.includes(imp) && !builtinModules.includes(`@types/${imp}`)) {
|
|
955
|
+
if (!dependencies.includes(imp) && imp !== name && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !builtinModules.includes(imp) && !builtinModules.includes(`@types/${imp}`)) {
|
|
816
956
|
unlistedDependencies++;
|
|
817
|
-
console.log(`[${
|
|
957
|
+
console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
|
|
818
958
|
console.log(` ${distImportPaths[imp].join("\n ")}`);
|
|
819
959
|
}
|
|
820
960
|
}
|
|
821
961
|
for (const imp of externalDistTypeImports) {
|
|
822
|
-
if (!dependencies.includes(imp) && dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && peerDependencies.includes(`@types/${imp}`) && !builtinModules.includes(imp) && builtinModules.includes(`@types/${imp}`)) {
|
|
962
|
+
if (!dependencies.includes(imp) && imp !== name && dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && peerDependencies.includes(`@types/${imp}`) && !builtinModules.includes(imp) && builtinModules.includes(`@types/${imp}`)) {
|
|
823
963
|
unlistedDependencies++;
|
|
824
|
-
console.log(`[${
|
|
964
|
+
console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
|
|
825
965
|
console.log(` ${distImportPaths[imp].join("\n ")}`);
|
|
826
966
|
}
|
|
827
967
|
}
|
|
828
968
|
if (unlistedDependencies > 0) {
|
|
829
969
|
const packageLocation = `${location}/package.json`;
|
|
830
|
-
console.log(` ${
|
|
970
|
+
console.log(` ${chalk12.yellow(packageLocation)}
|
|
831
971
|
`);
|
|
832
972
|
}
|
|
833
973
|
return unlistedDependencies;
|
|
834
974
|
}
|
|
975
|
+
__name(getUnlistedDependencies, "getUnlistedDependencies");
|
|
835
976
|
|
|
836
977
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
837
978
|
import { builtinModules as builtinModules2 } from "module";
|
|
838
|
-
import
|
|
839
|
-
function getUnlistedDevDependencies({ name, location }, {
|
|
840
|
-
devDependencies,
|
|
841
|
-
dependencies,
|
|
842
|
-
peerDependencies
|
|
843
|
-
}, {
|
|
844
|
-
srcImportPaths,
|
|
845
|
-
externalSrcImports,
|
|
846
|
-
distImports
|
|
847
|
-
}) {
|
|
979
|
+
import chalk13 from "chalk";
|
|
980
|
+
function getUnlistedDevDependencies({ name, location }, { devDependencies, dependencies, peerDependencies }, { srcImportPaths, externalSrcImports, distImports }) {
|
|
848
981
|
let unlistedDevDependencies = 0;
|
|
849
982
|
for (const imp of externalSrcImports) {
|
|
850
|
-
if (!distImports.includes(imp) && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
983
|
+
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
851
984
|
unlistedDevDependencies++;
|
|
852
|
-
console.log(`[${
|
|
985
|
+
console.log(`[${chalk13.blue(name)}] Missing devDependency in package.json: ${chalk13.red(imp)}`);
|
|
853
986
|
console.log(` ${srcImportPaths[imp].join("\n ")}`);
|
|
854
987
|
}
|
|
855
988
|
}
|
|
856
989
|
if (unlistedDevDependencies > 0) {
|
|
857
990
|
const packageLocation = `${location}/package.json`;
|
|
858
|
-
console.log(` ${
|
|
991
|
+
console.log(` ${chalk13.yellow(packageLocation)}
|
|
859
992
|
`);
|
|
860
993
|
}
|
|
861
994
|
return unlistedDevDependencies;
|
|
862
995
|
}
|
|
996
|
+
__name(getUnlistedDevDependencies, "getUnlistedDevDependencies");
|
|
863
997
|
|
|
864
998
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
865
|
-
import
|
|
866
|
-
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
867
|
-
externalDistImports,
|
|
868
|
-
externalDistTypeImports,
|
|
869
|
-
externalSrcImports
|
|
870
|
-
}) {
|
|
999
|
+
import chalk14 from "chalk";
|
|
1000
|
+
function getUnusedDependencies({ name, location }, { dependencies }, { externalDistImports, externalDistTypeImports, externalSrcImports }) {
|
|
871
1001
|
let unusedDependencies = 0;
|
|
872
1002
|
for (const dep of dependencies) {
|
|
873
1003
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
874
1004
|
unusedDependencies++;
|
|
875
1005
|
if (externalSrcImports.includes(dep)) {
|
|
876
|
-
console.log(`[${
|
|
1006
|
+
console.log(`[${chalk14.blue(name)}] dependency should be devDependency in package.json: ${chalk14.red(dep)}`);
|
|
877
1007
|
} else {
|
|
878
|
-
console.log(`[${
|
|
1008
|
+
console.log(`[${chalk14.blue(name)}] Unused dependency in package.json: ${chalk14.red(dep)}`);
|
|
879
1009
|
}
|
|
880
1010
|
}
|
|
881
1011
|
}
|
|
882
1012
|
if (unusedDependencies > 0) {
|
|
883
1013
|
const packageLocation = `${location}/package.json`;
|
|
884
|
-
console.log(` ${
|
|
1014
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
885
1015
|
`);
|
|
886
1016
|
}
|
|
887
1017
|
return unusedDependencies;
|
|
888
1018
|
}
|
|
1019
|
+
__name(getUnusedDependencies, "getUnusedDependencies");
|
|
889
1020
|
|
|
890
1021
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
891
|
-
import
|
|
1022
|
+
import chalk15 from "chalk";
|
|
892
1023
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
893
1024
|
let unusedDependencies = 0;
|
|
894
1025
|
for (const dep of peerDependencies) {
|
|
895
1026
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
896
1027
|
unusedDependencies++;
|
|
897
1028
|
if (dependencies.includes(dep)) {
|
|
898
|
-
console.log(`[${
|
|
1029
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk15.red(dep)}`);
|
|
899
1030
|
} else {
|
|
900
|
-
console.log(`[${
|
|
1031
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency in package.json: ${chalk15.red(dep)}`);
|
|
901
1032
|
}
|
|
902
1033
|
}
|
|
903
1034
|
}
|
|
904
1035
|
if (unusedDependencies > 0) {
|
|
905
1036
|
const packageLocation = `${location}/package.json`;
|
|
906
|
-
console.log(` ${
|
|
1037
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
907
1038
|
`);
|
|
908
1039
|
}
|
|
909
1040
|
return unusedDependencies;
|
|
910
1041
|
}
|
|
1042
|
+
__name(getUnusedPeerDependencies, "getUnusedPeerDependencies");
|
|
911
1043
|
|
|
912
1044
|
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
913
|
-
function checkPackage({
|
|
914
|
-
name,
|
|
915
|
-
location,
|
|
916
|
-
deps = false,
|
|
917
|
-
devDeps = false,
|
|
918
|
-
peerDeps = false
|
|
919
|
-
}) {
|
|
1045
|
+
function checkPackage({ name, location, deps = false, devDeps = false, peerDeps = false, verbose = false }) {
|
|
920
1046
|
const { srcFiles, distFiles } = findFiles(location);
|
|
1047
|
+
if (verbose) {
|
|
1048
|
+
console.info(`Checking package: ${name} at ${location}`);
|
|
1049
|
+
console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}`);
|
|
1050
|
+
for (const file of srcFiles) {
|
|
1051
|
+
console.info(`Source file: ${file}`);
|
|
1052
|
+
}
|
|
1053
|
+
for (const file of distFiles) {
|
|
1054
|
+
console.info(`Distribution file: ${file}`);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
921
1057
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
922
1058
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
923
1059
|
const checkPeerDeps = peerDeps;
|
|
924
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
1060
|
+
const sourceParams = getExternalImportsFromFiles({
|
|
1061
|
+
srcFiles,
|
|
1062
|
+
distFiles
|
|
1063
|
+
});
|
|
925
1064
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
926
|
-
const unlistedDependencies = checkDeps ? getUnlistedDependencies({
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
1065
|
+
const unlistedDependencies = checkDeps ? getUnlistedDependencies({
|
|
1066
|
+
name,
|
|
1067
|
+
location
|
|
1068
|
+
}, packageParams, sourceParams) : 0;
|
|
1069
|
+
const unusedDependencies = checkDeps ? getUnusedDependencies({
|
|
1070
|
+
name,
|
|
1071
|
+
location
|
|
1072
|
+
}, packageParams, sourceParams) : 0;
|
|
1073
|
+
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({
|
|
1074
|
+
name,
|
|
1075
|
+
location
|
|
1076
|
+
}, packageParams, sourceParams) : 0;
|
|
1077
|
+
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({
|
|
1078
|
+
name,
|
|
1079
|
+
location
|
|
1080
|
+
}, packageParams, sourceParams) : 0;
|
|
930
1081
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
|
|
931
1082
|
return totalErrors;
|
|
932
1083
|
}
|
|
1084
|
+
__name(checkPackage, "checkPackage");
|
|
933
1085
|
|
|
934
1086
|
// src/actions/deplint/deplint.ts
|
|
935
|
-
var deplint = ({
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
devDeps,
|
|
939
|
-
peerDeps
|
|
940
|
-
}) => {
|
|
941
|
-
if (pkg) {
|
|
942
|
-
const { location, name } = yarnWorkspace(pkg);
|
|
943
|
-
console.log(`Running Deplint for ${name}`);
|
|
944
|
-
checkPackage({
|
|
945
|
-
name,
|
|
946
|
-
location,
|
|
947
|
-
devDeps,
|
|
948
|
-
deps,
|
|
949
|
-
peerDeps
|
|
950
|
-
});
|
|
951
|
-
} else {
|
|
1087
|
+
var deplint = /* @__PURE__ */ __name(({ pkg, deps, devDeps, peerDeps, verbose }) => {
|
|
1088
|
+
let totalErrors = 0;
|
|
1089
|
+
if (pkg === void 0) {
|
|
952
1090
|
const workspaces = yarnWorkspaces();
|
|
953
|
-
console.
|
|
954
|
-
let totalErrors = 0;
|
|
1091
|
+
console.info("Deplint Started...");
|
|
955
1092
|
for (const workspace of workspaces) {
|
|
956
1093
|
totalErrors += checkPackage({
|
|
957
1094
|
...workspace,
|
|
958
1095
|
deps,
|
|
959
1096
|
devDeps,
|
|
960
|
-
peerDeps
|
|
1097
|
+
peerDeps,
|
|
1098
|
+
verbose
|
|
961
1099
|
});
|
|
962
1100
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1101
|
+
} else {
|
|
1102
|
+
const { location, name } = yarnWorkspace(pkg);
|
|
1103
|
+
console.info(`Running Deplint for ${name}`);
|
|
1104
|
+
totalErrors += checkPackage({
|
|
1105
|
+
name,
|
|
1106
|
+
location,
|
|
1107
|
+
devDeps,
|
|
1108
|
+
deps,
|
|
1109
|
+
peerDeps,
|
|
1110
|
+
verbose
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
if (totalErrors > 0) {
|
|
1114
|
+
console.warn(`Deplint: Found ${chalk16.red(totalErrors)} dependency problems. ${chalk16.red("\u2716")}`);
|
|
1115
|
+
} else {
|
|
1116
|
+
console.info(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
|
|
968
1117
|
}
|
|
969
1118
|
return 0;
|
|
970
|
-
};
|
|
1119
|
+
}, "deplint");
|
|
971
1120
|
|
|
972
1121
|
// src/actions/deploy.ts
|
|
973
1122
|
import { readFileSync as readFileSync3 } from "fs";
|
|
974
|
-
var privatePackageExcludeList = () => {
|
|
1123
|
+
var privatePackageExcludeList = /* @__PURE__ */ __name(() => {
|
|
975
1124
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
976
1125
|
workspace,
|
|
977
|
-
JSON.parse(readFileSync3(`${workspace.location}/package.json`, {
|
|
1126
|
+
JSON.parse(readFileSync3(`${workspace.location}/package.json`, {
|
|
1127
|
+
encoding: "utf8"
|
|
1128
|
+
}))
|
|
978
1129
|
]);
|
|
979
1130
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
980
1131
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
981
1132
|
return excludeList;
|
|
982
|
-
};
|
|
983
|
-
var deploy = () => {
|
|
1133
|
+
}, "privatePackageExcludeList");
|
|
1134
|
+
var deploy = /* @__PURE__ */ __name(() => {
|
|
984
1135
|
const excludeList = privatePackageExcludeList();
|
|
985
1136
|
if (excludeList.length > 0) {
|
|
986
1137
|
console.log("Excluding private packages from deployment:", excludeList);
|
|
987
1138
|
}
|
|
988
1139
|
return runSteps("Deploy [Patch]", [
|
|
989
|
-
[
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
[
|
|
1140
|
+
[
|
|
1141
|
+
"yarn",
|
|
1142
|
+
"workspaces foreach --all version patch --deferred"
|
|
1143
|
+
],
|
|
1144
|
+
[
|
|
1145
|
+
"yarn",
|
|
1146
|
+
"xy clean"
|
|
1147
|
+
],
|
|
1148
|
+
[
|
|
1149
|
+
"yarn",
|
|
1150
|
+
"xy build"
|
|
1151
|
+
],
|
|
1152
|
+
[
|
|
1153
|
+
"yarn",
|
|
1154
|
+
"version apply --all"
|
|
1155
|
+
],
|
|
1156
|
+
[
|
|
1157
|
+
"yarn",
|
|
1158
|
+
`workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`
|
|
1159
|
+
]
|
|
994
1160
|
]);
|
|
995
|
-
};
|
|
1161
|
+
}, "deploy");
|
|
996
1162
|
|
|
997
1163
|
// src/actions/deploy-major.ts
|
|
998
1164
|
import { readFileSync as readFileSync4 } from "fs";
|
|
999
|
-
var privatePackageExcludeList2 = () => {
|
|
1165
|
+
var privatePackageExcludeList2 = /* @__PURE__ */ __name(() => {
|
|
1000
1166
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1001
1167
|
workspace,
|
|
1002
|
-
JSON.parse(readFileSync4(`${workspace.location}/package.json`, {
|
|
1168
|
+
JSON.parse(readFileSync4(`${workspace.location}/package.json`, {
|
|
1169
|
+
encoding: "utf8"
|
|
1170
|
+
}))
|
|
1003
1171
|
]);
|
|
1004
1172
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1005
1173
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1006
1174
|
return excludeList;
|
|
1007
|
-
};
|
|
1008
|
-
var deployMajor = () => {
|
|
1175
|
+
}, "privatePackageExcludeList");
|
|
1176
|
+
var deployMajor = /* @__PURE__ */ __name(() => {
|
|
1009
1177
|
const excludeList = privatePackageExcludeList2();
|
|
1010
1178
|
if (excludeList.length > 0) {
|
|
1011
1179
|
console.log("Excluding private packages from deployment:", excludeList);
|
|
1012
1180
|
}
|
|
1013
1181
|
return runSteps("Deploy [Major]", [
|
|
1014
|
-
[
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
[
|
|
1182
|
+
[
|
|
1183
|
+
"yarn",
|
|
1184
|
+
"workspaces foreach --all version major --deferred"
|
|
1185
|
+
],
|
|
1186
|
+
[
|
|
1187
|
+
"yarn",
|
|
1188
|
+
"xy clean"
|
|
1189
|
+
],
|
|
1190
|
+
[
|
|
1191
|
+
"yarn",
|
|
1192
|
+
"xy build"
|
|
1193
|
+
],
|
|
1194
|
+
[
|
|
1195
|
+
"yarn",
|
|
1196
|
+
"version apply --all"
|
|
1197
|
+
],
|
|
1198
|
+
[
|
|
1199
|
+
"yarn",
|
|
1200
|
+
`workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`
|
|
1201
|
+
]
|
|
1019
1202
|
]);
|
|
1020
|
-
};
|
|
1203
|
+
}, "deployMajor");
|
|
1021
1204
|
|
|
1022
1205
|
// src/actions/deploy-minor.ts
|
|
1023
1206
|
import { readFileSync as readFileSync5 } from "fs";
|
|
1024
|
-
var privatePackageExcludeList3 = () => {
|
|
1207
|
+
var privatePackageExcludeList3 = /* @__PURE__ */ __name(() => {
|
|
1025
1208
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1026
1209
|
workspace,
|
|
1027
|
-
JSON.parse(readFileSync5(`${workspace.location}/package.json`, {
|
|
1210
|
+
JSON.parse(readFileSync5(`${workspace.location}/package.json`, {
|
|
1211
|
+
encoding: "utf8"
|
|
1212
|
+
}))
|
|
1028
1213
|
]);
|
|
1029
1214
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1030
1215
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1031
1216
|
return excludeList;
|
|
1032
|
-
};
|
|
1033
|
-
var deployMinor = () => {
|
|
1217
|
+
}, "privatePackageExcludeList");
|
|
1218
|
+
var deployMinor = /* @__PURE__ */ __name(() => {
|
|
1034
1219
|
const excludeList = privatePackageExcludeList3();
|
|
1035
1220
|
if (excludeList.length > 0) {
|
|
1036
1221
|
console.log("Excluding private packages from deployment:", excludeList);
|
|
1037
1222
|
}
|
|
1038
1223
|
return runSteps("Deploy [Minor]", [
|
|
1039
|
-
[
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
[
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1224
|
+
[
|
|
1225
|
+
"yarn",
|
|
1226
|
+
"workspaces foreach --all version minor --deferred"
|
|
1227
|
+
],
|
|
1228
|
+
[
|
|
1229
|
+
"yarn",
|
|
1230
|
+
"xy clean"
|
|
1231
|
+
],
|
|
1232
|
+
[
|
|
1233
|
+
"yarn",
|
|
1234
|
+
"xy build"
|
|
1235
|
+
],
|
|
1236
|
+
[
|
|
1237
|
+
"yarn",
|
|
1238
|
+
"version apply --all"
|
|
1239
|
+
],
|
|
1240
|
+
[
|
|
1241
|
+
"yarn",
|
|
1242
|
+
`workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`
|
|
1243
|
+
]
|
|
1244
|
+
]);
|
|
1245
|
+
}, "deployMinor");
|
|
1246
|
+
|
|
1247
|
+
// src/actions/deploy-next.ts
|
|
1248
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
1249
|
+
var privatePackageExcludeList4 = /* @__PURE__ */ __name(() => {
|
|
1250
|
+
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1251
|
+
workspace,
|
|
1252
|
+
JSON.parse(readFileSync6(`${workspace.location}/package.json`, {
|
|
1253
|
+
encoding: "utf8"
|
|
1254
|
+
}))
|
|
1255
|
+
]);
|
|
1256
|
+
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1257
|
+
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1258
|
+
return excludeList;
|
|
1259
|
+
}, "privatePackageExcludeList");
|
|
1260
|
+
var deployNext = /* @__PURE__ */ __name(() => {
|
|
1261
|
+
const excludeList = privatePackageExcludeList4();
|
|
1262
|
+
if (excludeList.length > 0) {
|
|
1061
1263
|
console.log("Excluding private packages from deployment:", excludeList);
|
|
1062
1264
|
}
|
|
1063
1265
|
return runSteps("Deploy [Next]", [
|
|
1064
|
-
[
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
[
|
|
1266
|
+
[
|
|
1267
|
+
"yarn",
|
|
1268
|
+
"workspaces foreach --all version minor --deferred"
|
|
1269
|
+
],
|
|
1270
|
+
[
|
|
1271
|
+
"yarn",
|
|
1272
|
+
"xy clean"
|
|
1273
|
+
],
|
|
1274
|
+
[
|
|
1275
|
+
"yarn",
|
|
1276
|
+
"xy build"
|
|
1277
|
+
],
|
|
1278
|
+
[
|
|
1279
|
+
"yarn",
|
|
1280
|
+
"version apply --all --prerelease"
|
|
1281
|
+
],
|
|
1282
|
+
[
|
|
1283
|
+
"yarn",
|
|
1284
|
+
`workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish --tag next`
|
|
1285
|
+
]
|
|
1069
1286
|
]);
|
|
1070
|
-
};
|
|
1287
|
+
}, "deployNext");
|
|
1071
1288
|
|
|
1072
1289
|
// src/actions/dupdeps.ts
|
|
1073
|
-
import
|
|
1074
|
-
var dupdeps = () => {
|
|
1075
|
-
console.log(
|
|
1290
|
+
import chalk17 from "chalk";
|
|
1291
|
+
var dupdeps = /* @__PURE__ */ __name(() => {
|
|
1292
|
+
console.log(chalk17.green("Checking all Dependencies for Duplicates"));
|
|
1076
1293
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1077
1294
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1078
1295
|
return detectDuplicateDependencies(dependencies);
|
|
1079
|
-
};
|
|
1296
|
+
}, "dupdeps");
|
|
1080
1297
|
|
|
1081
1298
|
// src/actions/lint.ts
|
|
1082
|
-
import
|
|
1083
|
-
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
1084
|
-
console.log(
|
|
1299
|
+
import chalk18 from "chalk";
|
|
1300
|
+
var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
|
|
1301
|
+
console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1085
1302
|
const start = Date.now();
|
|
1086
1303
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1087
|
-
[
|
|
1088
|
-
"
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1304
|
+
[
|
|
1305
|
+
"yarn",
|
|
1306
|
+
[
|
|
1307
|
+
"workspace",
|
|
1308
|
+
pkg,
|
|
1309
|
+
"run",
|
|
1310
|
+
fix2 ? "package-fix" : "package-lint"
|
|
1311
|
+
]
|
|
1312
|
+
]
|
|
1093
1313
|
]);
|
|
1094
|
-
console.log(
|
|
1314
|
+
console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
|
|
1095
1315
|
return result;
|
|
1096
|
-
};
|
|
1097
|
-
var lint = ({
|
|
1098
|
-
pkg,
|
|
1099
|
-
verbose,
|
|
1100
|
-
incremental,
|
|
1101
|
-
fix: fix2
|
|
1102
|
-
} = {}) => {
|
|
1316
|
+
}, "lintPackage");
|
|
1317
|
+
var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
1103
1318
|
return pkg === void 0 ? lintAllPackages({
|
|
1104
1319
|
verbose,
|
|
1105
1320
|
incremental,
|
|
1106
1321
|
fix: fix2
|
|
1107
|
-
}) : lintPackage({
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1322
|
+
}) : lintPackage({
|
|
1323
|
+
pkg,
|
|
1324
|
+
fix: fix2
|
|
1325
|
+
});
|
|
1326
|
+
}, "lint");
|
|
1327
|
+
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2 = false } = {}) => {
|
|
1328
|
+
console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1111
1329
|
const start = Date.now();
|
|
1112
|
-
const fixOptions = fix2 ? [
|
|
1330
|
+
const fixOptions = fix2 ? [
|
|
1331
|
+
"--fix"
|
|
1332
|
+
] : [];
|
|
1113
1333
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1114
|
-
[
|
|
1334
|
+
[
|
|
1335
|
+
"yarn",
|
|
1336
|
+
[
|
|
1337
|
+
"eslint",
|
|
1338
|
+
...fixOptions
|
|
1339
|
+
]
|
|
1340
|
+
]
|
|
1115
1341
|
]);
|
|
1116
|
-
console.log(
|
|
1342
|
+
console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
|
|
1117
1343
|
return result;
|
|
1118
|
-
};
|
|
1344
|
+
}, "lintAllPackages");
|
|
1119
1345
|
|
|
1120
1346
|
// src/actions/fix.ts
|
|
1121
|
-
var fix = (params) => {
|
|
1122
|
-
return lint({
|
|
1123
|
-
|
|
1347
|
+
var fix = /* @__PURE__ */ __name((params) => {
|
|
1348
|
+
return lint({
|
|
1349
|
+
...params,
|
|
1350
|
+
fix: true
|
|
1351
|
+
});
|
|
1352
|
+
}, "fix");
|
|
1124
1353
|
|
|
1125
1354
|
// src/actions/gen-docs.ts
|
|
1126
|
-
var genDocs = ({ pkg, incremental }) => {
|
|
1127
|
-
return pkg ? genDocsPackage({
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
};
|
|
1133
|
-
var
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1355
|
+
var genDocs = /* @__PURE__ */ __name(({ pkg, incremental }) => {
|
|
1356
|
+
return pkg ? genDocsPackage({
|
|
1357
|
+
pkg
|
|
1358
|
+
}) : genDocsAll({
|
|
1359
|
+
incremental
|
|
1360
|
+
});
|
|
1361
|
+
}, "genDocs");
|
|
1362
|
+
var genDocsPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
1363
|
+
const steps = [
|
|
1364
|
+
[
|
|
1365
|
+
"yarn",
|
|
1366
|
+
[
|
|
1367
|
+
"workspace",
|
|
1368
|
+
pkg,
|
|
1369
|
+
"run",
|
|
1370
|
+
"package-gen-docs"
|
|
1371
|
+
]
|
|
1372
|
+
]
|
|
1373
|
+
];
|
|
1374
|
+
return runSteps(`GenDocs [${pkg}]`, [
|
|
1375
|
+
...steps
|
|
1376
|
+
]);
|
|
1377
|
+
}, "genDocsPackage");
|
|
1378
|
+
var genDocsAll = /* @__PURE__ */ __name(({ incremental }) => {
|
|
1379
|
+
const incrementalOptions = incremental ? [
|
|
1380
|
+
"--since",
|
|
1381
|
+
"-pA"
|
|
1382
|
+
] : [
|
|
1383
|
+
"-pA"
|
|
1384
|
+
];
|
|
1385
|
+
const steps = [
|
|
1386
|
+
[
|
|
1387
|
+
"yarn",
|
|
1388
|
+
[
|
|
1389
|
+
"workspaces",
|
|
1390
|
+
"foreach",
|
|
1391
|
+
...incrementalOptions,
|
|
1392
|
+
"run",
|
|
1393
|
+
"package-gen-docs"
|
|
1394
|
+
]
|
|
1395
|
+
]
|
|
1396
|
+
];
|
|
1397
|
+
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [
|
|
1398
|
+
...steps
|
|
1399
|
+
]);
|
|
1400
|
+
}, "genDocsAll");
|
|
1138
1401
|
|
|
1139
1402
|
// src/actions/gitignore-gen.ts
|
|
1140
1403
|
var filename = ".gitignore";
|
|
1141
|
-
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1404
|
+
var gitignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename, pkg), "gitignoreGen");
|
|
1142
1405
|
|
|
1143
1406
|
// src/actions/gitlint.ts
|
|
1144
|
-
import
|
|
1407
|
+
import chalk19 from "chalk";
|
|
1145
1408
|
import ParseGitConfig from "parse-git-config";
|
|
1146
|
-
var gitlint = () => {
|
|
1409
|
+
var gitlint = /* @__PURE__ */ __name(() => {
|
|
1147
1410
|
console.log(`
|
|
1148
1411
|
Gitlint Start [${process.cwd()}]
|
|
1149
1412
|
`);
|
|
@@ -1151,10 +1414,10 @@ Gitlint Start [${process.cwd()}]
|
|
|
1151
1414
|
let warnings = 0;
|
|
1152
1415
|
const errors = 0;
|
|
1153
1416
|
const gitConfig = ParseGitConfig.sync();
|
|
1154
|
-
const warn = (message) => {
|
|
1155
|
-
console.warn(
|
|
1417
|
+
const warn = /* @__PURE__ */ __name((message) => {
|
|
1418
|
+
console.warn(chalk19.yellow(`Warning: ${message}`));
|
|
1156
1419
|
warnings++;
|
|
1157
|
-
};
|
|
1420
|
+
}, "warn");
|
|
1158
1421
|
if (gitConfig.core.ignorecase) {
|
|
1159
1422
|
warn("Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]");
|
|
1160
1423
|
} else {
|
|
@@ -1172,52 +1435,67 @@ Gitlint Start [${process.cwd()}]
|
|
|
1172
1435
|
}
|
|
1173
1436
|
const resultMessages = [];
|
|
1174
1437
|
if (valid > 0) {
|
|
1175
|
-
resultMessages.push(
|
|
1438
|
+
resultMessages.push(chalk19.green(`Passed: ${valid}`));
|
|
1176
1439
|
}
|
|
1177
1440
|
if (warnings > 0) {
|
|
1178
|
-
resultMessages.push(
|
|
1441
|
+
resultMessages.push(chalk19.yellow(`Warnings: ${warnings}`));
|
|
1179
1442
|
}
|
|
1180
1443
|
if (errors > 0) {
|
|
1181
|
-
resultMessages.push(
|
|
1444
|
+
resultMessages.push(chalk19.red(` Errors: ${errors}`));
|
|
1182
1445
|
}
|
|
1183
1446
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1184
1447
|
`);
|
|
1185
1448
|
return warnings + errors === 0 ? 1 : 0;
|
|
1186
|
-
};
|
|
1449
|
+
}, "gitlint");
|
|
1187
1450
|
|
|
1188
1451
|
// src/actions/gitlint-fix.ts
|
|
1189
1452
|
import { execSync as execSync2 } from "child_process";
|
|
1190
|
-
import
|
|
1453
|
+
import chalk20 from "chalk";
|
|
1191
1454
|
import ParseGitConfig2 from "parse-git-config";
|
|
1192
|
-
var gitlintFix = () => {
|
|
1455
|
+
var gitlintFix = /* @__PURE__ */ __name(() => {
|
|
1193
1456
|
console.log(`
|
|
1194
1457
|
Gitlint Fix Start [${process.cwd()}]
|
|
1195
1458
|
`);
|
|
1196
1459
|
const gitConfig = ParseGitConfig2.sync();
|
|
1197
1460
|
if (gitConfig.core.ignorecase) {
|
|
1198
|
-
execSync2("git config core.ignorecase false", {
|
|
1199
|
-
|
|
1461
|
+
execSync2("git config core.ignorecase false", {
|
|
1462
|
+
stdio: "inherit"
|
|
1463
|
+
});
|
|
1464
|
+
console.warn(chalk20.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1200
1465
|
}
|
|
1201
1466
|
if (gitConfig.core.autocrlf !== false) {
|
|
1202
|
-
execSync2("git config core.autocrlf false", {
|
|
1203
|
-
|
|
1467
|
+
execSync2("git config core.autocrlf false", {
|
|
1468
|
+
stdio: "inherit"
|
|
1469
|
+
});
|
|
1470
|
+
console.warn(chalk20.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1204
1471
|
}
|
|
1205
1472
|
if (gitConfig.core.eol !== "lf") {
|
|
1206
|
-
execSync2("git config core.eol lf", {
|
|
1207
|
-
|
|
1473
|
+
execSync2("git config core.eol lf", {
|
|
1474
|
+
stdio: "inherit"
|
|
1475
|
+
});
|
|
1476
|
+
console.warn(chalk20.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1208
1477
|
}
|
|
1209
1478
|
return 1;
|
|
1210
|
-
};
|
|
1479
|
+
}, "gitlintFix");
|
|
1211
1480
|
|
|
1212
1481
|
// src/actions/knip.ts
|
|
1213
|
-
var knip = () => {
|
|
1214
|
-
return runSteps("Knip", [
|
|
1215
|
-
|
|
1482
|
+
var knip = /* @__PURE__ */ __name(() => {
|
|
1483
|
+
return runSteps("Knip", [
|
|
1484
|
+
[
|
|
1485
|
+
"yarn",
|
|
1486
|
+
[
|
|
1487
|
+
"knip",
|
|
1488
|
+
"--dependencies",
|
|
1489
|
+
"--no-exit-code"
|
|
1490
|
+
]
|
|
1491
|
+
]
|
|
1492
|
+
]);
|
|
1493
|
+
}, "knip");
|
|
1216
1494
|
|
|
1217
1495
|
// src/actions/license.ts
|
|
1218
|
-
import
|
|
1496
|
+
import chalk21 from "chalk";
|
|
1219
1497
|
import { init } from "license-checker";
|
|
1220
|
-
var license = async (pkg) => {
|
|
1498
|
+
var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
1221
1499
|
const workspaces = yarnWorkspaces();
|
|
1222
1500
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1223
1501
|
return pkg === void 0 || name === pkg;
|
|
@@ -1240,150 +1518,144 @@ var license = async (pkg) => {
|
|
|
1240
1518
|
"LGPL-3.0-or-later",
|
|
1241
1519
|
"Python-2.0"
|
|
1242
1520
|
]);
|
|
1243
|
-
console.log(
|
|
1244
|
-
return (await Promise.all(
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
if (
|
|
1269
|
-
|
|
1270
|
-
console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1521
|
+
console.log(chalk21.green("License Checker"));
|
|
1522
|
+
return (await Promise.all(workspaceList.map(({ location, name }) => {
|
|
1523
|
+
return new Promise((resolve) => {
|
|
1524
|
+
init({
|
|
1525
|
+
production: true,
|
|
1526
|
+
start: location
|
|
1527
|
+
}, (error, packages) => {
|
|
1528
|
+
if (error) {
|
|
1529
|
+
console.error(chalk21.red(`License Checker [${name}] Error`));
|
|
1530
|
+
console.error(chalk21.gray(error));
|
|
1531
|
+
console.log("\n");
|
|
1532
|
+
resolve(1);
|
|
1533
|
+
} else {
|
|
1534
|
+
console.log(chalk21.green(`License Checker [${name}]`));
|
|
1535
|
+
let count = 0;
|
|
1536
|
+
for (const [name2, info] of Object.entries(packages)) {
|
|
1537
|
+
const licenses = Array.isArray(info.licenses) ? info.licenses : [
|
|
1538
|
+
info.licenses
|
|
1539
|
+
];
|
|
1540
|
+
for (let license2 of licenses) {
|
|
1541
|
+
if (license2) {
|
|
1542
|
+
const processedLicense = license2[0] === "(" && license2.at(-1) === ")" ? license2.slice(1, -2) : license2;
|
|
1543
|
+
const orLicenses = processedLicense.split(" OR ");
|
|
1544
|
+
let orLicenseFound = false;
|
|
1545
|
+
for (const orLicense of orLicenses) {
|
|
1546
|
+
if (exclude.has(orLicense)) {
|
|
1547
|
+
orLicenseFound = true;
|
|
1271
1548
|
}
|
|
1272
1549
|
}
|
|
1550
|
+
if (!orLicenseFound) {
|
|
1551
|
+
count++;
|
|
1552
|
+
console.warn(chalk21.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1553
|
+
}
|
|
1273
1554
|
}
|
|
1274
1555
|
}
|
|
1275
|
-
console.log("\n");
|
|
1276
|
-
resolve(count);
|
|
1277
1556
|
}
|
|
1278
|
-
|
|
1557
|
+
console.log("\n");
|
|
1558
|
+
resolve(count);
|
|
1559
|
+
}
|
|
1279
1560
|
});
|
|
1280
|
-
})
|
|
1281
|
-
)).reduce((prev, value) => prev || value, 0);
|
|
1282
|
-
};
|
|
1561
|
+
});
|
|
1562
|
+
}))).reduce((prev, value) => prev || value, 0);
|
|
1563
|
+
}, "license");
|
|
1283
1564
|
|
|
1284
1565
|
// src/actions/npmignore-gen.ts
|
|
1285
1566
|
var filename2 = ".npmignore";
|
|
1286
|
-
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1567
|
+
var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2, pkg), "npmignoreGen");
|
|
1287
1568
|
|
|
1288
1569
|
// src/actions/package/clean-outputs.ts
|
|
1289
1570
|
import path5 from "path";
|
|
1290
|
-
import
|
|
1291
|
-
var packageCleanOutputs = () => {
|
|
1571
|
+
import chalk22 from "chalk";
|
|
1572
|
+
var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
1292
1573
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1293
1574
|
const pkgName = process.env.npm_package_name;
|
|
1294
|
-
const folders = [
|
|
1295
|
-
|
|
1575
|
+
const folders = [
|
|
1576
|
+
path5.join(pkg, "dist"),
|
|
1577
|
+
path5.join(pkg, "build"),
|
|
1578
|
+
path5.join(pkg, "docs")
|
|
1579
|
+
];
|
|
1580
|
+
console.log(chalk22.green(`Cleaning Outputs [${pkgName}]`));
|
|
1296
1581
|
for (let folder of folders) {
|
|
1297
1582
|
deleteGlob(folder);
|
|
1298
1583
|
}
|
|
1299
1584
|
return 0;
|
|
1300
|
-
};
|
|
1585
|
+
}, "packageCleanOutputs");
|
|
1301
1586
|
|
|
1302
1587
|
// src/actions/package/clean-typescript.ts
|
|
1303
1588
|
import path6 from "path";
|
|
1304
|
-
import
|
|
1305
|
-
var packageCleanTypescript = () => {
|
|
1589
|
+
import chalk23 from "chalk";
|
|
1590
|
+
var packageCleanTypescript = /* @__PURE__ */ __name(() => {
|
|
1306
1591
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1307
1592
|
const pkgName = process.env.npm_package_name;
|
|
1308
|
-
console.log(
|
|
1309
|
-
const files = [
|
|
1593
|
+
console.log(chalk23.green(`Cleaning Typescript [${pkgName}]`));
|
|
1594
|
+
const files = [
|
|
1595
|
+
path6.join(pkg, "*.tsbuildinfo"),
|
|
1596
|
+
path6.join(pkg, ".tsconfig.*"),
|
|
1597
|
+
path6.join(pkg, ".eslintcache")
|
|
1598
|
+
];
|
|
1310
1599
|
for (let file of files) {
|
|
1311
1600
|
deleteGlob(file);
|
|
1312
1601
|
}
|
|
1313
1602
|
return 0;
|
|
1314
|
-
};
|
|
1603
|
+
}, "packageCleanTypescript");
|
|
1315
1604
|
|
|
1316
1605
|
// src/actions/package/clean.ts
|
|
1317
|
-
var packageClean = async () => {
|
|
1318
|
-
return (await Promise.all([
|
|
1319
|
-
|
|
1606
|
+
var packageClean = /* @__PURE__ */ __name(async () => {
|
|
1607
|
+
return (await Promise.all([
|
|
1608
|
+
packageCleanOutputs(),
|
|
1609
|
+
packageCleanTypescript()
|
|
1610
|
+
])).reduce((prev, value) => prev + value, 0);
|
|
1611
|
+
}, "packageClean");
|
|
1320
1612
|
|
|
1321
1613
|
// src/actions/package/compile/compile.ts
|
|
1322
|
-
import
|
|
1323
|
-
|
|
1324
|
-
// src/actions/package/publint.ts
|
|
1325
|
-
import { promises as fs4 } from "fs";
|
|
1326
|
-
import chalk25 from "chalk";
|
|
1327
|
-
import sortPackageJson from "sort-package-json";
|
|
1328
|
-
var packagePublint = async (params) => {
|
|
1329
|
-
const pkgDir = process.env.INIT_CWD;
|
|
1330
|
-
const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1331
|
-
await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1332
|
-
const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1333
|
-
console.log(chalk25.green(`Publint: ${pkg.name}`));
|
|
1334
|
-
console.log(chalk25.gray(pkgDir));
|
|
1335
|
-
const { publint: publint2 } = await import("publint");
|
|
1336
|
-
const { messages } = await publint2({
|
|
1337
|
-
level: "suggestion",
|
|
1338
|
-
pkgDir,
|
|
1339
|
-
strict: true
|
|
1340
|
-
});
|
|
1341
|
-
const { formatMessage } = await import("publint/utils");
|
|
1342
|
-
const validMessage = (_message) => {
|
|
1343
|
-
return true;
|
|
1344
|
-
};
|
|
1345
|
-
const validMessages = messages.filter(validMessage);
|
|
1346
|
-
for (const message of validMessages) {
|
|
1347
|
-
switch (message.type) {
|
|
1348
|
-
case "error": {
|
|
1349
|
-
console.error(chalk25.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1350
|
-
break;
|
|
1351
|
-
}
|
|
1352
|
-
case "warning": {
|
|
1353
|
-
console.warn(chalk25.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1354
|
-
break;
|
|
1355
|
-
}
|
|
1356
|
-
default: {
|
|
1357
|
-
console.log(chalk25.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1358
|
-
break;
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
if (params?.verbose) {
|
|
1363
|
-
console.log(chalk25.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1364
|
-
}
|
|
1365
|
-
return validMessages.filter((message) => message.type === "error").length;
|
|
1366
|
-
};
|
|
1614
|
+
import chalk28 from "chalk";
|
|
1367
1615
|
|
|
1368
1616
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1617
|
+
import chalk27 from "chalk";
|
|
1369
1618
|
import { build as build2, defineConfig } from "tsup";
|
|
1370
1619
|
|
|
1371
1620
|
// src/actions/package/compile/inputs.ts
|
|
1621
|
+
import chalk24 from "chalk";
|
|
1372
1622
|
import { glob as glob2 } from "glob";
|
|
1373
|
-
var getAllInputs = (
|
|
1374
|
-
return
|
|
1375
|
-
}
|
|
1623
|
+
var getAllInputs = /* @__PURE__ */ __name((srcDir, verbose = false) => {
|
|
1624
|
+
return [
|
|
1625
|
+
...glob2.sync(`${srcDir}/**/*.ts`, {
|
|
1626
|
+
posix: true
|
|
1627
|
+
}).map((file) => {
|
|
1628
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1629
|
+
if (verbose) {
|
|
1630
|
+
console.log(chalk24.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1631
|
+
}
|
|
1632
|
+
return result;
|
|
1633
|
+
}),
|
|
1634
|
+
...glob2.sync(`${srcDir}/**/*.tsx`, {
|
|
1635
|
+
posix: true
|
|
1636
|
+
}).map((file) => {
|
|
1637
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1638
|
+
if (verbose) {
|
|
1639
|
+
console.log(chalk24.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1640
|
+
}
|
|
1641
|
+
return result;
|
|
1642
|
+
})
|
|
1643
|
+
];
|
|
1644
|
+
}, "getAllInputs");
|
|
1376
1645
|
|
|
1377
1646
|
// src/actions/package/compile/buildEntries.ts
|
|
1378
|
-
var buildEntries = (
|
|
1647
|
+
var buildEntries = /* @__PURE__ */ __name((srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
1379
1648
|
let entries = [];
|
|
1380
1649
|
switch (entryMode) {
|
|
1381
1650
|
case "platform": {
|
|
1382
|
-
entries = [
|
|
1651
|
+
entries = [
|
|
1652
|
+
"index-node.ts",
|
|
1653
|
+
"index-browser.ts"
|
|
1654
|
+
];
|
|
1383
1655
|
break;
|
|
1384
1656
|
}
|
|
1385
1657
|
case "all": {
|
|
1386
|
-
entries = excludeSpecAndStories ? getAllInputs(
|
|
1658
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
1387
1659
|
break;
|
|
1388
1660
|
}
|
|
1389
1661
|
case "custom": {
|
|
@@ -1391,7 +1663,9 @@ var buildEntries = (folder, entryMode = "single", options, excludeSpecAndStories
|
|
|
1391
1663
|
break;
|
|
1392
1664
|
}
|
|
1393
1665
|
default: {
|
|
1394
|
-
entries = [
|
|
1666
|
+
entries = [
|
|
1667
|
+
"index.ts"
|
|
1668
|
+
];
|
|
1395
1669
|
break;
|
|
1396
1670
|
}
|
|
1397
1671
|
}
|
|
@@ -1400,7 +1674,7 @@ var buildEntries = (folder, entryMode = "single", options, excludeSpecAndStories
|
|
|
1400
1674
|
}
|
|
1401
1675
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
1402
1676
|
return entries;
|
|
1403
|
-
};
|
|
1677
|
+
}, "buildEntries");
|
|
1404
1678
|
|
|
1405
1679
|
// src/actions/package/compile/deepMerge.ts
|
|
1406
1680
|
function deepMerge(target, source) {
|
|
@@ -1417,6 +1691,7 @@ function deepMerge(target, source) {
|
|
|
1417
1691
|
}
|
|
1418
1692
|
return target;
|
|
1419
1693
|
}
|
|
1694
|
+
__name(deepMerge, "deepMerge");
|
|
1420
1695
|
function deepMergeObjects(objects) {
|
|
1421
1696
|
const result = {};
|
|
1422
1697
|
for (const obj of objects) {
|
|
@@ -1424,274 +1699,361 @@ function deepMergeObjects(objects) {
|
|
|
1424
1699
|
}
|
|
1425
1700
|
return result;
|
|
1426
1701
|
}
|
|
1702
|
+
__name(deepMergeObjects, "deepMergeObjects");
|
|
1427
1703
|
|
|
1428
|
-
// src/actions/package/compile/
|
|
1704
|
+
// src/actions/package/compile/packageCompileTsc.ts
|
|
1705
|
+
import { cwd as cwd2 } from "process";
|
|
1706
|
+
import chalk25 from "chalk";
|
|
1707
|
+
import { createProgramFromConfig } from "tsc-prog";
|
|
1708
|
+
import ts2, { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys } from "typescript";
|
|
1709
|
+
|
|
1710
|
+
// src/actions/package/compile/getCompilerOptions.ts
|
|
1429
1711
|
import { cwd } from "process";
|
|
1712
|
+
import deepmerge2 from "deepmerge";
|
|
1713
|
+
import { getTsconfig } from "get-tsconfig";
|
|
1714
|
+
var getCompilerOptions = /* @__PURE__ */ __name((options = {}, fileName = "tsconfig.json") => {
|
|
1715
|
+
const resolvedTsConfigCompilerOptions = getTsconfig(cwd(), fileName)?.config?.compilerOptions ?? {};
|
|
1716
|
+
return deepmerge2(resolvedTsConfigCompilerOptions, options);
|
|
1717
|
+
}, "getCompilerOptions");
|
|
1718
|
+
|
|
1719
|
+
// src/actions/package/compile/packageCompileTsc.ts
|
|
1720
|
+
var packageCompileTsc = /* @__PURE__ */ __name((platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
1721
|
+
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1722
|
+
if (verbose) {
|
|
1723
|
+
console.log(chalk25.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1724
|
+
}
|
|
1725
|
+
const configFilePath = ts2.findConfigFile("./", ts2.sys.fileExists, "tsconfig.json");
|
|
1726
|
+
if (configFilePath === void 0) {
|
|
1727
|
+
throw new Error("Could not find tsconfig.json");
|
|
1728
|
+
}
|
|
1729
|
+
const compilerOptions = {
|
|
1730
|
+
...getCompilerOptions({
|
|
1731
|
+
removeComments: false,
|
|
1732
|
+
skipDefaultLibCheck: true,
|
|
1733
|
+
skipLibCheck: true,
|
|
1734
|
+
sourceMap: false
|
|
1735
|
+
}),
|
|
1736
|
+
...compilerOptionsParam,
|
|
1737
|
+
outDir: `${outDir}/${platform}`,
|
|
1738
|
+
emitDeclarationOnly: true,
|
|
1739
|
+
noEmit: false
|
|
1740
|
+
};
|
|
1741
|
+
console.log(chalk25.cyan(`Validating Files: ${entries.length}`));
|
|
1742
|
+
if (verbose) {
|
|
1743
|
+
for (const entry of entries) {
|
|
1744
|
+
console.log(chalk25.grey(`Validating: ${entry}`));
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
try {
|
|
1748
|
+
if (entries.length > 0) {
|
|
1749
|
+
const program = createProgramFromConfig({
|
|
1750
|
+
configFilePath,
|
|
1751
|
+
basePath: pkg ?? cwd2(),
|
|
1752
|
+
compilerOptions,
|
|
1753
|
+
files: entries.map((entry) => `${srcDir}/${entry}`),
|
|
1754
|
+
include: [
|
|
1755
|
+
`${srcDir}/**/*.*`
|
|
1756
|
+
]
|
|
1757
|
+
});
|
|
1758
|
+
const diagnostics = getPreEmitDiagnostics(program);
|
|
1759
|
+
if (diagnostics.length > 0) {
|
|
1760
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
|
|
1761
|
+
getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
|
|
1762
|
+
getCurrentDirectory: /* @__PURE__ */ __name(() => srcDir, "getCurrentDirectory"),
|
|
1763
|
+
getNewLine: /* @__PURE__ */ __name(() => sys.newLine, "getNewLine")
|
|
1764
|
+
});
|
|
1765
|
+
console.error(formattedDiagnostics);
|
|
1766
|
+
}
|
|
1767
|
+
program.emit();
|
|
1768
|
+
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1769
|
+
}
|
|
1770
|
+
return 0;
|
|
1771
|
+
} finally {
|
|
1772
|
+
if (verbose) {
|
|
1773
|
+
console.log(chalk25.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
}, "packageCompileTsc");
|
|
1777
|
+
|
|
1778
|
+
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1779
|
+
import path7 from "path";
|
|
1780
|
+
import { cwd as cwd3 } from "process";
|
|
1781
|
+
import chalk26 from "chalk";
|
|
1430
1782
|
import { rollup } from "rollup";
|
|
1431
1783
|
import dts from "rollup-plugin-dts";
|
|
1432
1784
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1785
|
+
var ignoredWarningCodes = /* @__PURE__ */ new Set([
|
|
1786
|
+
"EMPTY_BUNDLE",
|
|
1787
|
+
"UNRESOLVED_IMPORT"
|
|
1788
|
+
]);
|
|
1789
|
+
async function bundleDts(inputPath, outputPath, platform, options, verbose = false) {
|
|
1790
|
+
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1791
|
+
const tsconfigPath = path7.resolve(pkg, "tsconfig.json");
|
|
1792
|
+
const nodePlugIns = platform === "node" ? [
|
|
1793
|
+
nodeExternals()
|
|
1794
|
+
] : [];
|
|
1795
|
+
try {
|
|
1796
|
+
const bundle = await rollup({
|
|
1797
|
+
input: inputPath,
|
|
1798
|
+
plugins: [
|
|
1799
|
+
dts({
|
|
1800
|
+
...options,
|
|
1801
|
+
tsconfig: tsconfigPath,
|
|
1802
|
+
compilerOptions: {
|
|
1803
|
+
emitDeclarationOnly: true,
|
|
1804
|
+
noEmit: false,
|
|
1805
|
+
declarationMap: true
|
|
1806
|
+
}
|
|
1807
|
+
}),
|
|
1808
|
+
...nodePlugIns
|
|
1809
|
+
],
|
|
1810
|
+
onwarn(warning, warn) {
|
|
1811
|
+
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
console.warn(chalk26.yellow(`[${warning.code}] ${warning.message}`));
|
|
1815
|
+
console.warn(chalk26.gray(inputPath));
|
|
1816
|
+
warn(warning);
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1819
|
+
await bundle.write({
|
|
1820
|
+
file: outputPath,
|
|
1821
|
+
format: "es"
|
|
1822
|
+
});
|
|
1823
|
+
} catch (ex) {
|
|
1824
|
+
const error = ex;
|
|
1825
|
+
console.warn(chalk26.red(error));
|
|
1826
|
+
console.warn(chalk26.gray(inputPath));
|
|
1827
|
+
}
|
|
1828
|
+
if (verbose) {
|
|
1829
|
+
console.log(`Bundled declarations written to ${outputPath}`);
|
|
1830
|
+
}
|
|
1448
1831
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1832
|
+
__name(bundleDts, "bundleDts");
|
|
1833
|
+
var packageCompileTscTypes = /* @__PURE__ */ __name(async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1834
|
+
if (verbose) {
|
|
1835
|
+
console.log(chalk26.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1836
|
+
console.log(`Entries: ${entries.join(", ")}`);
|
|
1837
|
+
}
|
|
1838
|
+
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1839
|
+
const srcRoot = `${pkg}/${srcDir}/${platform}`;
|
|
1840
|
+
const entryNameToTypeName = /* @__PURE__ */ __name((entry) => {
|
|
1453
1841
|
const splitEntryName = entry.split(".");
|
|
1454
1842
|
const newEntryExtension = "d." + splitEntryName.at(-1);
|
|
1455
|
-
return [
|
|
1456
|
-
|
|
1457
|
-
|
|
1843
|
+
return [
|
|
1844
|
+
...splitEntryName.slice(0, -1),
|
|
1845
|
+
newEntryExtension
|
|
1846
|
+
].join(".");
|
|
1847
|
+
}, "entryNameToTypeName");
|
|
1848
|
+
const compilerOptions = getCompilerOptions({
|
|
1849
|
+
removeComments: false,
|
|
1850
|
+
skipDefaultLibCheck: true,
|
|
1851
|
+
skipLibCheck: true,
|
|
1852
|
+
declarationMap: true,
|
|
1853
|
+
emitDeclarationOnly: true,
|
|
1854
|
+
noEmit: true
|
|
1855
|
+
});
|
|
1856
|
+
const entryNames = entries.map((entry) => entry.split(`${srcDir}/`).at(-1) ?? entry);
|
|
1458
1857
|
await Promise.all(entryNames.map(async (entryName) => {
|
|
1459
|
-
|
|
1858
|
+
const entryTypeName = entryNameToTypeName(entryName);
|
|
1859
|
+
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, {
|
|
1860
|
+
compilerOptions
|
|
1861
|
+
}, verbose);
|
|
1460
1862
|
}));
|
|
1863
|
+
if (verbose) {
|
|
1864
|
+
console.log(chalk26.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1865
|
+
}
|
|
1461
1866
|
return 0;
|
|
1462
|
-
};
|
|
1867
|
+
}, "packageCompileTscTypes");
|
|
1463
1868
|
|
|
1464
1869
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1465
|
-
var compileFolder = async (
|
|
1870
|
+
var compileFolder = /* @__PURE__ */ __name(async (srcDir, entries, buildDir, options, bundleTypes = false, verbose) => {
|
|
1466
1871
|
const outDir = options?.outDir ?? "dist";
|
|
1467
1872
|
if (verbose) {
|
|
1468
|
-
console.log(`compileFolder [${
|
|
1873
|
+
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
1874
|
+
}
|
|
1875
|
+
if (entries.length === 0) {
|
|
1876
|
+
console.warn(chalk27.yellow(`No entries found in ${srcDir} to compile`));
|
|
1877
|
+
return 0;
|
|
1469
1878
|
}
|
|
1470
|
-
const optionsResult = defineConfig({
|
|
1471
|
-
bundle: true,
|
|
1472
|
-
cjsInterop: true,
|
|
1473
|
-
clean: true,
|
|
1474
|
-
dts: false,
|
|
1475
|
-
entry: entries,
|
|
1476
|
-
format: ["esm"],
|
|
1477
|
-
outDir,
|
|
1478
|
-
silent: true,
|
|
1479
|
-
sourcemap: true,
|
|
1480
|
-
splitting: false,
|
|
1481
|
-
tsconfig: "tsconfig.json",
|
|
1482
|
-
...options
|
|
1483
|
-
});
|
|
1484
|
-
const optionsList = (await Promise.all(
|
|
1485
|
-
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
1486
|
-
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
1487
|
-
return Array.isArray(result) ? result : [result];
|
|
1488
|
-
})
|
|
1489
|
-
)).flat();
|
|
1490
1879
|
if (verbose) {
|
|
1491
|
-
console.log(`
|
|
1880
|
+
console.log(chalk27.gray(`buildDir [${buildDir}]`));
|
|
1881
|
+
}
|
|
1882
|
+
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
1883
|
+
if (validationResult !== 0) {
|
|
1884
|
+
console.error(chalk27.red(`Compile:Validation had ${validationResult} errors`));
|
|
1885
|
+
return validationResult;
|
|
1886
|
+
}
|
|
1887
|
+
const optionsParams = tsupOptions([
|
|
1888
|
+
{
|
|
1889
|
+
bundle: true,
|
|
1890
|
+
cjsInterop: true,
|
|
1891
|
+
clean: false,
|
|
1892
|
+
dts: false,
|
|
1893
|
+
format: [
|
|
1894
|
+
"esm"
|
|
1895
|
+
],
|
|
1896
|
+
outDir,
|
|
1897
|
+
silent: true,
|
|
1898
|
+
sourcemap: true,
|
|
1899
|
+
splitting: false,
|
|
1900
|
+
tsconfig: "tsconfig.json",
|
|
1901
|
+
...options,
|
|
1902
|
+
entry: entries.map((entry) => `${srcDir}/${entry}`)
|
|
1903
|
+
}
|
|
1904
|
+
]);
|
|
1905
|
+
const optionsResult = defineConfig(optionsParams);
|
|
1906
|
+
const optionsList = (await Promise.all((Array.isArray(optionsResult) ? optionsResult : [
|
|
1907
|
+
optionsResult
|
|
1908
|
+
]).flatMap(async (options2) => {
|
|
1909
|
+
const result = typeof options2 === "function" ? await options2({}) : [
|
|
1910
|
+
options2
|
|
1911
|
+
];
|
|
1912
|
+
return Array.isArray(result) ? result : [
|
|
1913
|
+
result
|
|
1914
|
+
];
|
|
1915
|
+
}))).flat();
|
|
1916
|
+
if (verbose) {
|
|
1917
|
+
console.log(chalk27.cyan(`TSUP:build:start [${srcDir}]`));
|
|
1918
|
+
console.log(chalk27.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
1492
1919
|
}
|
|
1493
1920
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1494
1921
|
if (verbose) {
|
|
1495
|
-
console.log(`TSUP:build:stop [${
|
|
1922
|
+
console.log(chalk27.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
1923
|
+
}
|
|
1924
|
+
if (bundleTypes) {
|
|
1925
|
+
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
1496
1926
|
}
|
|
1497
|
-
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", folder);
|
|
1498
1927
|
return 0;
|
|
1499
|
-
};
|
|
1500
|
-
var tsupOptions = (options = []) => {
|
|
1928
|
+
}, "compileFolder");
|
|
1929
|
+
var tsupOptions = /* @__PURE__ */ __name((options = []) => {
|
|
1501
1930
|
const standardLoaders = {
|
|
1502
1931
|
".gif": "copy",
|
|
1503
1932
|
".html": "copy",
|
|
1504
1933
|
".jpg": "copy",
|
|
1505
1934
|
".json": "json",
|
|
1506
1935
|
".png": "copy",
|
|
1507
|
-
".svg": "
|
|
1936
|
+
".svg": "text",
|
|
1508
1937
|
".webp": "copy"
|
|
1509
1938
|
};
|
|
1510
1939
|
const standardOptions = {
|
|
1511
1940
|
bundle: true,
|
|
1512
|
-
format: [
|
|
1941
|
+
format: [
|
|
1942
|
+
"esm"
|
|
1943
|
+
],
|
|
1513
1944
|
loader: standardLoaders,
|
|
1514
|
-
outExtension: ({ format }) => format === "esm" ? {
|
|
1945
|
+
outExtension: /* @__PURE__ */ __name(({ format }) => format === "esm" ? {
|
|
1946
|
+
js: ".mjs"
|
|
1947
|
+
} : {
|
|
1948
|
+
js: ".cjs"
|
|
1949
|
+
}, "outExtension"),
|
|
1515
1950
|
skipNodeModulesBundle: true,
|
|
1516
1951
|
sourcemap: true,
|
|
1517
1952
|
target: "esnext"
|
|
1518
1953
|
};
|
|
1519
|
-
return deepMergeObjects([
|
|
1520
|
-
|
|
1521
|
-
|
|
1954
|
+
return deepMergeObjects([
|
|
1955
|
+
standardOptions,
|
|
1956
|
+
...options
|
|
1957
|
+
]);
|
|
1958
|
+
}, "tsupOptions");
|
|
1959
|
+
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1522
1960
|
const compile2 = config2?.compile;
|
|
1523
1961
|
const verbose = config2?.verbose ?? false;
|
|
1962
|
+
const outDirAsBuildDir = compile2?.outDirAsBuildDir ?? true;
|
|
1963
|
+
const bundleTypes = compile2?.bundleTypes ?? false;
|
|
1524
1964
|
if (verbose) {
|
|
1525
|
-
console.log(
|
|
1965
|
+
console.log("Compiling with TSUP");
|
|
1526
1966
|
}
|
|
1527
|
-
const compileForNode = compile2?.node ?? {
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
}
|
|
1967
|
+
const compileForNode = compile2?.node ?? {
|
|
1968
|
+
src: {}
|
|
1969
|
+
};
|
|
1970
|
+
const compileForBrowser = compile2?.browser ?? {
|
|
1971
|
+
src: {}
|
|
1972
|
+
};
|
|
1973
|
+
const compileForNeutral = compile2?.neutral ?? {
|
|
1974
|
+
src: {}
|
|
1975
|
+
};
|
|
1976
|
+
return (await Promise.all(Object.entries(compileForNode).map(async ([srcDir, options]) => {
|
|
1977
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
1978
|
+
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1979
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
1980
|
+
const platform = "node";
|
|
1981
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
1982
|
+
const outDir = rootOutDir + "/" + platform;
|
|
1983
|
+
return typeof srcDir === "string" ? await compileFolder(srcDir, entry, outDirAsBuildDir ? rootOutDir : "build", tsupOptions([
|
|
1984
|
+
inEsBuildOptions,
|
|
1985
|
+
compile2?.tsup?.options ?? {},
|
|
1986
|
+
typeof options === "object" ? options : {},
|
|
1987
|
+
{
|
|
1988
|
+
platform: "node",
|
|
1989
|
+
outDir
|
|
1990
|
+
}
|
|
1991
|
+
]), bundleTypes, verbose) : 0;
|
|
1992
|
+
}))).reduce((prev, value) => prev + value, 0) + (await Promise.all(Object.entries(compileForBrowser).map(async ([srcDir, options]) => {
|
|
1993
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
1994
|
+
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1995
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
1996
|
+
const platform = "browser";
|
|
1997
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
1998
|
+
const outDir = rootOutDir + "/" + platform;
|
|
1999
|
+
return typeof srcDir === "string" ? await compileFolder(srcDir, entry, outDirAsBuildDir ? rootOutDir : "build", tsupOptions([
|
|
2000
|
+
inEsBuildOptions,
|
|
2001
|
+
compile2?.tsup?.options ?? {},
|
|
2002
|
+
typeof options === "object" ? options : {},
|
|
2003
|
+
{
|
|
2004
|
+
platform: "browser",
|
|
2005
|
+
outDir
|
|
2006
|
+
}
|
|
2007
|
+
]), bundleTypes, verbose) : 0;
|
|
2008
|
+
}))).reduce((prev, value) => prev + value, 0) + (await Promise.all(Object.entries(compileForNeutral).map(async ([srcDir, options]) => {
|
|
2009
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
2010
|
+
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
2011
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
2012
|
+
const platform = "neutral";
|
|
2013
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
2014
|
+
const outDir = rootOutDir + "/" + platform;
|
|
2015
|
+
return typeof srcDir === "string" ? await compileFolder(srcDir, entry, outDirAsBuildDir ? rootOutDir : "build", tsupOptions([
|
|
2016
|
+
inEsBuildOptions,
|
|
2017
|
+
compile2?.tsup?.options ?? {},
|
|
2018
|
+
typeof options === "object" ? options : {},
|
|
2019
|
+
{
|
|
2020
|
+
platform: "neutral",
|
|
2021
|
+
outDir
|
|
2022
|
+
}
|
|
2023
|
+
]), bundleTypes, verbose) : 0;
|
|
2024
|
+
}))).reduce((prev, value) => prev + value, 0) + 0;
|
|
2025
|
+
}, "packageCompileTsup");
|
|
1583
2026
|
|
|
1584
2027
|
// src/actions/package/compile/compile.ts
|
|
1585
|
-
var packageCompile = async (inConfig = {}) => {
|
|
2028
|
+
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1586
2029
|
const pkg = process.env.INIT_CWD;
|
|
1587
|
-
console.log(
|
|
2030
|
+
console.log(chalk28.green(`Compiling ${pkg}`));
|
|
1588
2031
|
const config2 = await loadConfig(inConfig);
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
if (tsupResults > 0) {
|
|
1592
|
-
return tsupResults;
|
|
1593
|
-
}
|
|
1594
|
-
return publint2 ? await packagePublint(config2) : 0;
|
|
1595
|
-
};
|
|
1596
|
-
|
|
1597
|
-
// src/actions/package/compile/packageCompileTsc.ts
|
|
1598
|
-
import { cwd as cwd2 } from "process";
|
|
1599
|
-
import chalk27 from "chalk";
|
|
1600
|
-
import { createProgramFromConfig } from "tsc-prog";
|
|
1601
|
-
import {
|
|
1602
|
-
DiagnosticCategory,
|
|
1603
|
-
formatDiagnosticsWithColorAndContext,
|
|
1604
|
-
getPreEmitDiagnostics,
|
|
1605
|
-
sys as sys2
|
|
1606
|
-
} from "typescript";
|
|
1607
|
-
|
|
1608
|
-
// src/actions/package/compile/getCompilerOptions.ts
|
|
1609
|
-
import { createRequire } from "module";
|
|
1610
|
-
import deepmerge2 from "deepmerge";
|
|
1611
|
-
import {
|
|
1612
|
-
findConfigFile,
|
|
1613
|
-
readConfigFile,
|
|
1614
|
-
sys
|
|
1615
|
-
} from "typescript";
|
|
1616
|
-
var getNested = (config2) => {
|
|
1617
|
-
if (config2.extends) {
|
|
1618
|
-
const require2 = createRequire(import.meta.url);
|
|
1619
|
-
const opts = require2(config2.extends);
|
|
1620
|
-
return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
|
|
1621
|
-
}
|
|
1622
|
-
return config2.compilerOptions;
|
|
1623
|
-
};
|
|
1624
|
-
var getCompilerOptionsJSONFollowExtends = (filename3) => {
|
|
1625
|
-
const config2 = readConfigFile(filename3, sys.readFile).config;
|
|
1626
|
-
return getNested(config2);
|
|
1627
|
-
};
|
|
1628
|
-
var getCompilerOptions = (options = {}, tsconfig = "tsconfig.json") => {
|
|
1629
|
-
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
1630
|
-
const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
|
|
1631
|
-
return deepmerge2(configFileCompilerOptions, options);
|
|
1632
|
-
};
|
|
1633
|
-
|
|
1634
|
-
// src/actions/package/compile/packageCompileTsc.ts
|
|
1635
|
-
var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1636
|
-
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1637
|
-
const verbose = config2?.verbose ?? false;
|
|
1638
|
-
const compilerOptions = {
|
|
1639
|
-
...getCompilerOptions({
|
|
1640
|
-
outDir: "dist/types",
|
|
1641
|
-
removeComments: false,
|
|
1642
|
-
skipDefaultLibCheck: true,
|
|
1643
|
-
skipLibCheck: true,
|
|
1644
|
-
sourceMap: false
|
|
1645
|
-
}),
|
|
1646
|
-
...compilerOptionsParam,
|
|
1647
|
-
emitDeclarationOnly: false,
|
|
1648
|
-
noEmit: true
|
|
1649
|
-
};
|
|
1650
|
-
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1651
|
-
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1652
|
-
const files = buildEntries(folder, "all", {}, true, verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1653
|
-
console.log(chalk27.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1654
|
-
if (files.length > 0) {
|
|
1655
|
-
const program = createProgramFromConfig({
|
|
1656
|
-
basePath: pkg ?? cwd2(),
|
|
1657
|
-
compilerOptions,
|
|
1658
|
-
exclude: ["dist", "docs"],
|
|
1659
|
-
files
|
|
1660
|
-
});
|
|
1661
|
-
const diagnostics = getPreEmitDiagnostics(program);
|
|
1662
|
-
if (diagnostics.length > 0) {
|
|
1663
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1664
|
-
diagnostics,
|
|
1665
|
-
{
|
|
1666
|
-
getCanonicalFileName: (fileName) => fileName,
|
|
1667
|
-
getCurrentDirectory: () => folder,
|
|
1668
|
-
getNewLine: () => sys2.newLine
|
|
1669
|
-
}
|
|
1670
|
-
);
|
|
1671
|
-
console.error(formattedDiagnostics);
|
|
1672
|
-
}
|
|
1673
|
-
program.emit();
|
|
1674
|
-
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1675
|
-
}
|
|
1676
|
-
return 0;
|
|
1677
|
-
};
|
|
2032
|
+
return await packageCompileTsup(config2);
|
|
2033
|
+
}, "packageCompile");
|
|
1678
2034
|
|
|
1679
2035
|
// src/actions/package/copy-assets.ts
|
|
1680
|
-
import
|
|
1681
|
-
import
|
|
2036
|
+
import path8 from "path/posix";
|
|
2037
|
+
import chalk29 from "chalk";
|
|
1682
2038
|
import cpy2 from "cpy";
|
|
1683
|
-
var copyTargetAssets2 = async (target, name, location) => {
|
|
2039
|
+
var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
1684
2040
|
try {
|
|
1685
|
-
const values = await cpy2(
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
2041
|
+
const values = await cpy2([
|
|
2042
|
+
"**/*.jpg",
|
|
2043
|
+
"**/*.png",
|
|
2044
|
+
"**/*.gif",
|
|
2045
|
+
"**/*.svg",
|
|
2046
|
+
"**/*.webp",
|
|
2047
|
+
"**/*.sass",
|
|
2048
|
+
"**/*.scss",
|
|
2049
|
+
"**/*.gif",
|
|
2050
|
+
"**/*.css"
|
|
2051
|
+
], `../dist/${target}`, {
|
|
2052
|
+
cwd: path8.join(location, "src"),
|
|
2053
|
+
flat: false
|
|
2054
|
+
});
|
|
1693
2055
|
if (values.length > 0) {
|
|
1694
|
-
console.log(
|
|
2056
|
+
console.log(chalk29.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1695
2057
|
}
|
|
1696
2058
|
for (const value of values) {
|
|
1697
2059
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1702,8 +2064,8 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1702
2064
|
console.log(`Copy Assets Failed: ${name}: ${error.message}`);
|
|
1703
2065
|
return 1;
|
|
1704
2066
|
}
|
|
1705
|
-
};
|
|
1706
|
-
var packageCopyAssets = async ({ target }) => {
|
|
2067
|
+
}, "copyTargetAssets");
|
|
2068
|
+
var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
1707
2069
|
const pkg = process.env.INIT_CWD ?? "./";
|
|
1708
2070
|
const pkgName = process.env.npm_package_name ?? "Unknown";
|
|
1709
2071
|
switch (target) {
|
|
@@ -1717,11 +2079,11 @@ var packageCopyAssets = async ({ target }) => {
|
|
|
1717
2079
|
return await copyTargetAssets2("esm", pkgName, pkg) || await copyTargetAssets2("cjs", pkgName, pkg);
|
|
1718
2080
|
}
|
|
1719
2081
|
}
|
|
1720
|
-
};
|
|
2082
|
+
}, "packageCopyAssets");
|
|
1721
2083
|
|
|
1722
2084
|
// src/actions/package/cycle.ts
|
|
1723
2085
|
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1724
|
-
var packageCycle =
|
|
2086
|
+
var packageCycle = /* @__PURE__ */ __name(async () => {
|
|
1725
2087
|
const pkg = process.env.INIT_CWD;
|
|
1726
2088
|
const pkgName = process.env.npm_package_name;
|
|
1727
2089
|
const cruiseOptions = {
|
|
@@ -1732,41 +2094,40 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1732
2094
|
severity: "error",
|
|
1733
2095
|
comment: "This dependency creates a circular reference",
|
|
1734
2096
|
from: {},
|
|
1735
|
-
to: {
|
|
2097
|
+
to: {
|
|
2098
|
+
circular: true
|
|
2099
|
+
}
|
|
1736
2100
|
}
|
|
1737
2101
|
]
|
|
1738
2102
|
},
|
|
1739
2103
|
exclude: "node_modules|packages/.*/packages",
|
|
1740
2104
|
validate: true,
|
|
1741
|
-
doNotFollow: {
|
|
2105
|
+
doNotFollow: {
|
|
2106
|
+
path: "node_modules|packages/.*/packages"
|
|
2107
|
+
},
|
|
1742
2108
|
tsPreCompilationDeps: false,
|
|
1743
2109
|
combinedDependencies: true,
|
|
1744
|
-
outputType:
|
|
2110
|
+
outputType: "err"
|
|
1745
2111
|
};
|
|
1746
2112
|
const target = `${pkg}/src`;
|
|
1747
2113
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1748
|
-
const result = await cruise2([
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
2114
|
+
const result = await cruise2([
|
|
2115
|
+
target
|
|
2116
|
+
], cruiseOptions);
|
|
2117
|
+
console.log(result.output);
|
|
1752
2118
|
if (result.exitCode === 0) {
|
|
1753
2119
|
console.log(`${pkgName} \u2705 No dependency violations`);
|
|
1754
2120
|
} else {
|
|
1755
2121
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
1756
2122
|
}
|
|
1757
2123
|
return result.exitCode;
|
|
1758
|
-
};
|
|
2124
|
+
}, "packageCycle");
|
|
1759
2125
|
|
|
1760
2126
|
// src/actions/package/gen-docs.ts
|
|
1761
2127
|
import { existsSync as existsSync4 } from "fs";
|
|
1762
|
-
import
|
|
1763
|
-
import
|
|
1764
|
-
import {
|
|
1765
|
-
Application,
|
|
1766
|
-
ArgumentsReader,
|
|
1767
|
-
TSConfigReader,
|
|
1768
|
-
TypeDocReader
|
|
1769
|
-
} from "typedoc";
|
|
2128
|
+
import path9 from "path";
|
|
2129
|
+
import chalk30 from "chalk";
|
|
2130
|
+
import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
|
|
1770
2131
|
var ExitCodes = {
|
|
1771
2132
|
CompileError: 3,
|
|
1772
2133
|
ExceptionThrown: 6,
|
|
@@ -1776,14 +2137,17 @@ var ExitCodes = {
|
|
|
1776
2137
|
OutputError: 5,
|
|
1777
2138
|
ValidationError: 4
|
|
1778
2139
|
};
|
|
1779
|
-
var packageGenDocs = async () => {
|
|
2140
|
+
var packageGenDocs = /* @__PURE__ */ __name(async () => {
|
|
1780
2141
|
const pkg = process.env.INIT_CWD;
|
|
1781
|
-
if (pkg && !existsSync4(
|
|
2142
|
+
if (pkg !== void 0 && !existsSync4(path9.join(pkg, "typedoc.json"))) {
|
|
1782
2143
|
return;
|
|
1783
2144
|
}
|
|
1784
2145
|
const app = await Application.bootstrap({
|
|
1785
2146
|
entryPointStrategy: "merge",
|
|
1786
|
-
entryPoints: [
|
|
2147
|
+
entryPoints: [
|
|
2148
|
+
`${pkg}/src/**/*.ts`,
|
|
2149
|
+
`${pkg}/packages/*/dist/docs.json`
|
|
2150
|
+
],
|
|
1787
2151
|
excludeExternals: true,
|
|
1788
2152
|
json: `${pkg}/dist/docs.json`,
|
|
1789
2153
|
logLevel: "Error",
|
|
@@ -1794,8 +2158,8 @@ var packageGenDocs = async () => {
|
|
|
1794
2158
|
app.options.addReader(new TSConfigReader());
|
|
1795
2159
|
app.options.addReader(new ArgumentsReader(300));
|
|
1796
2160
|
return await runTypeDoc(app);
|
|
1797
|
-
};
|
|
1798
|
-
var runTypeDoc = async (app) => {
|
|
2161
|
+
}, "packageGenDocs");
|
|
2162
|
+
var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
1799
2163
|
const pkgName = process.env.npm_package_name;
|
|
1800
2164
|
if (app.options.getValue("version")) {
|
|
1801
2165
|
console.log(app.toString());
|
|
@@ -1864,37 +2228,40 @@ var runTypeDoc = async (app) => {
|
|
|
1864
2228
|
return ExitCodes.OutputError;
|
|
1865
2229
|
}
|
|
1866
2230
|
}
|
|
1867
|
-
console.log(
|
|
2231
|
+
console.log(chalk30.green(`${pkgName} - Ok`));
|
|
1868
2232
|
return ExitCodes.Ok;
|
|
1869
|
-
};
|
|
2233
|
+
}, "runTypeDoc");
|
|
1870
2234
|
|
|
1871
2235
|
// src/actions/package/lint.ts
|
|
1872
2236
|
import { readdirSync } from "fs";
|
|
1873
|
-
import
|
|
1874
|
-
import { cwd as
|
|
2237
|
+
import path10 from "path";
|
|
2238
|
+
import { cwd as cwd4 } from "process";
|
|
1875
2239
|
import { pathToFileURL } from "url";
|
|
1876
|
-
import
|
|
2240
|
+
import chalk31 from "chalk";
|
|
1877
2241
|
import { ESLint } from "eslint";
|
|
1878
2242
|
import { findUp } from "find-up";
|
|
1879
2243
|
import picomatch from "picomatch";
|
|
1880
|
-
var dumpMessages = (lintResults) => {
|
|
1881
|
-
const colors = [
|
|
1882
|
-
|
|
2244
|
+
var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
2245
|
+
const colors = [
|
|
2246
|
+
"white",
|
|
2247
|
+
"yellow",
|
|
2248
|
+
"red"
|
|
2249
|
+
];
|
|
2250
|
+
const severity = [
|
|
2251
|
+
"none",
|
|
2252
|
+
"warning",
|
|
2253
|
+
"error"
|
|
2254
|
+
];
|
|
1883
2255
|
for (const lintResult of lintResults) {
|
|
1884
2256
|
if (lintResult.messages.length > 0) {
|
|
1885
|
-
console.log(
|
|
2257
|
+
console.log(chalk31.gray(`
|
|
1886
2258
|
${lintResult.filePath}`));
|
|
1887
2259
|
for (const message of lintResult.messages) {
|
|
1888
|
-
console.log(
|
|
1889
|
-
chalk30.gray(` ${message.line}:${message.column}`),
|
|
1890
|
-
chalk30[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1891
|
-
chalk30.white(` ${message.message}`),
|
|
1892
|
-
chalk30.gray(` ${message.ruleId}`)
|
|
1893
|
-
);
|
|
2260
|
+
console.log(chalk31.gray(` ${message.line}:${message.column}`), chalk31[colors[message.severity]](` ${severity[message.severity]}`), chalk31.white(` ${message.message}`), chalk31.gray(` ${message.ruleId}`));
|
|
1894
2261
|
}
|
|
1895
2262
|
}
|
|
1896
2263
|
}
|
|
1897
|
-
};
|
|
2264
|
+
}, "dumpMessages");
|
|
1898
2265
|
async function getRootESLintConfig() {
|
|
1899
2266
|
const configPath = await findUp("eslint.config.mjs");
|
|
1900
2267
|
if (configPath === void 0) {
|
|
@@ -1902,33 +2269,50 @@ async function getRootESLintConfig() {
|
|
|
1902
2269
|
}
|
|
1903
2270
|
return pathToFileURL(configPath);
|
|
1904
2271
|
}
|
|
2272
|
+
__name(getRootESLintConfig, "getRootESLintConfig");
|
|
1905
2273
|
function getFiles(dir, ignoreFolders) {
|
|
1906
|
-
const currentDirectory =
|
|
2274
|
+
const currentDirectory = cwd4();
|
|
1907
2275
|
const subDirectory = dir.split(currentDirectory)[1];
|
|
1908
2276
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
1909
|
-
return readdirSync(dir, {
|
|
1910
|
-
|
|
2277
|
+
return readdirSync(dir, {
|
|
2278
|
+
withFileTypes: true
|
|
2279
|
+
}).flatMap((dirent) => {
|
|
2280
|
+
const res = path10.resolve(dir, dirent.name);
|
|
1911
2281
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
1912
2282
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
1913
2283
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
1914
|
-
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
|
|
2284
|
+
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
|
|
2285
|
+
res
|
|
2286
|
+
];
|
|
1915
2287
|
});
|
|
1916
2288
|
}
|
|
1917
|
-
|
|
2289
|
+
__name(getFiles, "getFiles");
|
|
2290
|
+
var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, cache = true) => {
|
|
1918
2291
|
const pkg = process.env.INIT_CWD;
|
|
1919
2292
|
const configPath = await getRootESLintConfig();
|
|
1920
2293
|
const { default: eslintConfig } = await import(configPath.href);
|
|
1921
2294
|
const start = Date.now();
|
|
1922
|
-
const ignoreFolders = [
|
|
2295
|
+
const ignoreFolders = [
|
|
2296
|
+
"node_modules",
|
|
2297
|
+
"dist",
|
|
2298
|
+
"packages",
|
|
2299
|
+
".git",
|
|
2300
|
+
"build",
|
|
2301
|
+
".yarn",
|
|
2302
|
+
".vscode",
|
|
2303
|
+
".github"
|
|
2304
|
+
];
|
|
1923
2305
|
const engine = new ESLint({
|
|
1924
|
-
baseConfig: [
|
|
2306
|
+
baseConfig: [
|
|
2307
|
+
...eslintConfig
|
|
2308
|
+
],
|
|
1925
2309
|
fix: fix2,
|
|
1926
2310
|
warnIgnored: false,
|
|
1927
2311
|
cache
|
|
1928
2312
|
});
|
|
1929
|
-
const files = getFiles(
|
|
2313
|
+
const files = getFiles(cwd4(), ignoreFolders);
|
|
1930
2314
|
if (verbose) {
|
|
1931
|
-
console.log(
|
|
2315
|
+
console.log(chalk31.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
1932
2316
|
}
|
|
1933
2317
|
const lintResults = await engine.lintFiles(files);
|
|
1934
2318
|
dumpMessages(lintResults);
|
|
@@ -1938,43 +2322,119 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1938
2322
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
1939
2323
|
const lintTime = Date.now() - start;
|
|
1940
2324
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
1941
|
-
console.log(
|
|
2325
|
+
console.log(chalk31.white(`Linted ${chalk31[filesCountColor](files.length)} files in ${chalk31[lintTimeColor](lintTime)}ms`));
|
|
1942
2326
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1943
|
-
};
|
|
2327
|
+
}, "packageLint");
|
|
2328
|
+
|
|
2329
|
+
// src/actions/package/publint.ts
|
|
2330
|
+
import { promises as fs4 } from "fs";
|
|
2331
|
+
import chalk32 from "chalk";
|
|
2332
|
+
import sortPackageJson from "sort-package-json";
|
|
2333
|
+
var packagePublint = /* @__PURE__ */ __name(async ({ strict = true, verbose = false } = {}) => {
|
|
2334
|
+
const pkgDir = process.env.INIT_CWD;
|
|
2335
|
+
const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2336
|
+
await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2337
|
+
const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2338
|
+
console.log(chalk32.green(`Publint: ${pkg.name}`));
|
|
2339
|
+
console.log(chalk32.gray(pkgDir));
|
|
2340
|
+
const { publint: publint2 } = await import("publint");
|
|
2341
|
+
const { messages } = await publint2({
|
|
2342
|
+
level: "suggestion",
|
|
2343
|
+
pkgDir,
|
|
2344
|
+
strict
|
|
2345
|
+
});
|
|
2346
|
+
const { formatMessage } = await import("publint/utils");
|
|
2347
|
+
const validMessage = /* @__PURE__ */ __name((_message) => {
|
|
2348
|
+
return true;
|
|
2349
|
+
}, "validMessage");
|
|
2350
|
+
const validMessages = messages.filter(validMessage);
|
|
2351
|
+
for (const message of validMessages) {
|
|
2352
|
+
switch (message.type) {
|
|
2353
|
+
case "error": {
|
|
2354
|
+
console.error(chalk32.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2355
|
+
break;
|
|
2356
|
+
}
|
|
2357
|
+
case "warning": {
|
|
2358
|
+
console.warn(chalk32.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2359
|
+
break;
|
|
2360
|
+
}
|
|
2361
|
+
default: {
|
|
2362
|
+
console.log(chalk32.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2363
|
+
break;
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
if (verbose) {
|
|
2368
|
+
console.log(chalk32.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
2369
|
+
}
|
|
2370
|
+
return validMessages.filter((message) => message.type === "error").length;
|
|
2371
|
+
}, "packagePublint");
|
|
1944
2372
|
|
|
1945
2373
|
// src/actions/package/recompile.ts
|
|
1946
|
-
var packageRecompile = async () => {
|
|
2374
|
+
var packageRecompile = /* @__PURE__ */ __name(async () => {
|
|
1947
2375
|
return await packageClean() || await packageCompile();
|
|
1948
|
-
};
|
|
2376
|
+
}, "packageRecompile");
|
|
1949
2377
|
|
|
1950
2378
|
// src/actions/publint.ts
|
|
1951
|
-
var publint = async ({ verbose, pkg }) => {
|
|
1952
|
-
return pkg
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
}
|
|
2379
|
+
var publint = /* @__PURE__ */ __name(async ({ verbose, pkg }) => {
|
|
2380
|
+
return pkg === void 0 ? publintAll({
|
|
2381
|
+
verbose
|
|
2382
|
+
}) : await publintPackage({
|
|
2383
|
+
pkg,
|
|
2384
|
+
verbose
|
|
2385
|
+
});
|
|
2386
|
+
}, "publint");
|
|
2387
|
+
var publintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
2388
|
+
return runStepsAsync(`Publint [${pkg}]`, [
|
|
2389
|
+
[
|
|
2390
|
+
"yarn",
|
|
2391
|
+
[
|
|
2392
|
+
"workspace",
|
|
2393
|
+
pkg,
|
|
2394
|
+
"run",
|
|
2395
|
+
"package-publint"
|
|
2396
|
+
]
|
|
2397
|
+
]
|
|
2398
|
+
]);
|
|
2399
|
+
}, "publintPackage");
|
|
2400
|
+
var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
2401
|
+
const verboseOptions = verbose ? [
|
|
2402
|
+
"--verbose"
|
|
2403
|
+
] : [
|
|
2404
|
+
"--no-verbose"
|
|
2405
|
+
];
|
|
2406
|
+
return runSteps("Publint", [
|
|
2407
|
+
[
|
|
2408
|
+
"yarn",
|
|
2409
|
+
[
|
|
2410
|
+
"workspaces",
|
|
2411
|
+
"foreach",
|
|
2412
|
+
"-pA",
|
|
2413
|
+
...verboseOptions,
|
|
2414
|
+
"run",
|
|
2415
|
+
"package-publint"
|
|
2416
|
+
]
|
|
2417
|
+
]
|
|
2418
|
+
]);
|
|
2419
|
+
}, "publintAll");
|
|
1961
2420
|
|
|
1962
2421
|
// src/actions/rebuild.ts
|
|
1963
|
-
var rebuild = ({ target }) => {
|
|
2422
|
+
var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
1964
2423
|
return runSteps("Rebuild", [
|
|
1965
|
-
[
|
|
1966
|
-
|
|
2424
|
+
[
|
|
2425
|
+
"yarn",
|
|
2426
|
+
"xy clean"
|
|
2427
|
+
],
|
|
2428
|
+
[
|
|
2429
|
+
"yarn",
|
|
2430
|
+
target ? `xy build -t ${target}` : "xy build"
|
|
2431
|
+
]
|
|
1967
2432
|
]);
|
|
1968
|
-
};
|
|
2433
|
+
}, "rebuild");
|
|
1969
2434
|
|
|
1970
2435
|
// src/actions/recompile.ts
|
|
1971
|
-
import
|
|
1972
|
-
var recompile = async ({
|
|
1973
|
-
verbose,
|
|
1974
|
-
target,
|
|
1975
|
-
pkg,
|
|
1976
|
-
incremental
|
|
1977
|
-
}) => {
|
|
2436
|
+
import chalk33 from "chalk";
|
|
2437
|
+
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
1978
2438
|
return pkg ? await recompilePackage({
|
|
1979
2439
|
pkg,
|
|
1980
2440
|
target,
|
|
@@ -1984,27 +2444,51 @@ var recompile = async ({
|
|
|
1984
2444
|
target,
|
|
1985
2445
|
verbose
|
|
1986
2446
|
});
|
|
1987
|
-
};
|
|
1988
|
-
var recompilePackage = ({ target, pkg }) => {
|
|
1989
|
-
const targetOptions = target ? [
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2447
|
+
}, "recompile");
|
|
2448
|
+
var recompilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
|
|
2449
|
+
const targetOptions = target ? [
|
|
2450
|
+
"-t",
|
|
2451
|
+
target
|
|
2452
|
+
] : [];
|
|
2453
|
+
return runStepsAsync(`Recompile [${pkg}]`, [
|
|
2454
|
+
[
|
|
2455
|
+
"yarn",
|
|
2456
|
+
[
|
|
2457
|
+
"workspace",
|
|
2458
|
+
pkg,
|
|
2459
|
+
"run",
|
|
2460
|
+
"package-recompile",
|
|
2461
|
+
...targetOptions
|
|
2462
|
+
]
|
|
2463
|
+
]
|
|
2464
|
+
]);
|
|
2465
|
+
}, "recompilePackage");
|
|
2466
|
+
var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, incremental }) => {
|
|
2001
2467
|
const start = Date.now();
|
|
2002
|
-
const verboseOptions = verbose ? [
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2468
|
+
const verboseOptions = verbose ? [
|
|
2469
|
+
"--verbose"
|
|
2470
|
+
] : [
|
|
2471
|
+
"--no-verbose"
|
|
2472
|
+
];
|
|
2473
|
+
const targetOptions = target ? [
|
|
2474
|
+
"-t",
|
|
2475
|
+
target
|
|
2476
|
+
] : [];
|
|
2477
|
+
const incrementalOptions = incremental ? [
|
|
2478
|
+
"--since",
|
|
2479
|
+
"-Apt",
|
|
2480
|
+
"--topological-dev"
|
|
2481
|
+
] : [
|
|
2482
|
+
"--parallel",
|
|
2483
|
+
"-Apt",
|
|
2484
|
+
"--topological-dev"
|
|
2485
|
+
];
|
|
2486
|
+
const jobsOptions = jobs ? [
|
|
2487
|
+
"-j",
|
|
2488
|
+
`${jobs}`
|
|
2489
|
+
] : [];
|
|
2006
2490
|
if (jobs) {
|
|
2007
|
-
console.log(
|
|
2491
|
+
console.log(chalk33.blue(`Jobs set to [${jobs}]`));
|
|
2008
2492
|
}
|
|
2009
2493
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2010
2494
|
[
|
|
@@ -2034,19 +2518,13 @@ var recompileAll = async ({
|
|
|
2034
2518
|
]
|
|
2035
2519
|
]
|
|
2036
2520
|
]);
|
|
2037
|
-
console.log(
|
|
2038
|
-
`${chalk31.gray("Recompiled in")} [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`
|
|
2039
|
-
);
|
|
2521
|
+
console.log(`${chalk33.gray("Recompiled in")} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`);
|
|
2040
2522
|
return result;
|
|
2041
|
-
};
|
|
2523
|
+
}, "recompileAll");
|
|
2042
2524
|
|
|
2043
2525
|
// src/actions/reinstall.ts
|
|
2044
|
-
import {
|
|
2045
|
-
|
|
2046
|
-
openSync,
|
|
2047
|
-
rmSync
|
|
2048
|
-
} from "fs";
|
|
2049
|
-
var reinstall = () => {
|
|
2526
|
+
import { closeSync, openSync, rmSync } from "fs";
|
|
2527
|
+
var reinstall = /* @__PURE__ */ __name(() => {
|
|
2050
2528
|
console.log("Reinstall [Clear Lock File]");
|
|
2051
2529
|
closeSync(openSync("./yarn.lock", "w"));
|
|
2052
2530
|
console.log("Reinstall [Clear Node Modules]");
|
|
@@ -2054,7 +2532,10 @@ var reinstall = () => {
|
|
|
2054
2532
|
const result = workspaces.map(({ location, name }) => {
|
|
2055
2533
|
const dist = `${location}/node_modules`;
|
|
2056
2534
|
try {
|
|
2057
|
-
rmSync(dist, {
|
|
2535
|
+
rmSync(dist, {
|
|
2536
|
+
force: true,
|
|
2537
|
+
recursive: true
|
|
2538
|
+
});
|
|
2058
2539
|
return 0;
|
|
2059
2540
|
} catch (ex) {
|
|
2060
2541
|
const error = ex;
|
|
@@ -2062,115 +2543,226 @@ var reinstall = () => {
|
|
|
2062
2543
|
return 1;
|
|
2063
2544
|
}
|
|
2064
2545
|
}).reduce((prev, result2) => prev || result2, 0);
|
|
2065
|
-
return result || runSteps("Reinstall", [
|
|
2066
|
-
|
|
2546
|
+
return result || runSteps("Reinstall", [
|
|
2547
|
+
[
|
|
2548
|
+
"yarn",
|
|
2549
|
+
"install --network-timeout 10000"
|
|
2550
|
+
]
|
|
2551
|
+
]);
|
|
2552
|
+
}, "reinstall");
|
|
2067
2553
|
|
|
2068
2554
|
// src/actions/relint.ts
|
|
2069
|
-
import
|
|
2070
|
-
var relintPackage = ({ pkg }) => {
|
|
2071
|
-
console.log(
|
|
2555
|
+
import chalk34 from "chalk";
|
|
2556
|
+
var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
2557
|
+
console.log(chalk34.gray(`${"Relint"} [All-Packages]`));
|
|
2072
2558
|
const start = Date.now();
|
|
2073
2559
|
const result = runSteps("Relint [All-Packages]", [
|
|
2074
|
-
[
|
|
2075
|
-
"
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2560
|
+
[
|
|
2561
|
+
"yarn",
|
|
2562
|
+
[
|
|
2563
|
+
"workspace",
|
|
2564
|
+
pkg,
|
|
2565
|
+
"run",
|
|
2566
|
+
"package-relint"
|
|
2567
|
+
]
|
|
2568
|
+
]
|
|
2080
2569
|
]);
|
|
2081
|
-
console.log(
|
|
2570
|
+
console.log(chalk34.gray(`${"Relinted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
|
|
2082
2571
|
return result;
|
|
2083
|
-
};
|
|
2084
|
-
var relint = ({
|
|
2085
|
-
pkg
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
};
|
|
2091
|
-
|
|
2092
|
-
|
|
2572
|
+
}, "relintPackage");
|
|
2573
|
+
var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
|
|
2574
|
+
return pkg ? relintPackage({
|
|
2575
|
+
pkg
|
|
2576
|
+
}) : relintAllPackages({
|
|
2577
|
+
verbose,
|
|
2578
|
+
incremental
|
|
2579
|
+
});
|
|
2580
|
+
}, "relint");
|
|
2581
|
+
var relintAllPackages = /* @__PURE__ */ __name(({ verbose = false, incremental } = {}) => {
|
|
2582
|
+
console.log(chalk34.gray(`${"Relint"} [All-Packages]`));
|
|
2093
2583
|
const start = Date.now();
|
|
2094
|
-
const verboseOptions = verbose ? [
|
|
2095
|
-
|
|
2584
|
+
const verboseOptions = verbose ? [
|
|
2585
|
+
"--verbose"
|
|
2586
|
+
] : [
|
|
2587
|
+
"--no-verbose"
|
|
2588
|
+
];
|
|
2589
|
+
const incrementalOptions = incremental ? [
|
|
2590
|
+
"--since",
|
|
2591
|
+
"-Ap"
|
|
2592
|
+
] : [
|
|
2593
|
+
"--parallel",
|
|
2594
|
+
"-Ap"
|
|
2595
|
+
];
|
|
2096
2596
|
const result = runSteps(`${"Relint"} [All-Packages]`, [
|
|
2097
|
-
[
|
|
2098
|
-
"
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2597
|
+
[
|
|
2598
|
+
"yarn",
|
|
2599
|
+
[
|
|
2600
|
+
"workspaces",
|
|
2601
|
+
"foreach",
|
|
2602
|
+
...verboseOptions,
|
|
2603
|
+
...incrementalOptions,
|
|
2604
|
+
"run",
|
|
2605
|
+
"package-relint"
|
|
2606
|
+
]
|
|
2607
|
+
]
|
|
2105
2608
|
]);
|
|
2106
|
-
console.log(
|
|
2609
|
+
console.log(chalk34.gray(`Relinted in [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
|
|
2107
2610
|
return result;
|
|
2108
|
-
};
|
|
2611
|
+
}, "relintAllPackages");
|
|
2109
2612
|
|
|
2110
2613
|
// src/actions/retest.ts
|
|
2111
|
-
var retest = () => {
|
|
2614
|
+
var retest = /* @__PURE__ */ __name(() => {
|
|
2112
2615
|
return runSteps("Test", [
|
|
2113
|
-
[
|
|
2114
|
-
|
|
2616
|
+
[
|
|
2617
|
+
"yarn",
|
|
2618
|
+
[
|
|
2619
|
+
"jest",
|
|
2620
|
+
"--clearCache"
|
|
2621
|
+
]
|
|
2622
|
+
],
|
|
2623
|
+
[
|
|
2624
|
+
"yarn",
|
|
2625
|
+
[
|
|
2626
|
+
"jest",
|
|
2627
|
+
"."
|
|
2628
|
+
]
|
|
2629
|
+
]
|
|
2115
2630
|
]);
|
|
2116
|
-
};
|
|
2631
|
+
}, "retest");
|
|
2117
2632
|
|
|
2118
2633
|
// src/actions/sonar.ts
|
|
2119
|
-
var sonar = () => {
|
|
2120
|
-
return runSteps("Sonar", [
|
|
2121
|
-
|
|
2634
|
+
var sonar = /* @__PURE__ */ __name(() => {
|
|
2635
|
+
return runSteps("Sonar", [
|
|
2636
|
+
[
|
|
2637
|
+
"yarn",
|
|
2638
|
+
[
|
|
2639
|
+
"eslint",
|
|
2640
|
+
"-c",
|
|
2641
|
+
"sonar.eslintrc",
|
|
2642
|
+
"."
|
|
2643
|
+
]
|
|
2644
|
+
]
|
|
2645
|
+
]);
|
|
2646
|
+
}, "sonar");
|
|
2122
2647
|
|
|
2123
2648
|
// src/actions/statics.ts
|
|
2124
|
-
import
|
|
2125
|
-
var DefaultDependencies = [
|
|
2126
|
-
|
|
2127
|
-
|
|
2649
|
+
import chalk35 from "chalk";
|
|
2650
|
+
var DefaultDependencies = [
|
|
2651
|
+
"axios",
|
|
2652
|
+
"@xylabs/pixel",
|
|
2653
|
+
"react",
|
|
2654
|
+
"graphql",
|
|
2655
|
+
"react-router",
|
|
2656
|
+
"@mui/material",
|
|
2657
|
+
"@mui/system"
|
|
2658
|
+
];
|
|
2659
|
+
var statics = /* @__PURE__ */ __name(() => {
|
|
2660
|
+
console.log(chalk35.green("Check Required Static Dependencies"));
|
|
2128
2661
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2129
2662
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2130
|
-
};
|
|
2663
|
+
}, "statics");
|
|
2131
2664
|
|
|
2132
2665
|
// src/actions/test.ts
|
|
2133
|
-
var test = () => {
|
|
2134
|
-
return runSteps("Test", [
|
|
2135
|
-
|
|
2666
|
+
var test = /* @__PURE__ */ __name(() => {
|
|
2667
|
+
return runSteps("Test", [
|
|
2668
|
+
[
|
|
2669
|
+
"yarn",
|
|
2670
|
+
[
|
|
2671
|
+
"vitest",
|
|
2672
|
+
"."
|
|
2673
|
+
]
|
|
2674
|
+
]
|
|
2675
|
+
]);
|
|
2676
|
+
}, "test");
|
|
2136
2677
|
|
|
2137
2678
|
// src/actions/up.ts
|
|
2138
|
-
var up = () => {
|
|
2139
|
-
return runSteps("Up", [
|
|
2140
|
-
|
|
2679
|
+
var up = /* @__PURE__ */ __name(() => {
|
|
2680
|
+
return runSteps("Up", [
|
|
2681
|
+
[
|
|
2682
|
+
"yarn",
|
|
2683
|
+
"outdated"
|
|
2684
|
+
]
|
|
2685
|
+
]);
|
|
2686
|
+
}, "up");
|
|
2141
2687
|
|
|
2142
2688
|
// src/actions/updo.ts
|
|
2143
|
-
var updo = () => {
|
|
2689
|
+
var updo = /* @__PURE__ */ __name(() => {
|
|
2144
2690
|
return runSteps("Updo", [
|
|
2145
|
-
[
|
|
2146
|
-
|
|
2147
|
-
|
|
2691
|
+
[
|
|
2692
|
+
"yarn",
|
|
2693
|
+
"install"
|
|
2694
|
+
],
|
|
2695
|
+
[
|
|
2696
|
+
"yarn",
|
|
2697
|
+
"upgrade-interactive"
|
|
2698
|
+
],
|
|
2699
|
+
[
|
|
2700
|
+
"yarn",
|
|
2701
|
+
"dedupe"
|
|
2702
|
+
]
|
|
2148
2703
|
]);
|
|
2149
|
-
};
|
|
2704
|
+
}, "updo");
|
|
2150
2705
|
|
|
2151
2706
|
// src/actions/upplug.ts
|
|
2152
|
-
var updateYarnPlugins = () => {
|
|
2707
|
+
var updateYarnPlugins = /* @__PURE__ */ __name(() => {
|
|
2153
2708
|
return runSteps("Update Yarn Plugins", [
|
|
2154
|
-
[
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2709
|
+
[
|
|
2710
|
+
"yarn",
|
|
2711
|
+
[
|
|
2712
|
+
"plugin",
|
|
2713
|
+
"import",
|
|
2714
|
+
"https://mskelton.dev/yarn-outdated/v3"
|
|
2715
|
+
]
|
|
2716
|
+
],
|
|
2717
|
+
[
|
|
2718
|
+
"yarn",
|
|
2719
|
+
[
|
|
2720
|
+
"plugin",
|
|
2721
|
+
"import",
|
|
2722
|
+
"version"
|
|
2723
|
+
]
|
|
2724
|
+
],
|
|
2725
|
+
[
|
|
2726
|
+
"yarn",
|
|
2727
|
+
[
|
|
2728
|
+
"plugin",
|
|
2729
|
+
"import",
|
|
2730
|
+
"interactive-tools"
|
|
2731
|
+
]
|
|
2732
|
+
],
|
|
2733
|
+
[
|
|
2734
|
+
"yarn",
|
|
2735
|
+
[
|
|
2736
|
+
"plugin",
|
|
2737
|
+
"import",
|
|
2738
|
+
"workspace-tools"
|
|
2739
|
+
]
|
|
2740
|
+
]
|
|
2158
2741
|
]);
|
|
2159
|
-
};
|
|
2742
|
+
}, "updateYarnPlugins");
|
|
2160
2743
|
|
|
2161
2744
|
// src/actions/upyarn.ts
|
|
2162
|
-
var updateYarnVersion = () => {
|
|
2163
|
-
return runSteps("Update Yarn Version", [
|
|
2164
|
-
|
|
2745
|
+
var updateYarnVersion = /* @__PURE__ */ __name(() => {
|
|
2746
|
+
return runSteps("Update Yarn Version", [
|
|
2747
|
+
[
|
|
2748
|
+
"yarn",
|
|
2749
|
+
[
|
|
2750
|
+
"set",
|
|
2751
|
+
"version",
|
|
2752
|
+
"latest"
|
|
2753
|
+
]
|
|
2754
|
+
]
|
|
2755
|
+
]);
|
|
2756
|
+
}, "updateYarnVersion");
|
|
2165
2757
|
|
|
2166
2758
|
// src/actions/yarn3only.ts
|
|
2167
|
-
var yarn3Only = () => {
|
|
2759
|
+
var yarn3Only = /* @__PURE__ */ __name(() => {
|
|
2168
2760
|
const [valid, version] = isYarnVersionOrGreater(3);
|
|
2169
2761
|
if (!valid) {
|
|
2170
2762
|
processEx(`Invalid Yarn version [${version}]`);
|
|
2171
2763
|
}
|
|
2172
2764
|
return 0;
|
|
2173
|
-
};
|
|
2765
|
+
}, "yarn3Only");
|
|
2174
2766
|
export {
|
|
2175
2767
|
build,
|
|
2176
2768
|
bundleDts,
|
|
@@ -2181,9 +2773,6 @@ export {
|
|
|
2181
2773
|
compile,
|
|
2182
2774
|
compileAll,
|
|
2183
2775
|
compilePackage,
|
|
2184
|
-
compileTypes,
|
|
2185
|
-
compileTypesAll,
|
|
2186
|
-
compileTypesPackage,
|
|
2187
2776
|
copyAssets,
|
|
2188
2777
|
cycle,
|
|
2189
2778
|
cycleAll,
|