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