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