@xylabs/ts-scripts-yarn3 6.3.5 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/build.mjs +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-types.mjs +45 -68
- package/dist/actions/compile-types.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.mjs +195 -0
- package/dist/actions/deplint.mjs.map +1 -0
- package/dist/actions/deploy-major.mjs +20 -41
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +20 -41
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +20 -41
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +20 -41
- 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 +864 -1241
- 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 +7 -17
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +133 -169
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +43 -59
- package/dist/actions/package/compile/compileTypes.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 +11 -10
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +133 -169
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +3 -8
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +127 -163
- 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 +191 -271
- 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 +4 -7
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +147 -197
- 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 +134 -172
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +134 -172
- 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 +134 -172
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +128 -165
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +44 -61
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +134 -171
- 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 +6 -16
- 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 +4 -6
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +147 -196
- 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 +1086 -1237
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1338 -1583
- 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 +100 -154
- 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 +4 -8
- 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 +1086 -1238
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +3 -8
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +1086 -1238
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +276 -382
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +251 -335
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +84 -130
- 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 +413 -292
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +4 -13
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +3 -22
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 "node: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 "node:child_process";
|
|
@@ -37,17 +31,17 @@ import { execSync } from "node: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 "node: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 "node: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 "node: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 "node: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 cwd4 = 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(cwd4), readEntries(location)));
|
|
@@ -325,41 +290,40 @@ 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";
|
|
332
297
|
import { cosmiconfig } from "cosmiconfig";
|
|
298
|
+
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
333
299
|
import deepmerge from "deepmerge";
|
|
334
300
|
var config;
|
|
335
|
-
var loadConfig =
|
|
301
|
+
var loadConfig = async (params) => {
|
|
336
302
|
if (config) {
|
|
337
303
|
return deepmerge(config, params ?? {});
|
|
338
304
|
}
|
|
339
|
-
const cosmicConfigResult = await cosmiconfig("xy", {
|
|
340
|
-
cache: true
|
|
341
|
-
}).search();
|
|
305
|
+
const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
|
|
342
306
|
config = cosmicConfigResult?.config;
|
|
343
307
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
344
308
|
if (configFilePath) {
|
|
345
309
|
console.log(chalk5.gray(`Loading config from ${configFilePath}`));
|
|
346
310
|
}
|
|
347
311
|
return deepmerge(config, params ?? {});
|
|
348
|
-
}
|
|
312
|
+
};
|
|
349
313
|
|
|
350
314
|
// src/lib/parsedPackageJSON.ts
|
|
351
315
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
352
|
-
var parsedPackageJSON =
|
|
353
|
-
const pathToPackageJSON =
|
|
316
|
+
var parsedPackageJSON = (path9) => {
|
|
317
|
+
const pathToPackageJSON = path9 ?? process.env.npm_package_json ?? "";
|
|
354
318
|
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
355
319
|
return JSON.parse(packageJSON);
|
|
356
|
-
}
|
|
320
|
+
};
|
|
357
321
|
|
|
358
322
|
// src/lib/runSteps.ts
|
|
359
323
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
360
324
|
import { existsSync as existsSync2 } from "node:fs";
|
|
361
325
|
import chalk6 from "chalk";
|
|
362
|
-
var runSteps =
|
|
326
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
363
327
|
return safeExit(() => {
|
|
364
328
|
const pkgName = process.env.npm_package_name;
|
|
365
329
|
console.log(chalk6.green(`${name} [${pkgName}]`));
|
|
@@ -375,10 +339,7 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
375
339
|
const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
|
|
376
340
|
...config2,
|
|
377
341
|
encoding: "utf8",
|
|
378
|
-
env: {
|
|
379
|
-
FORCE_COLOR: "3",
|
|
380
|
-
...process.env
|
|
381
|
-
},
|
|
342
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
382
343
|
shell: true,
|
|
383
344
|
stdio: "inherit"
|
|
384
345
|
}).status ?? 0;
|
|
@@ -387,13 +348,13 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
387
348
|
}
|
|
388
349
|
return totalStatus;
|
|
389
350
|
}, !!exitOnFail);
|
|
390
|
-
}
|
|
351
|
+
};
|
|
391
352
|
|
|
392
353
|
// src/lib/runStepsAsync.ts
|
|
393
354
|
import { spawn } from "node:child_process";
|
|
394
355
|
import { existsSync as existsSync3 } from "node:fs";
|
|
395
356
|
import chalk7 from "chalk";
|
|
396
|
-
var runStepAsync =
|
|
357
|
+
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
397
358
|
return new Promise((resolve) => {
|
|
398
359
|
const [command, args, config2] = step;
|
|
399
360
|
if (message) {
|
|
@@ -405,15 +366,18 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
|
|
|
405
366
|
}
|
|
406
367
|
spawn(command, Array.isArray(args) ? args : args.split(" "), {
|
|
407
368
|
...config2,
|
|
408
|
-
env: {
|
|
409
|
-
FORCE_COLOR: "3",
|
|
410
|
-
...process.env
|
|
411
|
-
},
|
|
369
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
412
370
|
shell: true,
|
|
413
371
|
stdio: "inherit"
|
|
414
372
|
}).on("close", (code) => {
|
|
415
373
|
if (code) {
|
|
416
|
-
console.error(
|
|
374
|
+
console.error(
|
|
375
|
+
chalk7.red(
|
|
376
|
+
`Command Exited With Non-Zero Result [${chalk7.gray(code)}] | ${chalk7.yellow(command)} ${chalk7.white(
|
|
377
|
+
Array.isArray(args) ? args.join(" ") : args
|
|
378
|
+
)}`
|
|
379
|
+
)
|
|
380
|
+
);
|
|
417
381
|
checkResult(name, code, "error", exitOnFail);
|
|
418
382
|
resolve(code);
|
|
419
383
|
} else {
|
|
@@ -421,8 +385,8 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
|
|
|
421
385
|
}
|
|
422
386
|
});
|
|
423
387
|
});
|
|
424
|
-
}
|
|
425
|
-
var runStepsAsync =
|
|
388
|
+
};
|
|
389
|
+
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
426
390
|
return await safeExitAsync(async () => {
|
|
427
391
|
const pkgName = process.env.npm_package_name;
|
|
428
392
|
console.log(chalk7.green(`${name} [${pkgName}]`));
|
|
@@ -432,139 +396,67 @@ var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true
|
|
|
432
396
|
}
|
|
433
397
|
return result;
|
|
434
398
|
});
|
|
435
|
-
}
|
|
399
|
+
};
|
|
436
400
|
|
|
437
401
|
// src/actions/build.ts
|
|
438
|
-
var build =
|
|
402
|
+
var build = async ({
|
|
403
|
+
incremental,
|
|
404
|
+
jobs,
|
|
405
|
+
target,
|
|
406
|
+
verbose,
|
|
407
|
+
pkg
|
|
408
|
+
}) => {
|
|
439
409
|
const start = Date.now();
|
|
440
|
-
const pkgOptions = pkg ? [
|
|
441
|
-
|
|
442
|
-
] : [];
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
] : [];
|
|
446
|
-
const verboseOptions = verbose ? [
|
|
447
|
-
"-v"
|
|
448
|
-
] : [];
|
|
449
|
-
const targetOptions = target ? [
|
|
450
|
-
"-t",
|
|
451
|
-
target
|
|
452
|
-
] : [];
|
|
453
|
-
const jobsOptions = jobs ? [
|
|
454
|
-
"-j",
|
|
455
|
-
`${jobs}`
|
|
456
|
-
] : [];
|
|
410
|
+
const pkgOptions = pkg ? [pkg] : [];
|
|
411
|
+
const incrementalOptions = incremental ? ["-i"] : [];
|
|
412
|
+
const verboseOptions = verbose ? ["-v"] : [];
|
|
413
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
414
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
457
415
|
if (jobs) {
|
|
458
416
|
console.log(chalk8.blue(`Jobs set to [${jobs}]`));
|
|
459
417
|
}
|
|
460
418
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
461
|
-
[
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
"compile",
|
|
466
|
-
...pkgOptions,
|
|
467
|
-
...targetOptions,
|
|
468
|
-
...verboseOptions,
|
|
469
|
-
...jobsOptions,
|
|
470
|
-
...incrementalOptions,
|
|
471
|
-
"--types",
|
|
472
|
-
"tsup"
|
|
473
|
-
]
|
|
474
|
-
],
|
|
475
|
-
[
|
|
476
|
-
"yarn",
|
|
477
|
-
[
|
|
478
|
-
"xy",
|
|
479
|
-
"publint",
|
|
480
|
-
...pkgOptions,
|
|
481
|
-
...verboseOptions,
|
|
482
|
-
...jobsOptions,
|
|
483
|
-
...incrementalOptions
|
|
484
|
-
]
|
|
485
|
-
],
|
|
486
|
-
[
|
|
487
|
-
"yarn",
|
|
488
|
-
[
|
|
489
|
-
"xy",
|
|
490
|
-
"knip",
|
|
491
|
-
...pkgOptions,
|
|
492
|
-
...verboseOptions,
|
|
493
|
-
...jobsOptions,
|
|
494
|
-
...incrementalOptions
|
|
495
|
-
]
|
|
496
|
-
],
|
|
497
|
-
[
|
|
498
|
-
"yarn",
|
|
499
|
-
[
|
|
500
|
-
"xy",
|
|
501
|
-
"lint",
|
|
502
|
-
...pkgOptions,
|
|
503
|
-
...verboseOptions,
|
|
504
|
-
...incrementalOptions
|
|
505
|
-
]
|
|
506
|
-
]
|
|
419
|
+
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
420
|
+
["yarn", ["xy", "publint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
421
|
+
["yarn", ["xy", "knip", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
422
|
+
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
507
423
|
]);
|
|
508
424
|
console.log(`${chalk8.gray("Built in")} [${chalk8.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk8.gray("seconds")}`);
|
|
509
425
|
return result;
|
|
510
|
-
}
|
|
426
|
+
};
|
|
511
427
|
|
|
512
428
|
// src/actions/clean.ts
|
|
513
|
-
var clean =
|
|
514
|
-
return pkg ? await cleanPackage({
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
[
|
|
524
|
-
"yarn",
|
|
525
|
-
[
|
|
526
|
-
"workspace",
|
|
527
|
-
pkg,
|
|
528
|
-
"run",
|
|
529
|
-
"package-clean"
|
|
530
|
-
]
|
|
531
|
-
]
|
|
532
|
-
]);
|
|
533
|
-
}, "cleanPackage");
|
|
534
|
-
var cleanAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
535
|
-
const verboseOptions = verbose ? [
|
|
536
|
-
"--verbose"
|
|
537
|
-
] : [
|
|
538
|
-
"--no-verbose"
|
|
539
|
-
];
|
|
540
|
-
return runStepsAsync("Clean", [
|
|
541
|
-
[
|
|
542
|
-
"yarn",
|
|
543
|
-
[
|
|
544
|
-
"workspaces foreach",
|
|
545
|
-
"-pA",
|
|
546
|
-
"--jobs 64",
|
|
547
|
-
...verboseOptions,
|
|
548
|
-
"run",
|
|
549
|
-
"package-clean"
|
|
550
|
-
]
|
|
551
|
-
]
|
|
552
|
-
]);
|
|
553
|
-
}, "cleanAll");
|
|
429
|
+
var clean = async ({ verbose, pkg }) => {
|
|
430
|
+
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
431
|
+
};
|
|
432
|
+
var cleanPackage = ({ pkg }) => {
|
|
433
|
+
return runStepsAsync(`Clean [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-clean"]]]);
|
|
434
|
+
};
|
|
435
|
+
var cleanAll = ({ verbose }) => {
|
|
436
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
437
|
+
return runStepsAsync("Clean", [["yarn", ["workspaces foreach", "-pA", "--jobs 64", ...verboseOptions, "run", "package-clean"]]]);
|
|
438
|
+
};
|
|
554
439
|
|
|
555
440
|
// src/actions/clean-docs.ts
|
|
556
441
|
import path from "node:path";
|
|
557
442
|
import chalk9 from "chalk";
|
|
558
|
-
var cleanDocs =
|
|
443
|
+
var cleanDocs = () => {
|
|
559
444
|
const pkgName = process.env.npm_package_name;
|
|
560
445
|
console.log(chalk9.green(`Cleaning Docs [${pkgName}]`));
|
|
561
446
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
562
447
|
return 0;
|
|
563
|
-
}
|
|
448
|
+
};
|
|
564
449
|
|
|
565
450
|
// src/actions/compile.ts
|
|
566
451
|
import chalk10 from "chalk";
|
|
567
|
-
var compile =
|
|
452
|
+
var compile = ({
|
|
453
|
+
verbose,
|
|
454
|
+
target,
|
|
455
|
+
pkg,
|
|
456
|
+
incremental,
|
|
457
|
+
publint: publint2,
|
|
458
|
+
jobs
|
|
459
|
+
}) => {
|
|
568
460
|
return pkg ? compilePackage({
|
|
569
461
|
pkg,
|
|
570
462
|
publint: publint2,
|
|
@@ -577,164 +469,114 @@ var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publi
|
|
|
577
469
|
verbose,
|
|
578
470
|
jobs
|
|
579
471
|
});
|
|
580
|
-
}
|
|
581
|
-
var compilePackage =
|
|
582
|
-
const targetOptions = target ? [
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
...targetOptions
|
|
595
|
-
]
|
|
596
|
-
]
|
|
597
|
-
]);
|
|
598
|
-
}, "compilePackage");
|
|
599
|
-
var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental }) => {
|
|
472
|
+
};
|
|
473
|
+
var compilePackage = ({ target, pkg }) => {
|
|
474
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
475
|
+
return runSteps(
|
|
476
|
+
`Compile [${pkg}]`,
|
|
477
|
+
[["yarn", ["workspace", pkg, "run", "package-compile", ...targetOptions]]]
|
|
478
|
+
);
|
|
479
|
+
};
|
|
480
|
+
var compileAll = ({
|
|
481
|
+
jobs,
|
|
482
|
+
verbose,
|
|
483
|
+
target,
|
|
484
|
+
incremental
|
|
485
|
+
}) => {
|
|
600
486
|
const start = Date.now();
|
|
601
|
-
const verboseOptions = verbose ? [
|
|
602
|
-
|
|
603
|
-
] : [
|
|
604
|
-
|
|
605
|
-
];
|
|
606
|
-
const targetOptions = target ? [
|
|
607
|
-
"-t",
|
|
608
|
-
target
|
|
609
|
-
] : [];
|
|
610
|
-
const incrementalOptions = incremental ? [
|
|
611
|
-
"--since",
|
|
612
|
-
"-Apt",
|
|
613
|
-
"--topological-dev"
|
|
614
|
-
] : [
|
|
615
|
-
"--parallel",
|
|
616
|
-
"-Apt",
|
|
617
|
-
"--topological-dev"
|
|
618
|
-
];
|
|
619
|
-
const jobsOptions = jobs ? [
|
|
620
|
-
"-j",
|
|
621
|
-
`${jobs}`
|
|
622
|
-
] : [];
|
|
487
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
488
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
489
|
+
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
490
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
623
491
|
if (jobs) {
|
|
624
492
|
console.log(chalk10.blue(`Jobs set to [${jobs}]`));
|
|
625
493
|
}
|
|
626
494
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
627
|
-
[
|
|
628
|
-
"
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
...targetOptions
|
|
638
|
-
]
|
|
639
|
-
]
|
|
495
|
+
["yarn", [
|
|
496
|
+
"workspaces",
|
|
497
|
+
"foreach",
|
|
498
|
+
...incrementalOptions,
|
|
499
|
+
...jobsOptions,
|
|
500
|
+
...verboseOptions,
|
|
501
|
+
"run",
|
|
502
|
+
"package-compile",
|
|
503
|
+
...targetOptions
|
|
504
|
+
]]
|
|
640
505
|
]);
|
|
641
506
|
console.log(`${chalk10.gray("Compiled in")} [${chalk10.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk10.gray("seconds")}`);
|
|
642
507
|
return result;
|
|
643
|
-
}
|
|
508
|
+
};
|
|
644
509
|
|
|
645
510
|
// src/actions/compile-types.ts
|
|
646
511
|
import chalk11 from "chalk";
|
|
647
|
-
var compileTypes =
|
|
512
|
+
var compileTypes = ({
|
|
513
|
+
verbose,
|
|
514
|
+
pkg,
|
|
515
|
+
incremental,
|
|
516
|
+
jobs
|
|
517
|
+
}) => {
|
|
648
518
|
if (verbose) {
|
|
649
519
|
console.log(chalk11.gray("Compiling Types"));
|
|
650
520
|
}
|
|
651
|
-
return pkg ? compileTypesPackage({
|
|
652
|
-
pkg,
|
|
653
|
-
verbose
|
|
654
|
-
}) : compileTypesAll({
|
|
521
|
+
return pkg ? compileTypesPackage({ pkg, verbose }) : compileTypesAll({
|
|
655
522
|
incremental,
|
|
656
523
|
verbose,
|
|
657
524
|
jobs
|
|
658
525
|
});
|
|
659
|
-
}
|
|
660
|
-
var compileTypesPackage =
|
|
526
|
+
};
|
|
527
|
+
var compileTypesPackage = ({ verbose, pkg }) => {
|
|
661
528
|
if (verbose) {
|
|
662
529
|
console.log(chalk11.gray("Compiling Types [Package]"));
|
|
663
530
|
}
|
|
664
|
-
return runSteps(
|
|
665
|
-
[
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
]);
|
|
675
|
-
}, "compileTypesPackage");
|
|
676
|
-
var compileTypesAll = /* @__PURE__ */ __name(({ jobs, verbose, incremental }) => {
|
|
531
|
+
return runSteps(
|
|
532
|
+
`Compile [${pkg}]`,
|
|
533
|
+
[["yarn", ["workspace", pkg, "run", "package-compile-types"]]]
|
|
534
|
+
);
|
|
535
|
+
};
|
|
536
|
+
var compileTypesAll = ({
|
|
537
|
+
jobs,
|
|
538
|
+
verbose,
|
|
539
|
+
incremental
|
|
540
|
+
}) => {
|
|
677
541
|
if (verbose) {
|
|
678
542
|
console.log(chalk11.gray("Compiling Types [All]"));
|
|
679
543
|
}
|
|
680
544
|
const start = Date.now();
|
|
681
|
-
const verboseOptions = verbose ? [
|
|
682
|
-
|
|
683
|
-
] : [
|
|
684
|
-
"--no-verbose"
|
|
685
|
-
];
|
|
686
|
-
const incrementalOptions = incremental ? [
|
|
687
|
-
"--since",
|
|
688
|
-
"-Apt"
|
|
689
|
-
] : [
|
|
690
|
-
"--parallel",
|
|
691
|
-
"-Apt"
|
|
692
|
-
];
|
|
693
|
-
const jobsOptions = jobs ? [
|
|
694
|
-
"-j",
|
|
695
|
-
`${jobs}`
|
|
696
|
-
] : [];
|
|
545
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
546
|
+
const incrementalOptions = incremental ? ["--since", "-Apt"] : ["--parallel", "-Apt"];
|
|
547
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
697
548
|
if (jobs) {
|
|
698
549
|
console.log(chalk11.blue(`Jobs set to [${jobs}]`));
|
|
699
550
|
}
|
|
700
551
|
const result = runSteps(`Compile Types ${incremental ? "[Incremental]" : ""} [All]`, [
|
|
701
|
-
[
|
|
702
|
-
"
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
"package-compile-types"
|
|
711
|
-
]
|
|
712
|
-
]
|
|
552
|
+
["yarn", [
|
|
553
|
+
"workspaces",
|
|
554
|
+
"foreach",
|
|
555
|
+
...incrementalOptions,
|
|
556
|
+
...jobsOptions,
|
|
557
|
+
...verboseOptions,
|
|
558
|
+
"run",
|
|
559
|
+
"package-compile-types"
|
|
560
|
+
]]
|
|
713
561
|
]);
|
|
714
562
|
console.log(`${chalk11.gray("Types Compiled in")} [${chalk11.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk11.gray("seconds")}`);
|
|
715
563
|
return result;
|
|
716
|
-
}
|
|
564
|
+
};
|
|
717
565
|
|
|
718
566
|
// src/actions/copy-assets.ts
|
|
719
567
|
import path2 from "node:path/posix";
|
|
720
568
|
import chalk12 from "chalk";
|
|
721
569
|
import cpy from "cpy";
|
|
722
|
-
var copyPackageTargetAssets =
|
|
570
|
+
var copyPackageTargetAssets = async (target, name, location) => {
|
|
723
571
|
try {
|
|
724
|
-
const values = await cpy(
|
|
725
|
-
"**/*.jpg",
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
"**/*.gif",
|
|
733
|
-
"**/*.css"
|
|
734
|
-
], `../dist/${target}`, {
|
|
735
|
-
cwd: path2.join(process.cwd(), location, "src"),
|
|
736
|
-
flat: false
|
|
737
|
-
});
|
|
572
|
+
const values = await cpy(
|
|
573
|
+
["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
|
|
574
|
+
`../dist/${target}`,
|
|
575
|
+
{
|
|
576
|
+
cwd: path2.join(process.cwd(), location, "src"),
|
|
577
|
+
flat: false
|
|
578
|
+
}
|
|
579
|
+
);
|
|
738
580
|
for (const value of values) {
|
|
739
581
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
740
582
|
}
|
|
@@ -743,8 +585,8 @@ var copyPackageTargetAssets = /* @__PURE__ */ __name(async (target, name, locati
|
|
|
743
585
|
console.log(`Copy Failed: ${name}: ${reason}`);
|
|
744
586
|
return 1;
|
|
745
587
|
}
|
|
746
|
-
}
|
|
747
|
-
var copyTargetAssets =
|
|
588
|
+
};
|
|
589
|
+
var copyTargetAssets = async (target, pkg) => {
|
|
748
590
|
const workspaces = yarnWorkspaces();
|
|
749
591
|
console.log(chalk12.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
750
592
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
@@ -753,15 +595,17 @@ var copyTargetAssets = /* @__PURE__ */ __name(async (target, pkg) => {
|
|
|
753
595
|
if (workspaceList.length === 0) {
|
|
754
596
|
console.error(`Package not found [${pkg}]`);
|
|
755
597
|
} else {
|
|
756
|
-
const results = await Promise.all(
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
598
|
+
const results = await Promise.all(
|
|
599
|
+
workspaceList.map(async (workspace) => {
|
|
600
|
+
const { location, name } = workspace;
|
|
601
|
+
return await copyPackageTargetAssets(target, name, location);
|
|
602
|
+
})
|
|
603
|
+
);
|
|
760
604
|
return results.reduce((prev, result) => prev || result, 0);
|
|
761
605
|
}
|
|
762
606
|
return 0;
|
|
763
|
-
}
|
|
764
|
-
var copyAssets =
|
|
607
|
+
};
|
|
608
|
+
var copyAssets = async ({ target, pkg }) => {
|
|
765
609
|
switch (target) {
|
|
766
610
|
case "esm": {
|
|
767
611
|
return await copyTargetAssets("esm", pkg);
|
|
@@ -773,38 +617,21 @@ var copyAssets = /* @__PURE__ */ __name(async ({ target, pkg }) => {
|
|
|
773
617
|
return await copyTargetAssets("esm", pkg) || await copyTargetAssets("cjs", pkg);
|
|
774
618
|
}
|
|
775
619
|
}
|
|
776
|
-
}
|
|
620
|
+
};
|
|
777
621
|
|
|
778
622
|
// src/actions/cycle.ts
|
|
779
623
|
import { cruise } from "dependency-cruiser";
|
|
780
|
-
var cycle =
|
|
781
|
-
return pkg ? cyclePackage({
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
] : [
|
|
792
|
-
"--no-verbose"
|
|
793
|
-
];
|
|
794
|
-
return runSteps(`Cycle [${pkg}]`, [
|
|
795
|
-
[
|
|
796
|
-
"yarn",
|
|
797
|
-
[
|
|
798
|
-
"workspace",
|
|
799
|
-
pkg,
|
|
800
|
-
"run",
|
|
801
|
-
"package-cycle",
|
|
802
|
-
...verboseOptions
|
|
803
|
-
]
|
|
804
|
-
]
|
|
805
|
-
]);
|
|
806
|
-
}, "cyclePackage");
|
|
807
|
-
var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
624
|
+
var cycle = async ({ verbose, pkg } = {}) => {
|
|
625
|
+
return pkg ? cyclePackage({ pkg, verbose }) : await cycleAll({ verbose });
|
|
626
|
+
};
|
|
627
|
+
var cyclePackage = ({ pkg, verbose }) => {
|
|
628
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
629
|
+
return runSteps(
|
|
630
|
+
`Cycle [${pkg}]`,
|
|
631
|
+
[["yarn", ["workspace", pkg, "run", "package-cycle", ...verboseOptions]]]
|
|
632
|
+
);
|
|
633
|
+
};
|
|
634
|
+
var cycleAll = async ({ verbose = false }) => {
|
|
808
635
|
const pkgName = process.env.npm_package_name;
|
|
809
636
|
const cruiseOptions = {
|
|
810
637
|
ruleSet: {
|
|
@@ -814,26 +641,20 @@ var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
814
641
|
severity: "error",
|
|
815
642
|
comment: "This dependency creates a circular reference",
|
|
816
643
|
from: {},
|
|
817
|
-
to: {
|
|
818
|
-
circular: true
|
|
819
|
-
}
|
|
644
|
+
to: { circular: true }
|
|
820
645
|
}
|
|
821
646
|
]
|
|
822
647
|
},
|
|
823
648
|
exclude: "node_modules|packages/.*/packages",
|
|
824
649
|
validate: true,
|
|
825
|
-
doNotFollow: {
|
|
826
|
-
path: "node_modules|packages/.*/packages"
|
|
827
|
-
},
|
|
650
|
+
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
828
651
|
tsPreCompilationDeps: false,
|
|
829
652
|
combinedDependencies: true,
|
|
830
653
|
outputType: verbose ? "text" : "err"
|
|
831
654
|
};
|
|
832
655
|
const target = "**/src";
|
|
833
656
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
834
|
-
const result = await cruise([
|
|
835
|
-
target
|
|
836
|
-
], cruiseOptions);
|
|
657
|
+
const result = await cruise([target], cruiseOptions);
|
|
837
658
|
if (result.output) {
|
|
838
659
|
console.log(result.output);
|
|
839
660
|
}
|
|
@@ -843,247 +664,303 @@ var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
843
664
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
844
665
|
}
|
|
845
666
|
return result.exitCode;
|
|
846
|
-
}
|
|
667
|
+
};
|
|
847
668
|
|
|
848
669
|
// src/actions/dead.ts
|
|
849
|
-
var dead =
|
|
850
|
-
return runSteps("Dead", [
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
670
|
+
var dead = () => {
|
|
671
|
+
return runSteps("Dead", [["yarn", ["ts-prune", "-p", "tsconfig.json"]]]);
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
// src/actions/deplint.ts
|
|
675
|
+
import fs2 from "node:fs";
|
|
676
|
+
import path3 from "node:path";
|
|
677
|
+
import chalk13 from "chalk";
|
|
678
|
+
import { globSync } from "glob";
|
|
679
|
+
import ts from "typescript";
|
|
680
|
+
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
681
|
+
const packageJsonFullPath = path3.resolve(packageJsonPath);
|
|
682
|
+
const rawContent = fs2.readFileSync(packageJsonFullPath, "utf8");
|
|
683
|
+
const packageJson = JSON.parse(rawContent);
|
|
684
|
+
const dependencies = packageJson.dependencies ? Object.keys(packageJson.dependencies) : [];
|
|
685
|
+
const devDependencies = packageJson.devDependencies ? Object.keys(packageJson.devDependencies) : [];
|
|
686
|
+
const peerDependencies = packageJson.peerDependencies ? Object.keys(packageJson.peerDependencies) : [];
|
|
687
|
+
return {
|
|
688
|
+
dependencies,
|
|
689
|
+
devDependencies,
|
|
690
|
+
peerDependencies
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
function getBasePackageName(importName) {
|
|
694
|
+
if (importName.startsWith("@")) {
|
|
695
|
+
const parts = importName.split("/");
|
|
696
|
+
return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importName;
|
|
697
|
+
}
|
|
698
|
+
return importName.split("/")[0];
|
|
699
|
+
}
|
|
700
|
+
function getImportsFromFile(filePath, importPaths) {
|
|
701
|
+
const sourceCode = fs2.readFileSync(filePath, "utf8");
|
|
702
|
+
const sourceFile = ts.createSourceFile(
|
|
703
|
+
path3.basename(filePath),
|
|
704
|
+
sourceCode,
|
|
705
|
+
ts.ScriptTarget.Latest,
|
|
706
|
+
true
|
|
707
|
+
);
|
|
708
|
+
const imports = [];
|
|
709
|
+
function visit(node) {
|
|
710
|
+
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
711
|
+
const moduleSpecifier = node.moduleSpecifier?.getFullText();
|
|
712
|
+
if (moduleSpecifier) {
|
|
713
|
+
const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
|
|
714
|
+
imports.push(trimmed);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
ts.forEachChild(node, visit);
|
|
718
|
+
}
|
|
719
|
+
visit(sourceFile);
|
|
720
|
+
const cleanedImports = imports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:")).map(getBasePackageName);
|
|
721
|
+
for (const imp of cleanedImports) {
|
|
722
|
+
importPaths[imp] = importPaths[imp] || [];
|
|
723
|
+
importPaths[imp].push(filePath);
|
|
724
|
+
}
|
|
725
|
+
return cleanedImports;
|
|
726
|
+
}
|
|
727
|
+
function findFilesByGlob(cwd4, pattern) {
|
|
728
|
+
return globSync(pattern, { cwd: cwd4, absolute: true });
|
|
729
|
+
}
|
|
730
|
+
function findFiles(path9) {
|
|
731
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
732
|
+
const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
|
|
733
|
+
const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
|
|
734
|
+
const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path9, pattern));
|
|
735
|
+
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
736
|
+
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
737
|
+
return {
|
|
738
|
+
allSourceFiles,
|
|
739
|
+
prodSourceFiles,
|
|
740
|
+
devSourceFiles
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
|
|
744
|
+
const prodImportPaths = {};
|
|
745
|
+
const prodImports = prodSourceFiles.flatMap((path9) => getImportsFromFile(path9, prodImportPaths));
|
|
746
|
+
const devImportPaths = {};
|
|
747
|
+
const devImports = devSourceFiles.flatMap((path9) => getImportsFromFile(path9, devImportPaths));
|
|
748
|
+
const externalProdImports = prodImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
|
|
749
|
+
const externalDevImports = devImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
|
|
750
|
+
return {
|
|
751
|
+
prodImports,
|
|
752
|
+
devImports,
|
|
753
|
+
prodImportPaths,
|
|
754
|
+
devImportPaths,
|
|
755
|
+
externalProdImports,
|
|
756
|
+
externalDevImports
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
function check({
|
|
760
|
+
name,
|
|
761
|
+
location,
|
|
762
|
+
devDeps = false,
|
|
763
|
+
peerDeps = false
|
|
764
|
+
}) {
|
|
765
|
+
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
766
|
+
const {
|
|
767
|
+
prodImportPaths,
|
|
768
|
+
devImportPaths,
|
|
769
|
+
externalProdImports,
|
|
770
|
+
externalDevImports
|
|
771
|
+
} = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
772
|
+
const {
|
|
773
|
+
dependencies,
|
|
774
|
+
devDependencies,
|
|
775
|
+
peerDependencies
|
|
776
|
+
} = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
777
|
+
let unlistedDependencies = 0;
|
|
778
|
+
let unlistedDevDependencies = 0;
|
|
779
|
+
let unusedDependencies = 0;
|
|
780
|
+
for (const imp of externalProdImports) {
|
|
781
|
+
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
782
|
+
unlistedDependencies++;
|
|
783
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
784
|
+
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
785
|
+
console.log("");
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
for (const dep of dependencies) {
|
|
789
|
+
if (!externalProdImports.includes(dep)) {
|
|
790
|
+
unusedDependencies++;
|
|
791
|
+
console.log(`[${chalk13.blue(name)}] Unused dependency in package.json: ${chalk13.red(dep)}`);
|
|
792
|
+
console.log(` ${location}/package.json
|
|
793
|
+
`);
|
|
794
|
+
console.log("");
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
if (peerDeps) {
|
|
798
|
+
for (const dep of peerDependencies) {
|
|
799
|
+
if (!externalProdImports.includes(dep)) {
|
|
800
|
+
unusedDependencies++;
|
|
801
|
+
console.log(`[${chalk13.blue(name)}] Unused peerDependency in package.json: ${chalk13.red(dep)}`);
|
|
802
|
+
console.log(` ${location}/package.json
|
|
803
|
+
`);
|
|
804
|
+
console.log("");
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
if (devDeps) {
|
|
809
|
+
for (const imp of externalDevImports) {
|
|
810
|
+
if (!devDependencies.includes(imp)) {
|
|
811
|
+
unlistedDevDependencies++;
|
|
812
|
+
console.log(`[${chalk13.blue(name)}] Missing devDependency in package.json: ${chalk13.red(imp)}`);
|
|
813
|
+
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies;
|
|
818
|
+
return totalErrors;
|
|
819
|
+
}
|
|
820
|
+
var deplint = ({ pkg }) => {
|
|
821
|
+
if (pkg) {
|
|
822
|
+
const { location, name } = yarnWorkspace(pkg);
|
|
823
|
+
console.log(`Running Deplint for ${name}`);
|
|
824
|
+
check({
|
|
825
|
+
name,
|
|
826
|
+
location,
|
|
827
|
+
devDeps: true
|
|
828
|
+
});
|
|
829
|
+
} else {
|
|
830
|
+
const workspaces = yarnWorkspaces();
|
|
831
|
+
console.log("Deplint Started...");
|
|
832
|
+
let totalErrors = 0;
|
|
833
|
+
for (const workspace of workspaces) {
|
|
834
|
+
totalErrors += check(workspace);
|
|
835
|
+
}
|
|
836
|
+
if (totalErrors > 0) {
|
|
837
|
+
console.log(`Found ${chalk13.red(totalErrors)} unlisted imports.`);
|
|
838
|
+
} else {
|
|
839
|
+
console.log(`No unlisted imports found. ${chalk13.green("\u2714")}`);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return 0;
|
|
843
|
+
};
|
|
861
844
|
|
|
862
845
|
// src/actions/deploy.ts
|
|
863
|
-
var deploy =
|
|
846
|
+
var deploy = () => {
|
|
864
847
|
return runSteps("Deploy [Patch]", [
|
|
865
|
-
[
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
],
|
|
869
|
-
[
|
|
870
|
-
"yarn",
|
|
871
|
-
"xy clean"
|
|
872
|
-
],
|
|
873
|
-
[
|
|
874
|
-
"yarn",
|
|
875
|
-
"xy build"
|
|
876
|
-
],
|
|
877
|
-
[
|
|
878
|
-
"yarn",
|
|
879
|
-
"version apply --all"
|
|
880
|
-
],
|
|
881
|
-
[
|
|
882
|
-
"yarn",
|
|
883
|
-
"workspaces foreach --all --parallel npm publish"
|
|
884
|
-
]
|
|
848
|
+
["yarn", "workspaces foreach --all version patch --deferred"],
|
|
849
|
+
["yarn", "xy clean"],
|
|
850
|
+
["yarn", "xy build"],
|
|
851
|
+
["yarn", "version apply --all"],
|
|
852
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
885
853
|
]);
|
|
886
|
-
}
|
|
854
|
+
};
|
|
887
855
|
|
|
888
856
|
// src/actions/deploy-major.ts
|
|
889
|
-
var deployMajor =
|
|
857
|
+
var deployMajor = () => {
|
|
890
858
|
return runSteps("Deploy [Major]", [
|
|
891
|
-
[
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
],
|
|
895
|
-
[
|
|
896
|
-
"yarn",
|
|
897
|
-
"xy clean"
|
|
898
|
-
],
|
|
899
|
-
[
|
|
900
|
-
"yarn",
|
|
901
|
-
"xy build"
|
|
902
|
-
],
|
|
903
|
-
[
|
|
904
|
-
"yarn",
|
|
905
|
-
"version apply --all"
|
|
906
|
-
],
|
|
907
|
-
[
|
|
908
|
-
"yarn",
|
|
909
|
-
"workspaces foreach --all --parallel npm publish"
|
|
910
|
-
]
|
|
859
|
+
["yarn", "workspaces foreach --all version major --deferred"],
|
|
860
|
+
["yarn", "xy clean"],
|
|
861
|
+
["yarn", "xy build"],
|
|
862
|
+
["yarn", "version apply --all"],
|
|
863
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
911
864
|
]);
|
|
912
|
-
}
|
|
865
|
+
};
|
|
913
866
|
|
|
914
867
|
// src/actions/deploy-minor.ts
|
|
915
|
-
var deployMinor =
|
|
868
|
+
var deployMinor = () => {
|
|
916
869
|
return runSteps("Deploy [Minor]", [
|
|
917
|
-
[
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
],
|
|
921
|
-
[
|
|
922
|
-
"yarn",
|
|
923
|
-
"xy clean"
|
|
924
|
-
],
|
|
925
|
-
[
|
|
926
|
-
"yarn",
|
|
927
|
-
"xy build"
|
|
928
|
-
],
|
|
929
|
-
[
|
|
930
|
-
"yarn",
|
|
931
|
-
"version apply --all"
|
|
932
|
-
],
|
|
933
|
-
[
|
|
934
|
-
"yarn",
|
|
935
|
-
"workspaces foreach --all --parallel npm publish"
|
|
936
|
-
]
|
|
870
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
871
|
+
["yarn", "xy clean"],
|
|
872
|
+
["yarn", "xy build"],
|
|
873
|
+
["yarn", "version apply --all"],
|
|
874
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
937
875
|
]);
|
|
938
|
-
}
|
|
876
|
+
};
|
|
939
877
|
|
|
940
878
|
// src/actions/deploy-next.ts
|
|
941
|
-
var deployNext =
|
|
879
|
+
var deployNext = () => {
|
|
942
880
|
return runSteps("Deploy [Next]", [
|
|
943
|
-
[
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
],
|
|
947
|
-
[
|
|
948
|
-
"yarn",
|
|
949
|
-
"xy clean"
|
|
950
|
-
],
|
|
951
|
-
[
|
|
952
|
-
"yarn",
|
|
953
|
-
"xy build"
|
|
954
|
-
],
|
|
955
|
-
[
|
|
956
|
-
"yarn",
|
|
957
|
-
"version apply --all --prerelease"
|
|
958
|
-
],
|
|
959
|
-
[
|
|
960
|
-
"yarn",
|
|
961
|
-
"workspaces foreach --all --parallel npm publish --tag next"
|
|
962
|
-
]
|
|
881
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
882
|
+
["yarn", "xy clean"],
|
|
883
|
+
["yarn", "xy build"],
|
|
884
|
+
["yarn", "version apply --all --prerelease"],
|
|
885
|
+
["yarn", "workspaces foreach --all --parallel npm publish --tag next"]
|
|
963
886
|
]);
|
|
964
|
-
}
|
|
887
|
+
};
|
|
965
888
|
|
|
966
889
|
// src/actions/dupdeps.ts
|
|
967
|
-
import
|
|
968
|
-
var dupdeps =
|
|
969
|
-
console.log(
|
|
890
|
+
import chalk14 from "chalk";
|
|
891
|
+
var dupdeps = () => {
|
|
892
|
+
console.log(chalk14.green("Checking all Dependencies for Duplicates"));
|
|
970
893
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
971
894
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
972
895
|
return detectDuplicateDependencies(dependencies);
|
|
973
|
-
}
|
|
896
|
+
};
|
|
974
897
|
|
|
975
898
|
// src/actions/lint.ts
|
|
976
|
-
import
|
|
977
|
-
var lintPackage =
|
|
978
|
-
console.log(
|
|
899
|
+
import chalk15 from "chalk";
|
|
900
|
+
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
901
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
979
902
|
const start = Date.now();
|
|
980
903
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
981
|
-
[
|
|
982
|
-
"
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
fix2 ? "package-fix" : "package-lint"
|
|
988
|
-
]
|
|
989
|
-
]
|
|
904
|
+
["yarn", [
|
|
905
|
+
"workspace",
|
|
906
|
+
pkg,
|
|
907
|
+
"run",
|
|
908
|
+
fix2 ? "package-fix" : "package-lint"
|
|
909
|
+
]]
|
|
990
910
|
]);
|
|
991
|
-
console.log(
|
|
911
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
992
912
|
return result;
|
|
993
|
-
}
|
|
994
|
-
var lint =
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
913
|
+
};
|
|
914
|
+
var lint = ({
|
|
915
|
+
pkg,
|
|
916
|
+
verbose,
|
|
917
|
+
incremental,
|
|
918
|
+
fix: fix2
|
|
919
|
+
} = {}) => {
|
|
920
|
+
return pkg ? lintPackage({ pkg, fix: fix2 }) : lintAllPackages({
|
|
999
921
|
verbose,
|
|
1000
922
|
incremental,
|
|
1001
923
|
fix: fix2
|
|
1002
924
|
});
|
|
1003
|
-
}
|
|
1004
|
-
var lintAllPackages =
|
|
1005
|
-
console.log(
|
|
925
|
+
};
|
|
926
|
+
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
927
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1006
928
|
const start = Date.now();
|
|
1007
|
-
const fixOptions = fix2 ? [
|
|
1008
|
-
"--fix"
|
|
1009
|
-
] : [];
|
|
929
|
+
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1010
930
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1011
|
-
[
|
|
1012
|
-
"yarn",
|
|
1013
|
-
[
|
|
1014
|
-
"eslint",
|
|
1015
|
-
...fixOptions
|
|
1016
|
-
]
|
|
1017
|
-
]
|
|
931
|
+
["yarn", ["eslint", ...fixOptions]]
|
|
1018
932
|
]);
|
|
1019
|
-
console.log(
|
|
933
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1020
934
|
return result;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
// src/actions/fix.ts
|
|
1024
|
-
var fix =
|
|
1025
|
-
return lint({
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
var
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
[
|
|
1042
|
-
"yarn",
|
|
1043
|
-
[
|
|
1044
|
-
"workspace",
|
|
1045
|
-
pkg,
|
|
1046
|
-
"run",
|
|
1047
|
-
"package-gen-docs"
|
|
1048
|
-
]
|
|
1049
|
-
]
|
|
1050
|
-
];
|
|
1051
|
-
return runSteps(`GenDocs [${pkg}]`, [
|
|
1052
|
-
...steps
|
|
1053
|
-
]);
|
|
1054
|
-
}, "genDocsPackage");
|
|
1055
|
-
var genDocsAll = /* @__PURE__ */ __name(({ incremental }) => {
|
|
1056
|
-
const incrementalOptions = incremental ? [
|
|
1057
|
-
"--since",
|
|
1058
|
-
"-pA"
|
|
1059
|
-
] : [
|
|
1060
|
-
"-pA"
|
|
1061
|
-
];
|
|
1062
|
-
const steps = [
|
|
1063
|
-
[
|
|
1064
|
-
"yarn",
|
|
1065
|
-
[
|
|
1066
|
-
"workspaces",
|
|
1067
|
-
"foreach",
|
|
1068
|
-
...incrementalOptions,
|
|
1069
|
-
"run",
|
|
1070
|
-
"package-gen-docs"
|
|
1071
|
-
]
|
|
1072
|
-
]
|
|
1073
|
-
];
|
|
1074
|
-
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [
|
|
1075
|
-
...steps
|
|
1076
|
-
]);
|
|
1077
|
-
}, "genDocsAll");
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
// src/actions/fix.ts
|
|
938
|
+
var fix = (params) => {
|
|
939
|
+
return lint({ ...params, fix: true });
|
|
940
|
+
};
|
|
941
|
+
|
|
942
|
+
// src/actions/gen-docs.ts
|
|
943
|
+
var genDocs = ({ pkg, incremental }) => {
|
|
944
|
+
return pkg ? genDocsPackage({ pkg }) : genDocsAll({ incremental });
|
|
945
|
+
};
|
|
946
|
+
var genDocsPackage = ({ pkg }) => {
|
|
947
|
+
const steps = [["yarn", ["workspace", pkg, "run", "package-gen-docs"]]];
|
|
948
|
+
return runSteps(`GenDocs [${pkg}]`, [...steps]);
|
|
949
|
+
};
|
|
950
|
+
var genDocsAll = ({ incremental }) => {
|
|
951
|
+
const incrementalOptions = incremental ? ["--since", "-pA"] : ["-pA"];
|
|
952
|
+
const steps = [["yarn", ["workspaces", "foreach", ...incrementalOptions, "run", "package-gen-docs"]]];
|
|
953
|
+
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [...steps]);
|
|
954
|
+
};
|
|
1078
955
|
|
|
1079
956
|
// src/actions/gitignore-gen.ts
|
|
1080
957
|
var filename = ".gitignore";
|
|
1081
|
-
var gitignoreGen =
|
|
958
|
+
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1082
959
|
|
|
1083
960
|
// src/actions/gitlint.ts
|
|
1084
|
-
import
|
|
961
|
+
import chalk16 from "chalk";
|
|
1085
962
|
import ParseGitConfig from "parse-git-config";
|
|
1086
|
-
var gitlint =
|
|
963
|
+
var gitlint = () => {
|
|
1087
964
|
console.log(`
|
|
1088
965
|
Gitlint Start [${process.cwd()}]
|
|
1089
966
|
`);
|
|
@@ -1091,10 +968,10 @@ Gitlint Start [${process.cwd()}]
|
|
|
1091
968
|
let warnings = 0;
|
|
1092
969
|
const errors = 0;
|
|
1093
970
|
const gitConfig = ParseGitConfig.sync();
|
|
1094
|
-
const warn =
|
|
1095
|
-
console.warn(
|
|
971
|
+
const warn = (message) => {
|
|
972
|
+
console.warn(chalk16.yellow(`Warning: ${message}`));
|
|
1096
973
|
warnings++;
|
|
1097
|
-
}
|
|
974
|
+
};
|
|
1098
975
|
if (gitConfig.core.ignorecase) {
|
|
1099
976
|
warn("Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]");
|
|
1100
977
|
} else {
|
|
@@ -1112,67 +989,52 @@ Gitlint Start [${process.cwd()}]
|
|
|
1112
989
|
}
|
|
1113
990
|
const resultMessages = [];
|
|
1114
991
|
if (valid > 0) {
|
|
1115
|
-
resultMessages.push(
|
|
992
|
+
resultMessages.push(chalk16.green(`Passed: ${valid}`));
|
|
1116
993
|
}
|
|
1117
994
|
if (warnings > 0) {
|
|
1118
|
-
resultMessages.push(
|
|
995
|
+
resultMessages.push(chalk16.yellow(`Warnings: ${warnings}`));
|
|
1119
996
|
}
|
|
1120
997
|
if (errors > 0) {
|
|
1121
|
-
resultMessages.push(
|
|
998
|
+
resultMessages.push(chalk16.red(` Errors: ${errors}`));
|
|
1122
999
|
}
|
|
1123
1000
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1124
1001
|
`);
|
|
1125
1002
|
return warnings + errors === 0 ? 1 : 0;
|
|
1126
|
-
}
|
|
1003
|
+
};
|
|
1127
1004
|
|
|
1128
1005
|
// src/actions/gitlint-fix.ts
|
|
1129
1006
|
import { execSync as execSync2 } from "node:child_process";
|
|
1130
|
-
import
|
|
1007
|
+
import chalk17 from "chalk";
|
|
1131
1008
|
import ParseGitConfig2 from "parse-git-config";
|
|
1132
|
-
var gitlintFix =
|
|
1009
|
+
var gitlintFix = () => {
|
|
1133
1010
|
console.log(`
|
|
1134
1011
|
Gitlint Fix Start [${process.cwd()}]
|
|
1135
1012
|
`);
|
|
1136
1013
|
const gitConfig = ParseGitConfig2.sync();
|
|
1137
1014
|
if (gitConfig.core.ignorecase) {
|
|
1138
|
-
execSync2("git config core.ignorecase false", {
|
|
1139
|
-
|
|
1140
|
-
});
|
|
1141
|
-
console.warn(chalk16.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1015
|
+
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1016
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1142
1017
|
}
|
|
1143
1018
|
if (gitConfig.core.autocrlf !== false) {
|
|
1144
|
-
execSync2("git config core.autocrlf false", {
|
|
1145
|
-
|
|
1146
|
-
});
|
|
1147
|
-
console.warn(chalk16.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1019
|
+
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1020
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1148
1021
|
}
|
|
1149
1022
|
if (gitConfig.core.eol !== "lf") {
|
|
1150
|
-
execSync2("git config core.eol lf", {
|
|
1151
|
-
|
|
1152
|
-
});
|
|
1153
|
-
console.warn(chalk16.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1023
|
+
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1024
|
+
console.warn(chalk17.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1154
1025
|
}
|
|
1155
1026
|
return 1;
|
|
1156
|
-
}
|
|
1027
|
+
};
|
|
1157
1028
|
|
|
1158
1029
|
// src/actions/knip.ts
|
|
1159
|
-
var knip =
|
|
1160
|
-
return runSteps("Knip", [
|
|
1161
|
-
|
|
1162
|
-
"yarn",
|
|
1163
|
-
[
|
|
1164
|
-
"knip",
|
|
1165
|
-
"--dependencies",
|
|
1166
|
-
"--no-exit-code"
|
|
1167
|
-
]
|
|
1168
|
-
]
|
|
1169
|
-
]);
|
|
1170
|
-
}, "knip");
|
|
1030
|
+
var knip = () => {
|
|
1031
|
+
return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
|
|
1032
|
+
};
|
|
1171
1033
|
|
|
1172
1034
|
// src/actions/license.ts
|
|
1173
|
-
import
|
|
1035
|
+
import chalk18 from "chalk";
|
|
1174
1036
|
import { init } from "license-checker";
|
|
1175
|
-
var license =
|
|
1037
|
+
var license = async (pkg) => {
|
|
1176
1038
|
const workspaces = yarnWorkspaces();
|
|
1177
1039
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1178
1040
|
return pkg === void 0 || name === pkg;
|
|
@@ -1195,112 +1057,98 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1195
1057
|
"LGPL-3.0-or-later",
|
|
1196
1058
|
"Python-2.0"
|
|
1197
1059
|
]);
|
|
1198
|
-
console.log(
|
|
1199
|
-
return (await Promise.all(
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
production: true,
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
if (
|
|
1224
|
-
|
|
1060
|
+
console.log(chalk18.green("License Checker"));
|
|
1061
|
+
return (await Promise.all(
|
|
1062
|
+
workspaceList.map(({ location, name }) => {
|
|
1063
|
+
return new Promise((resolve) => {
|
|
1064
|
+
init({ production: true, start: location }, (error, packages) => {
|
|
1065
|
+
if (error) {
|
|
1066
|
+
console.error(chalk18.red(`License Checker [${name}] Error`));
|
|
1067
|
+
console.error(chalk18.gray(error));
|
|
1068
|
+
console.log("\n");
|
|
1069
|
+
resolve(1);
|
|
1070
|
+
} else {
|
|
1071
|
+
console.log(chalk18.green(`License Checker [${name}]`));
|
|
1072
|
+
let count = 0;
|
|
1073
|
+
for (const [name2, info] of Object.entries(packages)) {
|
|
1074
|
+
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
1075
|
+
for (let license2 of licenses) {
|
|
1076
|
+
if (license2) {
|
|
1077
|
+
const processedLicense = license2[0] === "(" && license2.at(-1) === ")" ? license2.slice(1, -2) : license2;
|
|
1078
|
+
const orLicenses = processedLicense.split(" OR ");
|
|
1079
|
+
let orLicenseFound = false;
|
|
1080
|
+
for (const orLicense of orLicenses) {
|
|
1081
|
+
if (exclude.has(orLicense)) {
|
|
1082
|
+
orLicenseFound = true;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
if (!orLicenseFound) {
|
|
1086
|
+
count++;
|
|
1087
|
+
console.warn(chalk18.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1225
1088
|
}
|
|
1226
|
-
}
|
|
1227
|
-
if (!orLicenseFound) {
|
|
1228
|
-
count++;
|
|
1229
|
-
console.warn(chalk17.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1230
1089
|
}
|
|
1231
1090
|
}
|
|
1232
1091
|
}
|
|
1092
|
+
console.log("\n");
|
|
1093
|
+
resolve(count);
|
|
1233
1094
|
}
|
|
1234
|
-
|
|
1235
|
-
resolve(count);
|
|
1236
|
-
}
|
|
1095
|
+
});
|
|
1237
1096
|
});
|
|
1238
|
-
})
|
|
1239
|
-
|
|
1240
|
-
}
|
|
1097
|
+
})
|
|
1098
|
+
)).reduce((prev, value) => prev || value, 0);
|
|
1099
|
+
};
|
|
1241
1100
|
|
|
1242
1101
|
// src/actions/npmignore-gen.ts
|
|
1243
1102
|
var filename2 = ".npmignore";
|
|
1244
|
-
var npmignoreGen =
|
|
1103
|
+
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1245
1104
|
|
|
1246
1105
|
// src/actions/package/clean-outputs.ts
|
|
1247
|
-
import
|
|
1248
|
-
import
|
|
1249
|
-
var packageCleanOutputs =
|
|
1106
|
+
import path4 from "node:path";
|
|
1107
|
+
import chalk19 from "chalk";
|
|
1108
|
+
var packageCleanOutputs = () => {
|
|
1250
1109
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1251
1110
|
const pkgName = process.env.npm_package_name;
|
|
1252
|
-
const folders = [
|
|
1253
|
-
|
|
1254
|
-
path3.join(pkg, "build"),
|
|
1255
|
-
path3.join(pkg, "docs")
|
|
1256
|
-
];
|
|
1257
|
-
console.log(chalk18.green(`Cleaning Outputs [${pkgName}]`));
|
|
1111
|
+
const folders = [path4.join(pkg, "dist"), path4.join(pkg, "build"), path4.join(pkg, "docs")];
|
|
1112
|
+
console.log(chalk19.green(`Cleaning Outputs [${pkgName}]`));
|
|
1258
1113
|
for (let folder of folders) {
|
|
1259
1114
|
deleteGlob(folder);
|
|
1260
1115
|
}
|
|
1261
1116
|
return 0;
|
|
1262
|
-
}
|
|
1117
|
+
};
|
|
1263
1118
|
|
|
1264
1119
|
// src/actions/package/clean-typescript.ts
|
|
1265
|
-
import
|
|
1266
|
-
import
|
|
1267
|
-
var packageCleanTypescript =
|
|
1120
|
+
import path5 from "node:path";
|
|
1121
|
+
import chalk20 from "chalk";
|
|
1122
|
+
var packageCleanTypescript = () => {
|
|
1268
1123
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1269
1124
|
const pkgName = process.env.npm_package_name;
|
|
1270
|
-
console.log(
|
|
1271
|
-
const files = [
|
|
1272
|
-
path4.join(pkg, "*.tsbuildinfo"),
|
|
1273
|
-
path4.join(pkg, ".tsconfig.*"),
|
|
1274
|
-
path4.join(pkg, ".eslintcache")
|
|
1275
|
-
];
|
|
1125
|
+
console.log(chalk20.green(`Cleaning Typescript [${pkgName}]`));
|
|
1126
|
+
const files = [path5.join(pkg, "*.tsbuildinfo"), path5.join(pkg, ".tsconfig.*"), path5.join(pkg, ".eslintcache")];
|
|
1276
1127
|
for (let file of files) {
|
|
1277
1128
|
deleteGlob(file);
|
|
1278
1129
|
}
|
|
1279
1130
|
return 0;
|
|
1280
|
-
}
|
|
1131
|
+
};
|
|
1281
1132
|
|
|
1282
1133
|
// src/actions/package/clean.ts
|
|
1283
|
-
var packageClean =
|
|
1284
|
-
return (await Promise.all([
|
|
1285
|
-
|
|
1286
|
-
packageCleanTypescript()
|
|
1287
|
-
])).reduce((prev, value) => prev + value, 0);
|
|
1288
|
-
}, "packageClean");
|
|
1134
|
+
var packageClean = async () => {
|
|
1135
|
+
return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0);
|
|
1136
|
+
};
|
|
1289
1137
|
|
|
1290
1138
|
// src/actions/package/compile/compile.ts
|
|
1291
|
-
import
|
|
1139
|
+
import chalk24 from "chalk";
|
|
1292
1140
|
|
|
1293
1141
|
// src/actions/package/publint.ts
|
|
1294
|
-
import { promises as
|
|
1295
|
-
import
|
|
1142
|
+
import { promises as fs3 } from "node:fs";
|
|
1143
|
+
import chalk21 from "chalk";
|
|
1296
1144
|
import sortPackageJson from "sort-package-json";
|
|
1297
|
-
var packagePublint =
|
|
1145
|
+
var packagePublint = async (params) => {
|
|
1298
1146
|
const pkgDir = process.env.INIT_CWD;
|
|
1299
|
-
const sortedPkg = sortPackageJson(await
|
|
1300
|
-
await
|
|
1301
|
-
const pkg = JSON.parse(await
|
|
1302
|
-
console.log(
|
|
1303
|
-
console.log(
|
|
1147
|
+
const sortedPkg = sortPackageJson(await fs3.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1148
|
+
await fs3.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1149
|
+
const pkg = JSON.parse(await fs3.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1150
|
+
console.log(chalk21.green(`Publint: ${pkg.name}`));
|
|
1151
|
+
console.log(chalk21.gray(pkgDir));
|
|
1304
1152
|
const { publint: publint2 } = await import("publint");
|
|
1305
1153
|
const { messages } = await publint2({
|
|
1306
1154
|
level: "suggestion",
|
|
@@ -1308,52 +1156,47 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
|
1308
1156
|
strict: true
|
|
1309
1157
|
});
|
|
1310
1158
|
const { formatMessage } = await import("publint/utils");
|
|
1311
|
-
const validMessage =
|
|
1159
|
+
const validMessage = (_message) => {
|
|
1312
1160
|
return true;
|
|
1313
|
-
}
|
|
1161
|
+
};
|
|
1314
1162
|
const validMessages = messages.filter(validMessage);
|
|
1315
1163
|
for (const message of validMessages) {
|
|
1316
1164
|
switch (message.type) {
|
|
1317
1165
|
case "error": {
|
|
1318
|
-
console.error(
|
|
1166
|
+
console.error(chalk21.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1319
1167
|
break;
|
|
1320
1168
|
}
|
|
1321
1169
|
case "warning": {
|
|
1322
|
-
console.warn(
|
|
1170
|
+
console.warn(chalk21.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1323
1171
|
break;
|
|
1324
1172
|
}
|
|
1325
1173
|
default: {
|
|
1326
|
-
console.log(
|
|
1174
|
+
console.log(chalk21.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1327
1175
|
break;
|
|
1328
1176
|
}
|
|
1329
1177
|
}
|
|
1330
1178
|
}
|
|
1331
1179
|
if (params?.verbose) {
|
|
1332
|
-
console.log(
|
|
1180
|
+
console.log(chalk21.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1333
1181
|
}
|
|
1334
1182
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1335
|
-
}
|
|
1183
|
+
};
|
|
1336
1184
|
|
|
1337
1185
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1338
1186
|
import { build as build2, defineConfig } from "tsup";
|
|
1339
1187
|
|
|
1340
1188
|
// src/actions/package/compile/inputs.ts
|
|
1341
1189
|
import { glob as glob2 } from "glob";
|
|
1342
|
-
var getAllInputs =
|
|
1343
|
-
return glob2.sync(`${folder}/**/*.*`, {
|
|
1344
|
-
|
|
1345
|
-
});
|
|
1346
|
-
}, "getAllInputs");
|
|
1190
|
+
var getAllInputs = (folder) => {
|
|
1191
|
+
return glob2.sync(`${folder}/**/*.*`, { posix: true });
|
|
1192
|
+
};
|
|
1347
1193
|
|
|
1348
1194
|
// src/actions/package/compile/buildEntries.ts
|
|
1349
|
-
var buildEntries =
|
|
1195
|
+
var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true, verbose = false) => {
|
|
1350
1196
|
let entries = [];
|
|
1351
1197
|
switch (entryMode) {
|
|
1352
1198
|
case "platform": {
|
|
1353
|
-
entries = [
|
|
1354
|
-
`${folder}/index-node.ts`,
|
|
1355
|
-
`${folder}/index-browser.ts`
|
|
1356
|
-
];
|
|
1199
|
+
entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`];
|
|
1357
1200
|
break;
|
|
1358
1201
|
}
|
|
1359
1202
|
case "all": {
|
|
@@ -1361,46 +1204,53 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", exclude
|
|
|
1361
1204
|
break;
|
|
1362
1205
|
}
|
|
1363
1206
|
default: {
|
|
1364
|
-
entries = [
|
|
1365
|
-
`${folder}/index.ts`
|
|
1366
|
-
];
|
|
1207
|
+
entries = [`${folder}/index.ts`];
|
|
1367
1208
|
break;
|
|
1368
1209
|
}
|
|
1369
1210
|
}
|
|
1370
1211
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
1371
1212
|
return entries;
|
|
1372
|
-
}
|
|
1213
|
+
};
|
|
1373
1214
|
|
|
1374
1215
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1375
1216
|
import { cwd } from "node:process";
|
|
1376
|
-
import
|
|
1217
|
+
import chalk22 from "chalk";
|
|
1377
1218
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1378
|
-
import {
|
|
1219
|
+
import {
|
|
1220
|
+
DiagnosticCategory,
|
|
1221
|
+
formatDiagnosticsWithColorAndContext,
|
|
1222
|
+
getPreEmitDiagnostics,
|
|
1223
|
+
sys as sys2
|
|
1224
|
+
} from "typescript";
|
|
1379
1225
|
|
|
1380
1226
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
1381
1227
|
import { createRequire } from "node:module";
|
|
1382
1228
|
import deepmerge2 from "deepmerge";
|
|
1383
|
-
import {
|
|
1384
|
-
|
|
1229
|
+
import {
|
|
1230
|
+
findConfigFile,
|
|
1231
|
+
readConfigFile,
|
|
1232
|
+
sys
|
|
1233
|
+
} from "typescript";
|
|
1234
|
+
var getNested = (config2) => {
|
|
1385
1235
|
if (config2.extends) {
|
|
1386
1236
|
const require2 = createRequire(import.meta.url);
|
|
1387
1237
|
const opts = require2(config2.extends);
|
|
1388
1238
|
return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
|
|
1389
1239
|
}
|
|
1390
1240
|
return config2.compilerOptions;
|
|
1391
|
-
}
|
|
1392
|
-
var getCompilerOptionsJSONFollowExtends =
|
|
1241
|
+
};
|
|
1242
|
+
var getCompilerOptionsJSONFollowExtends = (filename3) => {
|
|
1393
1243
|
const config2 = readConfigFile(filename3, sys.readFile).config;
|
|
1394
1244
|
return getNested(config2);
|
|
1395
|
-
}
|
|
1396
|
-
var getCompilerOptions =
|
|
1245
|
+
};
|
|
1246
|
+
var getCompilerOptions = (options = {}, tsconfig = "tsconfig.json") => {
|
|
1397
1247
|
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
1398
1248
|
const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
|
|
1399
1249
|
return deepmerge2(configFileCompilerOptions, options);
|
|
1400
|
-
}
|
|
1250
|
+
};
|
|
1401
1251
|
|
|
1402
1252
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1403
|
-
var packageCompileTscTypes =
|
|
1253
|
+
var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1404
1254
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
1405
1255
|
const verbose = config2?.verbose ?? false;
|
|
1406
1256
|
const compilerOptions = {
|
|
@@ -1416,54 +1266,40 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
1416
1266
|
emitDeclarationOnly: true,
|
|
1417
1267
|
noEmit: false
|
|
1418
1268
|
};
|
|
1419
|
-
const validTsExt = [
|
|
1420
|
-
|
|
1421
|
-
".tsx",
|
|
1422
|
-
".d.ts",
|
|
1423
|
-
".cts",
|
|
1424
|
-
".d.cts",
|
|
1425
|
-
".mts",
|
|
1426
|
-
".d.mts"
|
|
1427
|
-
];
|
|
1428
|
-
const excludes = [
|
|
1429
|
-
".stories.",
|
|
1430
|
-
".spec."
|
|
1431
|
-
];
|
|
1269
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1270
|
+
const excludes = [".stories.", ".spec."];
|
|
1432
1271
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1433
|
-
console.log(
|
|
1272
|
+
console.log(chalk22.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1434
1273
|
if (files.length > 0) {
|
|
1435
1274
|
const program = createProgramFromConfig({
|
|
1436
1275
|
basePath: pkg ?? cwd(),
|
|
1437
1276
|
compilerOptions,
|
|
1438
|
-
exclude: [
|
|
1439
|
-
"dist",
|
|
1440
|
-
"docs",
|
|
1441
|
-
"**/*.spec.*",
|
|
1442
|
-
"**/*.stories.*",
|
|
1443
|
-
"src/**/spec/**/*"
|
|
1444
|
-
],
|
|
1277
|
+
exclude: ["dist", "docs", "**/*.spec.*", "**/*.stories.*", "src/**/spec/**/*"],
|
|
1445
1278
|
files
|
|
1446
1279
|
});
|
|
1447
1280
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
1448
1281
|
if (diagnostics.length > 0) {
|
|
1449
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1282
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1283
|
+
diagnostics,
|
|
1284
|
+
{
|
|
1285
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1286
|
+
getCurrentDirectory: () => folder,
|
|
1287
|
+
getNewLine: () => sys2.newLine
|
|
1288
|
+
}
|
|
1289
|
+
);
|
|
1454
1290
|
console.error(formattedDiagnostics);
|
|
1455
1291
|
}
|
|
1456
1292
|
program.emit();
|
|
1457
1293
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1458
1294
|
}
|
|
1459
1295
|
return 0;
|
|
1460
|
-
}
|
|
1296
|
+
};
|
|
1461
1297
|
|
|
1462
1298
|
// src/actions/package/compile/compileTypes.ts
|
|
1463
|
-
var packageCompileTypes =
|
|
1299
|
+
var packageCompileTypes = async (inConfig = {}) => {
|
|
1464
1300
|
const config2 = await loadConfig(inConfig);
|
|
1465
1301
|
return packageCompileTscTypes(void 0, config2);
|
|
1466
|
-
}
|
|
1302
|
+
};
|
|
1467
1303
|
|
|
1468
1304
|
// src/actions/package/compile/deepMerge.ts
|
|
1469
1305
|
function deepMerge(target, source) {
|
|
@@ -1480,7 +1316,6 @@ function deepMerge(target, source) {
|
|
|
1480
1316
|
}
|
|
1481
1317
|
return target;
|
|
1482
1318
|
}
|
|
1483
|
-
__name(deepMerge, "deepMerge");
|
|
1484
1319
|
function deepMergeObjects(objects) {
|
|
1485
1320
|
const result = {};
|
|
1486
1321
|
for (const obj of objects) {
|
|
@@ -1488,14 +1323,18 @@ function deepMergeObjects(objects) {
|
|
|
1488
1323
|
}
|
|
1489
1324
|
return result;
|
|
1490
1325
|
}
|
|
1491
|
-
__name(deepMergeObjects, "deepMergeObjects");
|
|
1492
1326
|
|
|
1493
1327
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1494
1328
|
import { cwd as cwd2 } from "node:process";
|
|
1495
|
-
import
|
|
1329
|
+
import chalk23 from "chalk";
|
|
1496
1330
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1497
|
-
import {
|
|
1498
|
-
|
|
1331
|
+
import {
|
|
1332
|
+
DiagnosticCategory as DiagnosticCategory2,
|
|
1333
|
+
formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2,
|
|
1334
|
+
getPreEmitDiagnostics as getPreEmitDiagnostics2,
|
|
1335
|
+
sys as sys3
|
|
1336
|
+
} from "typescript";
|
|
1337
|
+
var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1499
1338
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1500
1339
|
const verbose = config2?.verbose ?? false;
|
|
1501
1340
|
const compilerOptions = {
|
|
@@ -1510,51 +1349,37 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
1510
1349
|
emitDeclarationOnly: false,
|
|
1511
1350
|
noEmit: true
|
|
1512
1351
|
};
|
|
1513
|
-
const validTsExt = [
|
|
1514
|
-
|
|
1515
|
-
".tsx",
|
|
1516
|
-
".d.ts",
|
|
1517
|
-
".cts",
|
|
1518
|
-
".d.cts",
|
|
1519
|
-
".mts",
|
|
1520
|
-
".d.mts"
|
|
1521
|
-
];
|
|
1522
|
-
const includes = [
|
|
1523
|
-
".stories.",
|
|
1524
|
-
".spec.",
|
|
1525
|
-
".d.ts",
|
|
1526
|
-
".d.cts",
|
|
1527
|
-
".d.mts"
|
|
1528
|
-
];
|
|
1352
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1353
|
+
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1529
1354
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1530
|
-
console.log(
|
|
1355
|
+
console.log(chalk23.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1531
1356
|
if (files.length > 0) {
|
|
1532
1357
|
const program = createProgramFromConfig2({
|
|
1533
1358
|
basePath: pkg ?? cwd2(),
|
|
1534
1359
|
compilerOptions,
|
|
1535
|
-
exclude: [
|
|
1536
|
-
"dist",
|
|
1537
|
-
"docs"
|
|
1538
|
-
],
|
|
1360
|
+
exclude: ["dist", "docs"],
|
|
1539
1361
|
files
|
|
1540
1362
|
});
|
|
1541
1363
|
const diagnostics = getPreEmitDiagnostics2(program);
|
|
1542
1364
|
if (diagnostics.length > 0) {
|
|
1543
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1365
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1366
|
+
diagnostics,
|
|
1367
|
+
{
|
|
1368
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1369
|
+
getCurrentDirectory: () => folder,
|
|
1370
|
+
getNewLine: () => sys3.newLine
|
|
1371
|
+
}
|
|
1372
|
+
);
|
|
1548
1373
|
console.error(formattedDiagnostics);
|
|
1549
1374
|
}
|
|
1550
1375
|
program.emit();
|
|
1551
1376
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
|
|
1552
1377
|
}
|
|
1553
1378
|
return 0;
|
|
1554
|
-
}
|
|
1379
|
+
};
|
|
1555
1380
|
|
|
1556
1381
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1557
|
-
var compileFolder =
|
|
1382
|
+
var compileFolder = async (folder, entryMode = "single", options, verbose) => {
|
|
1558
1383
|
const outDir = options?.outDir ?? "dist";
|
|
1559
1384
|
if (verbose) {
|
|
1560
1385
|
console.log(`compileFolder [${folder}]`);
|
|
@@ -1566,9 +1391,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1566
1391
|
clean: true,
|
|
1567
1392
|
dts: false,
|
|
1568
1393
|
entry,
|
|
1569
|
-
format: [
|
|
1570
|
-
"esm"
|
|
1571
|
-
],
|
|
1394
|
+
format: ["esm"],
|
|
1572
1395
|
outDir,
|
|
1573
1396
|
silent: true,
|
|
1574
1397
|
sourcemap: true,
|
|
@@ -1576,16 +1399,12 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1576
1399
|
tsconfig: "tsconfig.json",
|
|
1577
1400
|
...options
|
|
1578
1401
|
});
|
|
1579
|
-
const optionsList = (await Promise.all(
|
|
1580
|
-
optionsResult
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
return Array.isArray(result) ? result : [
|
|
1586
|
-
result
|
|
1587
|
-
];
|
|
1588
|
-
}))).flat();
|
|
1402
|
+
const optionsList = (await Promise.all(
|
|
1403
|
+
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
1404
|
+
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
1405
|
+
return Array.isArray(result) ? result : [result];
|
|
1406
|
+
})
|
|
1407
|
+
)).flat();
|
|
1589
1408
|
if (verbose) {
|
|
1590
1409
|
console.log(`TSUP:build:start [${folder}]`);
|
|
1591
1410
|
}
|
|
@@ -1594,8 +1413,8 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1594
1413
|
console.log(`TSUP:build:stop [${folder}]`);
|
|
1595
1414
|
}
|
|
1596
1415
|
return 0;
|
|
1597
|
-
}
|
|
1598
|
-
var tsupOptions =
|
|
1416
|
+
};
|
|
1417
|
+
var tsupOptions = (options = []) => {
|
|
1599
1418
|
const standardLoaders = {
|
|
1600
1419
|
".gif": "copy",
|
|
1601
1420
|
".html": "copy",
|
|
@@ -1607,39 +1426,24 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
|
|
|
1607
1426
|
};
|
|
1608
1427
|
const standardOptions = {
|
|
1609
1428
|
bundle: true,
|
|
1610
|
-
format: [
|
|
1611
|
-
"esm"
|
|
1612
|
-
],
|
|
1429
|
+
format: ["esm"],
|
|
1613
1430
|
loader: standardLoaders,
|
|
1614
|
-
outExtension:
|
|
1615
|
-
js: ".mjs"
|
|
1616
|
-
} : {
|
|
1617
|
-
js: ".cjs"
|
|
1618
|
-
}, "outExtension"),
|
|
1431
|
+
outExtension: ({ format }) => format === "esm" ? { js: ".mjs" } : { js: ".cjs" },
|
|
1619
1432
|
skipNodeModulesBundle: true,
|
|
1620
1433
|
sourcemap: true,
|
|
1621
1434
|
target: "esnext"
|
|
1622
1435
|
};
|
|
1623
|
-
return deepMergeObjects([
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
]);
|
|
1627
|
-
}, "tsupOptions");
|
|
1628
|
-
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1436
|
+
return deepMergeObjects([standardOptions, ...options]);
|
|
1437
|
+
};
|
|
1438
|
+
var packageCompileTsup = async (config2) => {
|
|
1629
1439
|
const compile2 = config2?.compile;
|
|
1630
1440
|
const verbose = config2?.verbose ?? false;
|
|
1631
1441
|
if (verbose) {
|
|
1632
1442
|
console.log(`Compiling with TSUP [Depth: ${compile2?.depth}]`);
|
|
1633
1443
|
}
|
|
1634
|
-
const compileForNode = compile2?.node ?? {
|
|
1635
|
-
|
|
1636
|
-
};
|
|
1637
|
-
const compileForBrowser = compile2?.browser ?? {
|
|
1638
|
-
src: {}
|
|
1639
|
-
};
|
|
1640
|
-
const compileForNeutral = compile2?.neutral ?? {
|
|
1641
|
-
src: {}
|
|
1642
|
-
};
|
|
1444
|
+
const compileForNode = compile2?.node ?? { src: {} };
|
|
1445
|
+
const compileForBrowser = compile2?.browser ?? { src: {} };
|
|
1446
|
+
const compileForNeutral = compile2?.neutral ?? { src: {} };
|
|
1643
1447
|
if (verbose) {
|
|
1644
1448
|
console.log("Calling packageCompileTscTypes");
|
|
1645
1449
|
}
|
|
@@ -1648,46 +1452,58 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1648
1452
|
if (errors > 0) {
|
|
1649
1453
|
return errors;
|
|
1650
1454
|
}
|
|
1651
|
-
return (await Promise.all(
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
{
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1455
|
+
return (await Promise.all(
|
|
1456
|
+
Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
1457
|
+
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1458
|
+
return folder ? await compileFolder(
|
|
1459
|
+
folder,
|
|
1460
|
+
compile2?.entryMode,
|
|
1461
|
+
tsupOptions([
|
|
1462
|
+
inEsBuildOptions,
|
|
1463
|
+
compile2?.tsup?.options ?? {},
|
|
1464
|
+
typeof options === "object" ? options : {},
|
|
1465
|
+
{ platform: "node", outDir: "dist/node" }
|
|
1466
|
+
]),
|
|
1467
|
+
verbose
|
|
1468
|
+
) : 0;
|
|
1469
|
+
})
|
|
1470
|
+
)).reduce((prev, value) => prev + value, 0) || (await Promise.all(
|
|
1471
|
+
Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
1472
|
+
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1473
|
+
return folder ? await compileFolder(
|
|
1474
|
+
folder,
|
|
1475
|
+
compile2?.entryMode,
|
|
1476
|
+
tsupOptions([
|
|
1477
|
+
inEsBuildOptions,
|
|
1478
|
+
compile2?.tsup?.options ?? {},
|
|
1479
|
+
typeof options === "object" ? options : {},
|
|
1480
|
+
{ platform: "browser", outDir: "dist/browser" }
|
|
1481
|
+
]),
|
|
1482
|
+
verbose
|
|
1483
|
+
) : 0;
|
|
1484
|
+
})
|
|
1485
|
+
)).reduce((prev, value) => prev + value, 0) || (await Promise.all(
|
|
1486
|
+
Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
1487
|
+
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1488
|
+
return folder ? await compileFolder(
|
|
1489
|
+
folder,
|
|
1490
|
+
compile2?.entryMode,
|
|
1491
|
+
tsupOptions([
|
|
1492
|
+
inEsBuildOptions,
|
|
1493
|
+
compile2?.tsup?.options ?? {},
|
|
1494
|
+
typeof options === "object" ? options : {},
|
|
1495
|
+
{ platform: "neutral", outDir: "dist/neutral" }
|
|
1496
|
+
]),
|
|
1497
|
+
verbose
|
|
1498
|
+
) : 0;
|
|
1499
|
+
})
|
|
1500
|
+
)).reduce((prev, value) => prev + value, 0) || 0;
|
|
1501
|
+
};
|
|
1686
1502
|
|
|
1687
1503
|
// src/actions/package/compile/compile.ts
|
|
1688
|
-
var packageCompile =
|
|
1504
|
+
var packageCompile = async (inConfig = {}) => {
|
|
1689
1505
|
const pkg = process.env.INIT_CWD;
|
|
1690
|
-
console.log(
|
|
1506
|
+
console.log(chalk24.green(`Compiling ${pkg}`));
|
|
1691
1507
|
const config2 = await loadConfig(inConfig);
|
|
1692
1508
|
const publint2 = config2.publint;
|
|
1693
1509
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1695,30 +1511,24 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1695
1511
|
return tsupResults;
|
|
1696
1512
|
}
|
|
1697
1513
|
return publint2 ? await packagePublint(config2) : 0;
|
|
1698
|
-
}
|
|
1514
|
+
};
|
|
1699
1515
|
|
|
1700
1516
|
// src/actions/package/copy-assets.ts
|
|
1701
|
-
import
|
|
1702
|
-
import
|
|
1517
|
+
import path6 from "node:path/posix";
|
|
1518
|
+
import chalk25 from "chalk";
|
|
1703
1519
|
import cpy2 from "cpy";
|
|
1704
|
-
var copyTargetAssets2 =
|
|
1520
|
+
var copyTargetAssets2 = async (target, name, location) => {
|
|
1705
1521
|
try {
|
|
1706
|
-
const values = await cpy2(
|
|
1707
|
-
"**/*.jpg",
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
"**/*.gif",
|
|
1715
|
-
"**/*.css"
|
|
1716
|
-
], `../dist/${target}`, {
|
|
1717
|
-
cwd: path5.join(location, "src"),
|
|
1718
|
-
flat: false
|
|
1719
|
-
});
|
|
1522
|
+
const values = await cpy2(
|
|
1523
|
+
["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
|
|
1524
|
+
`../dist/${target}`,
|
|
1525
|
+
{
|
|
1526
|
+
cwd: path6.join(location, "src"),
|
|
1527
|
+
flat: false
|
|
1528
|
+
}
|
|
1529
|
+
);
|
|
1720
1530
|
if (values.length > 0) {
|
|
1721
|
-
console.log(
|
|
1531
|
+
console.log(chalk25.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1722
1532
|
}
|
|
1723
1533
|
for (const value of values) {
|
|
1724
1534
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1729,8 +1539,8 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1729
1539
|
console.log(`Copy Assets Failed: ${name}: ${error.message}`);
|
|
1730
1540
|
return 1;
|
|
1731
1541
|
}
|
|
1732
|
-
}
|
|
1733
|
-
var packageCopyAssets =
|
|
1542
|
+
};
|
|
1543
|
+
var packageCopyAssets = async ({ target }) => {
|
|
1734
1544
|
const pkg = process.env.INIT_CWD ?? "./";
|
|
1735
1545
|
const pkgName = process.env.npm_package_name ?? "Unknown";
|
|
1736
1546
|
switch (target) {
|
|
@@ -1744,11 +1554,11 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1744
1554
|
return await copyTargetAssets2("esm", pkgName, pkg) || await copyTargetAssets2("cjs", pkgName, pkg);
|
|
1745
1555
|
}
|
|
1746
1556
|
}
|
|
1747
|
-
}
|
|
1557
|
+
};
|
|
1748
1558
|
|
|
1749
1559
|
// src/actions/package/cycle.ts
|
|
1750
1560
|
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1751
|
-
var packageCycle =
|
|
1561
|
+
var packageCycle = async ({ verbose = false }) => {
|
|
1752
1562
|
const pkg = process.env.INIT_CWD;
|
|
1753
1563
|
const pkgName = process.env.npm_package_name;
|
|
1754
1564
|
const cruiseOptions = {
|
|
@@ -1759,26 +1569,20 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1759
1569
|
severity: "error",
|
|
1760
1570
|
comment: "This dependency creates a circular reference",
|
|
1761
1571
|
from: {},
|
|
1762
|
-
to: {
|
|
1763
|
-
circular: true
|
|
1764
|
-
}
|
|
1572
|
+
to: { circular: true }
|
|
1765
1573
|
}
|
|
1766
1574
|
]
|
|
1767
1575
|
},
|
|
1768
1576
|
exclude: "node_modules|packages/.*/packages",
|
|
1769
1577
|
validate: true,
|
|
1770
|
-
doNotFollow: {
|
|
1771
|
-
path: "node_modules|packages/.*/packages"
|
|
1772
|
-
},
|
|
1578
|
+
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
1773
1579
|
tsPreCompilationDeps: false,
|
|
1774
1580
|
combinedDependencies: true,
|
|
1775
1581
|
outputType: verbose ? "text" : "err"
|
|
1776
1582
|
};
|
|
1777
1583
|
const target = `${pkg}/src`;
|
|
1778
1584
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1779
|
-
const result = await cruise2([
|
|
1780
|
-
target
|
|
1781
|
-
], cruiseOptions);
|
|
1585
|
+
const result = await cruise2([target], cruiseOptions);
|
|
1782
1586
|
if (result.output) {
|
|
1783
1587
|
console.log(result.output);
|
|
1784
1588
|
}
|
|
@@ -1788,13 +1592,18 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1788
1592
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
1789
1593
|
}
|
|
1790
1594
|
return result.exitCode;
|
|
1791
|
-
}
|
|
1595
|
+
};
|
|
1792
1596
|
|
|
1793
1597
|
// src/actions/package/gen-docs.ts
|
|
1794
1598
|
import { existsSync as existsSync4 } from "node:fs";
|
|
1795
|
-
import
|
|
1796
|
-
import
|
|
1797
|
-
import {
|
|
1599
|
+
import path7 from "node:path";
|
|
1600
|
+
import chalk26 from "chalk";
|
|
1601
|
+
import {
|
|
1602
|
+
Application,
|
|
1603
|
+
ArgumentsReader,
|
|
1604
|
+
TSConfigReader,
|
|
1605
|
+
TypeDocReader
|
|
1606
|
+
} from "typedoc";
|
|
1798
1607
|
var ExitCodes = {
|
|
1799
1608
|
CompileError: 3,
|
|
1800
1609
|
ExceptionThrown: 6,
|
|
@@ -1804,17 +1613,14 @@ var ExitCodes = {
|
|
|
1804
1613
|
OutputError: 5,
|
|
1805
1614
|
ValidationError: 4
|
|
1806
1615
|
};
|
|
1807
|
-
var packageGenDocs =
|
|
1616
|
+
var packageGenDocs = async () => {
|
|
1808
1617
|
const pkg = process.env.INIT_CWD;
|
|
1809
|
-
if (pkg && !existsSync4(
|
|
1618
|
+
if (pkg && !existsSync4(path7.join(pkg, "typedoc.json"))) {
|
|
1810
1619
|
return;
|
|
1811
1620
|
}
|
|
1812
1621
|
const app = await Application.bootstrap({
|
|
1813
1622
|
entryPointStrategy: "merge",
|
|
1814
|
-
entryPoints: [
|
|
1815
|
-
`${pkg}/src/**/*.ts`,
|
|
1816
|
-
`${pkg}/packages/*/dist/docs.json`
|
|
1817
|
-
],
|
|
1623
|
+
entryPoints: [`${pkg}/src/**/*.ts`, `${pkg}/packages/*/dist/docs.json`],
|
|
1818
1624
|
excludeExternals: true,
|
|
1819
1625
|
json: `${pkg}/dist/docs.json`,
|
|
1820
1626
|
logLevel: "Error",
|
|
@@ -1825,8 +1631,8 @@ var packageGenDocs = /* @__PURE__ */ __name(async () => {
|
|
|
1825
1631
|
app.options.addReader(new TSConfigReader());
|
|
1826
1632
|
app.options.addReader(new ArgumentsReader(300));
|
|
1827
1633
|
return await runTypeDoc(app);
|
|
1828
|
-
}
|
|
1829
|
-
var runTypeDoc =
|
|
1634
|
+
};
|
|
1635
|
+
var runTypeDoc = async (app) => {
|
|
1830
1636
|
const pkgName = process.env.npm_package_name;
|
|
1831
1637
|
if (app.options.getValue("version")) {
|
|
1832
1638
|
console.log(app.toString());
|
|
@@ -1895,40 +1701,37 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1895
1701
|
return ExitCodes.OutputError;
|
|
1896
1702
|
}
|
|
1897
1703
|
}
|
|
1898
|
-
console.log(
|
|
1704
|
+
console.log(chalk26.green(`${pkgName} - Ok`));
|
|
1899
1705
|
return ExitCodes.Ok;
|
|
1900
|
-
}
|
|
1706
|
+
};
|
|
1901
1707
|
|
|
1902
1708
|
// src/actions/package/lint.ts
|
|
1903
1709
|
import { readdirSync } from "node:fs";
|
|
1904
|
-
import
|
|
1710
|
+
import path8 from "node:path";
|
|
1905
1711
|
import { cwd as cwd3 } from "node:process";
|
|
1906
1712
|
import { pathToFileURL } from "node:url";
|
|
1907
|
-
import
|
|
1713
|
+
import chalk27 from "chalk";
|
|
1908
1714
|
import { ESLint } from "eslint";
|
|
1909
1715
|
import { findUp } from "find-up";
|
|
1910
1716
|
import picomatch from "picomatch";
|
|
1911
|
-
var dumpMessages =
|
|
1912
|
-
const colors = [
|
|
1913
|
-
|
|
1914
|
-
"yellow",
|
|
1915
|
-
"red"
|
|
1916
|
-
];
|
|
1917
|
-
const severity = [
|
|
1918
|
-
"none",
|
|
1919
|
-
"warning",
|
|
1920
|
-
"error"
|
|
1921
|
-
];
|
|
1717
|
+
var dumpMessages = (lintResults) => {
|
|
1718
|
+
const colors = ["white", "yellow", "red"];
|
|
1719
|
+
const severity = ["none", "warning", "error"];
|
|
1922
1720
|
for (const lintResult of lintResults) {
|
|
1923
1721
|
if (lintResult.messages.length > 0) {
|
|
1924
|
-
console.log(
|
|
1722
|
+
console.log(chalk27.gray(`
|
|
1925
1723
|
${lintResult.filePath}`));
|
|
1926
1724
|
for (const message of lintResult.messages) {
|
|
1927
|
-
console.log(
|
|
1725
|
+
console.log(
|
|
1726
|
+
chalk27.gray(` ${message.line}:${message.column}`),
|
|
1727
|
+
chalk27[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1728
|
+
chalk27.white(` ${message.message}`),
|
|
1729
|
+
chalk27.gray(` ${message.ruleId}`)
|
|
1730
|
+
);
|
|
1928
1731
|
}
|
|
1929
1732
|
}
|
|
1930
1733
|
}
|
|
1931
|
-
}
|
|
1734
|
+
};
|
|
1932
1735
|
async function getRootESLintConfig() {
|
|
1933
1736
|
const configPath = await findUp("eslint.config.mjs");
|
|
1934
1737
|
if (!configPath) {
|
|
@@ -1936,50 +1739,33 @@ async function getRootESLintConfig() {
|
|
|
1936
1739
|
}
|
|
1937
1740
|
return pathToFileURL(configPath);
|
|
1938
1741
|
}
|
|
1939
|
-
__name(getRootESLintConfig, "getRootESLintConfig");
|
|
1940
1742
|
function getFiles(dir, ignoreFolders) {
|
|
1941
1743
|
const currentDirectory = cwd3();
|
|
1942
1744
|
const subDirectory = dir.split(currentDirectory)[1];
|
|
1943
1745
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
1944
|
-
return readdirSync(dir, {
|
|
1945
|
-
|
|
1946
|
-
}).flatMap((dirent) => {
|
|
1947
|
-
const res = path7.resolve(dir, dirent.name);
|
|
1746
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
1747
|
+
const res = path8.resolve(dir, dirent.name);
|
|
1948
1748
|
const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name;
|
|
1949
1749
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
1950
1750
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
1951
|
-
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
|
|
1952
|
-
res
|
|
1953
|
-
];
|
|
1751
|
+
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [res];
|
|
1954
1752
|
});
|
|
1955
1753
|
}
|
|
1956
|
-
|
|
1957
|
-
var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, cache = true) => {
|
|
1754
|
+
var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
1958
1755
|
const pkg = process.env.INIT_CWD;
|
|
1959
1756
|
const configPath = await getRootESLintConfig();
|
|
1960
1757
|
const { default: eslintConfig } = await import(configPath.href);
|
|
1961
1758
|
const start = Date.now();
|
|
1962
|
-
const ignoreFolders = [
|
|
1963
|
-
"node_modules",
|
|
1964
|
-
"dist",
|
|
1965
|
-
"packages",
|
|
1966
|
-
".git",
|
|
1967
|
-
"build",
|
|
1968
|
-
".yarn",
|
|
1969
|
-
".vscode",
|
|
1970
|
-
".github"
|
|
1971
|
-
];
|
|
1759
|
+
const ignoreFolders = ["node_modules", "dist", "packages", ".git", "build", ".yarn", ".vscode", ".github"];
|
|
1972
1760
|
const engine = new ESLint({
|
|
1973
|
-
baseConfig: [
|
|
1974
|
-
...eslintConfig
|
|
1975
|
-
],
|
|
1761
|
+
baseConfig: [...eslintConfig],
|
|
1976
1762
|
fix: fix2,
|
|
1977
1763
|
warnIgnored: false,
|
|
1978
1764
|
cache
|
|
1979
1765
|
});
|
|
1980
1766
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
1981
1767
|
if (verbose) {
|
|
1982
|
-
console.log(
|
|
1768
|
+
console.log(chalk27.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
1983
1769
|
}
|
|
1984
1770
|
const lintResults = await engine.lintFiles(files);
|
|
1985
1771
|
dumpMessages(lintResults);
|
|
@@ -1989,75 +1775,43 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
1989
1775
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
1990
1776
|
const lintTime = Date.now() - start;
|
|
1991
1777
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
1992
|
-
console.log(
|
|
1778
|
+
console.log(chalk27.white(`Linted ${chalk27[filesCountColor](files.length)} files in ${chalk27[lintTimeColor](lintTime)}ms`));
|
|
1993
1779
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1994
|
-
}
|
|
1780
|
+
};
|
|
1995
1781
|
|
|
1996
1782
|
// src/actions/package/recompile.ts
|
|
1997
|
-
var packageRecompile =
|
|
1783
|
+
var packageRecompile = async () => {
|
|
1998
1784
|
return await packageClean() || await packageCompile();
|
|
1999
|
-
}
|
|
1785
|
+
};
|
|
2000
1786
|
|
|
2001
1787
|
// src/actions/publint.ts
|
|
2002
|
-
var publint =
|
|
2003
|
-
return pkg ? await publintPackage({
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
[
|
|
2013
|
-
"yarn",
|
|
2014
|
-
[
|
|
2015
|
-
"workspace",
|
|
2016
|
-
pkg,
|
|
2017
|
-
"run",
|
|
2018
|
-
"package-publint"
|
|
2019
|
-
]
|
|
2020
|
-
]
|
|
2021
|
-
]);
|
|
2022
|
-
}, "publintPackage");
|
|
2023
|
-
var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
2024
|
-
const verboseOptions = verbose ? [
|
|
2025
|
-
"--verbose"
|
|
2026
|
-
] : [
|
|
2027
|
-
"--no-verbose"
|
|
2028
|
-
];
|
|
2029
|
-
return runSteps("Publint", [
|
|
2030
|
-
[
|
|
2031
|
-
"yarn",
|
|
2032
|
-
[
|
|
2033
|
-
"workspaces",
|
|
2034
|
-
"foreach",
|
|
2035
|
-
"-pA",
|
|
2036
|
-
...verboseOptions,
|
|
2037
|
-
"run",
|
|
2038
|
-
"package-publint"
|
|
2039
|
-
]
|
|
2040
|
-
]
|
|
2041
|
-
]);
|
|
2042
|
-
}, "publintAll");
|
|
1788
|
+
var publint = async ({ verbose, pkg }) => {
|
|
1789
|
+
return pkg ? await publintPackage({ pkg, verbose }) : publintAll({ verbose });
|
|
1790
|
+
};
|
|
1791
|
+
var publintPackage = ({ pkg }) => {
|
|
1792
|
+
return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
|
|
1793
|
+
};
|
|
1794
|
+
var publintAll = ({ verbose }) => {
|
|
1795
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1796
|
+
return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
|
|
1797
|
+
};
|
|
2043
1798
|
|
|
2044
1799
|
// src/actions/rebuild.ts
|
|
2045
|
-
var rebuild =
|
|
1800
|
+
var rebuild = ({ target }) => {
|
|
2046
1801
|
return runSteps("Rebuild", [
|
|
2047
|
-
[
|
|
2048
|
-
|
|
2049
|
-
"xy clean"
|
|
2050
|
-
],
|
|
2051
|
-
[
|
|
2052
|
-
"yarn",
|
|
2053
|
-
target ? `xy build -t ${target}` : "xy build"
|
|
2054
|
-
]
|
|
1802
|
+
["yarn", "xy clean"],
|
|
1803
|
+
["yarn", target ? `xy build -t ${target}` : "xy build"]
|
|
2055
1804
|
]);
|
|
2056
|
-
}
|
|
1805
|
+
};
|
|
2057
1806
|
|
|
2058
1807
|
// src/actions/recompile.ts
|
|
2059
|
-
import
|
|
2060
|
-
var recompile =
|
|
1808
|
+
import chalk28 from "chalk";
|
|
1809
|
+
var recompile = async ({
|
|
1810
|
+
verbose,
|
|
1811
|
+
target,
|
|
1812
|
+
pkg,
|
|
1813
|
+
incremental
|
|
1814
|
+
}) => {
|
|
2061
1815
|
return pkg ? await recompilePackage({
|
|
2062
1816
|
pkg,
|
|
2063
1817
|
target,
|
|
@@ -2067,51 +1821,27 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
|
|
|
2067
1821
|
target,
|
|
2068
1822
|
verbose
|
|
2069
1823
|
});
|
|
2070
|
-
}
|
|
2071
|
-
var recompilePackage =
|
|
2072
|
-
const targetOptions = target ? [
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
...targetOptions
|
|
2085
|
-
]
|
|
2086
|
-
]
|
|
2087
|
-
]);
|
|
2088
|
-
}, "recompilePackage");
|
|
2089
|
-
var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, incremental }) => {
|
|
1824
|
+
};
|
|
1825
|
+
var recompilePackage = ({ target, pkg }) => {
|
|
1826
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
1827
|
+
return runStepsAsync(
|
|
1828
|
+
`Recompile [${pkg}]`,
|
|
1829
|
+
[["yarn", ["workspace", pkg, "run", "package-recompile", ...targetOptions]]]
|
|
1830
|
+
);
|
|
1831
|
+
};
|
|
1832
|
+
var recompileAll = async ({
|
|
1833
|
+
jobs,
|
|
1834
|
+
verbose,
|
|
1835
|
+
target,
|
|
1836
|
+
incremental
|
|
1837
|
+
}) => {
|
|
2090
1838
|
const start = Date.now();
|
|
2091
|
-
const verboseOptions = verbose ? [
|
|
2092
|
-
|
|
2093
|
-
] : [
|
|
2094
|
-
|
|
2095
|
-
];
|
|
2096
|
-
const targetOptions = target ? [
|
|
2097
|
-
"-t",
|
|
2098
|
-
target
|
|
2099
|
-
] : [];
|
|
2100
|
-
const incrementalOptions = incremental ? [
|
|
2101
|
-
"--since",
|
|
2102
|
-
"-Apt",
|
|
2103
|
-
"--topological-dev"
|
|
2104
|
-
] : [
|
|
2105
|
-
"--parallel",
|
|
2106
|
-
"-Apt",
|
|
2107
|
-
"--topological-dev"
|
|
2108
|
-
];
|
|
2109
|
-
const jobsOptions = jobs ? [
|
|
2110
|
-
"-j",
|
|
2111
|
-
`${jobs}`
|
|
2112
|
-
] : [];
|
|
1839
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1840
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
1841
|
+
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1842
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2113
1843
|
if (jobs) {
|
|
2114
|
-
console.log(
|
|
1844
|
+
console.log(chalk28.blue(`Jobs set to [${jobs}]`));
|
|
2115
1845
|
}
|
|
2116
1846
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2117
1847
|
[
|
|
@@ -2141,13 +1871,19 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2141
1871
|
]
|
|
2142
1872
|
]
|
|
2143
1873
|
]);
|
|
2144
|
-
console.log(
|
|
1874
|
+
console.log(
|
|
1875
|
+
`${chalk28.gray("Recompiled in")} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`
|
|
1876
|
+
);
|
|
2145
1877
|
return result;
|
|
2146
|
-
}
|
|
1878
|
+
};
|
|
2147
1879
|
|
|
2148
1880
|
// src/actions/reinstall.ts
|
|
2149
|
-
import {
|
|
2150
|
-
|
|
1881
|
+
import {
|
|
1882
|
+
closeSync,
|
|
1883
|
+
openSync,
|
|
1884
|
+
rmSync
|
|
1885
|
+
} from "node:fs";
|
|
1886
|
+
var reinstall = () => {
|
|
2151
1887
|
console.log("Reinstall [Clear Lock File]");
|
|
2152
1888
|
closeSync(openSync("./yarn.lock", "w"));
|
|
2153
1889
|
console.log("Reinstall [Clear Node Modules]");
|
|
@@ -2155,10 +1891,7 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2155
1891
|
const result = workspaces.map(({ location, name }) => {
|
|
2156
1892
|
const dist = `${location}/node_modules`;
|
|
2157
1893
|
try {
|
|
2158
|
-
rmSync(dist, {
|
|
2159
|
-
force: true,
|
|
2160
|
-
recursive: true
|
|
2161
|
-
});
|
|
1894
|
+
rmSync(dist, { force: true, recursive: true });
|
|
2162
1895
|
return 0;
|
|
2163
1896
|
} catch (ex) {
|
|
2164
1897
|
const error = ex;
|
|
@@ -2166,226 +1899,115 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2166
1899
|
return 1;
|
|
2167
1900
|
}
|
|
2168
1901
|
}).reduce((prev, result2) => prev || result2, 0);
|
|
2169
|
-
return result || runSteps("Reinstall", [
|
|
2170
|
-
|
|
2171
|
-
"yarn",
|
|
2172
|
-
"install --network-timeout 10000"
|
|
2173
|
-
]
|
|
2174
|
-
]);
|
|
2175
|
-
}, "reinstall");
|
|
1902
|
+
return result || runSteps("Reinstall", [["yarn", "install --network-timeout 10000"]]);
|
|
1903
|
+
};
|
|
2176
1904
|
|
|
2177
1905
|
// src/actions/relint.ts
|
|
2178
|
-
import
|
|
2179
|
-
var relintPackage =
|
|
2180
|
-
console.log(
|
|
1906
|
+
import chalk29 from "chalk";
|
|
1907
|
+
var relintPackage = ({ pkg }) => {
|
|
1908
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2181
1909
|
const start = Date.now();
|
|
2182
1910
|
const result = runSteps("Relint [All-Packages]", [
|
|
2183
|
-
[
|
|
2184
|
-
"
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
"package-relint"
|
|
2190
|
-
]
|
|
2191
|
-
]
|
|
1911
|
+
["yarn", [
|
|
1912
|
+
"workspace",
|
|
1913
|
+
pkg,
|
|
1914
|
+
"run",
|
|
1915
|
+
"package-relint"
|
|
1916
|
+
]]
|
|
2192
1917
|
]);
|
|
2193
|
-
console.log(
|
|
1918
|
+
console.log(chalk29.gray(`${"Relinted in"} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2194
1919
|
return result;
|
|
2195
|
-
}
|
|
2196
|
-
var relint =
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
console.log(chalk28.gray(`${"Relint"} [All-Packages]`));
|
|
1920
|
+
};
|
|
1921
|
+
var relint = ({
|
|
1922
|
+
pkg,
|
|
1923
|
+
verbose,
|
|
1924
|
+
incremental
|
|
1925
|
+
} = {}) => {
|
|
1926
|
+
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
1927
|
+
};
|
|
1928
|
+
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
1929
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2206
1930
|
const start = Date.now();
|
|
2207
|
-
const verboseOptions = verbose ? [
|
|
2208
|
-
|
|
2209
|
-
] : [
|
|
2210
|
-
"--no-verbose"
|
|
2211
|
-
];
|
|
2212
|
-
const incrementalOptions = incremental ? [
|
|
2213
|
-
"--since",
|
|
2214
|
-
"-Ap"
|
|
2215
|
-
] : [
|
|
2216
|
-
"--parallel",
|
|
2217
|
-
"-Ap"
|
|
2218
|
-
];
|
|
1931
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1932
|
+
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
2219
1933
|
const result = runSteps(`${"Relint"} [All-Packages]`, [
|
|
2220
|
-
[
|
|
2221
|
-
"
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
"package-relint"
|
|
2229
|
-
]
|
|
2230
|
-
]
|
|
1934
|
+
["yarn", [
|
|
1935
|
+
"workspaces",
|
|
1936
|
+
"foreach",
|
|
1937
|
+
...verboseOptions,
|
|
1938
|
+
...incrementalOptions,
|
|
1939
|
+
"run",
|
|
1940
|
+
"package-relint"
|
|
1941
|
+
]]
|
|
2231
1942
|
]);
|
|
2232
|
-
console.log(
|
|
1943
|
+
console.log(chalk29.gray(`Relinted in [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2233
1944
|
return result;
|
|
2234
|
-
}
|
|
1945
|
+
};
|
|
2235
1946
|
|
|
2236
1947
|
// src/actions/retest.ts
|
|
2237
|
-
var retest =
|
|
1948
|
+
var retest = () => {
|
|
2238
1949
|
return runSteps("Test", [
|
|
2239
|
-
[
|
|
2240
|
-
|
|
2241
|
-
[
|
|
2242
|
-
"jest",
|
|
2243
|
-
"--clearCache"
|
|
2244
|
-
]
|
|
2245
|
-
],
|
|
2246
|
-
[
|
|
2247
|
-
"yarn",
|
|
2248
|
-
[
|
|
2249
|
-
"jest",
|
|
2250
|
-
"."
|
|
2251
|
-
]
|
|
2252
|
-
]
|
|
1950
|
+
["yarn", ["jest", "--clearCache"]],
|
|
1951
|
+
["yarn", ["jest", "."]]
|
|
2253
1952
|
]);
|
|
2254
|
-
}
|
|
1953
|
+
};
|
|
2255
1954
|
|
|
2256
1955
|
// src/actions/sonar.ts
|
|
2257
|
-
var sonar =
|
|
2258
|
-
return runSteps("Sonar", [
|
|
2259
|
-
|
|
2260
|
-
"yarn",
|
|
2261
|
-
[
|
|
2262
|
-
"eslint",
|
|
2263
|
-
"-c",
|
|
2264
|
-
"sonar.eslintrc",
|
|
2265
|
-
"."
|
|
2266
|
-
]
|
|
2267
|
-
]
|
|
2268
|
-
]);
|
|
2269
|
-
}, "sonar");
|
|
1956
|
+
var sonar = () => {
|
|
1957
|
+
return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
|
|
1958
|
+
};
|
|
2270
1959
|
|
|
2271
1960
|
// src/actions/statics.ts
|
|
2272
|
-
import
|
|
2273
|
-
var DefaultDependencies = [
|
|
2274
|
-
|
|
2275
|
-
"
|
|
2276
|
-
"react",
|
|
2277
|
-
"graphql",
|
|
2278
|
-
"react-router",
|
|
2279
|
-
"@mui/material",
|
|
2280
|
-
"@mui/system"
|
|
2281
|
-
];
|
|
2282
|
-
var statics = /* @__PURE__ */ __name(() => {
|
|
2283
|
-
console.log(chalk29.green("Check Required Static Dependencies"));
|
|
1961
|
+
import chalk30 from "chalk";
|
|
1962
|
+
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
1963
|
+
var statics = () => {
|
|
1964
|
+
console.log(chalk30.green("Check Required Static Dependencies"));
|
|
2284
1965
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2285
1966
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2286
|
-
}
|
|
1967
|
+
};
|
|
2287
1968
|
|
|
2288
1969
|
// src/actions/test.ts
|
|
2289
|
-
var test =
|
|
2290
|
-
return runSteps("Test", [
|
|
2291
|
-
|
|
2292
|
-
"yarn",
|
|
2293
|
-
[
|
|
2294
|
-
"vitest",
|
|
2295
|
-
"."
|
|
2296
|
-
]
|
|
2297
|
-
]
|
|
2298
|
-
]);
|
|
2299
|
-
}, "test");
|
|
1970
|
+
var test = () => {
|
|
1971
|
+
return runSteps("Test", [["yarn", ["vitest", "."]]]);
|
|
1972
|
+
};
|
|
2300
1973
|
|
|
2301
1974
|
// src/actions/up.ts
|
|
2302
|
-
var up =
|
|
2303
|
-
return runSteps("Up", [
|
|
2304
|
-
|
|
2305
|
-
"yarn",
|
|
2306
|
-
"outdated"
|
|
2307
|
-
]
|
|
2308
|
-
]);
|
|
2309
|
-
}, "up");
|
|
1975
|
+
var up = () => {
|
|
1976
|
+
return runSteps("Up", [["yarn", "outdated"]]);
|
|
1977
|
+
};
|
|
2310
1978
|
|
|
2311
1979
|
// src/actions/updo.ts
|
|
2312
|
-
var updo =
|
|
1980
|
+
var updo = () => {
|
|
2313
1981
|
return runSteps("Updo", [
|
|
2314
|
-
[
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
],
|
|
2318
|
-
[
|
|
2319
|
-
"yarn",
|
|
2320
|
-
"upgrade-interactive"
|
|
2321
|
-
],
|
|
2322
|
-
[
|
|
2323
|
-
"yarn",
|
|
2324
|
-
"dedupe"
|
|
2325
|
-
]
|
|
1982
|
+
["yarn", "install"],
|
|
1983
|
+
["yarn", "upgrade-interactive"],
|
|
1984
|
+
["yarn", "dedupe"]
|
|
2326
1985
|
]);
|
|
2327
|
-
}
|
|
1986
|
+
};
|
|
2328
1987
|
|
|
2329
1988
|
// src/actions/upplug.ts
|
|
2330
|
-
var updateYarnPlugins =
|
|
1989
|
+
var updateYarnPlugins = () => {
|
|
2331
1990
|
return runSteps("Update Yarn Plugins", [
|
|
2332
|
-
[
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
"import",
|
|
2337
|
-
"https://mskelton.dev/yarn-outdated/v3"
|
|
2338
|
-
]
|
|
2339
|
-
],
|
|
2340
|
-
[
|
|
2341
|
-
"yarn",
|
|
2342
|
-
[
|
|
2343
|
-
"plugin",
|
|
2344
|
-
"import",
|
|
2345
|
-
"version"
|
|
2346
|
-
]
|
|
2347
|
-
],
|
|
2348
|
-
[
|
|
2349
|
-
"yarn",
|
|
2350
|
-
[
|
|
2351
|
-
"plugin",
|
|
2352
|
-
"import",
|
|
2353
|
-
"interactive-tools"
|
|
2354
|
-
]
|
|
2355
|
-
],
|
|
2356
|
-
[
|
|
2357
|
-
"yarn",
|
|
2358
|
-
[
|
|
2359
|
-
"plugin",
|
|
2360
|
-
"import",
|
|
2361
|
-
"workspace-tools"
|
|
2362
|
-
]
|
|
2363
|
-
]
|
|
1991
|
+
["yarn", ["plugin", "import", "https://mskelton.dev/yarn-outdated/v3"]],
|
|
1992
|
+
["yarn", ["plugin", "import", "version"]],
|
|
1993
|
+
["yarn", ["plugin", "import", "interactive-tools"]],
|
|
1994
|
+
["yarn", ["plugin", "import", "workspace-tools"]]
|
|
2364
1995
|
]);
|
|
2365
|
-
}
|
|
1996
|
+
};
|
|
2366
1997
|
|
|
2367
1998
|
// src/actions/upyarn.ts
|
|
2368
|
-
var updateYarnVersion =
|
|
2369
|
-
return runSteps("Update Yarn Version", [
|
|
2370
|
-
|
|
2371
|
-
"yarn",
|
|
2372
|
-
[
|
|
2373
|
-
"set",
|
|
2374
|
-
"version",
|
|
2375
|
-
"latest"
|
|
2376
|
-
]
|
|
2377
|
-
]
|
|
2378
|
-
]);
|
|
2379
|
-
}, "updateYarnVersion");
|
|
1999
|
+
var updateYarnVersion = () => {
|
|
2000
|
+
return runSteps("Update Yarn Version", [["yarn", ["set", "version", "latest"]]]);
|
|
2001
|
+
};
|
|
2380
2002
|
|
|
2381
2003
|
// src/actions/yarn3only.ts
|
|
2382
|
-
var yarn3Only =
|
|
2004
|
+
var yarn3Only = () => {
|
|
2383
2005
|
const [valid, version] = isYarnVersionOrGreater(3);
|
|
2384
2006
|
if (!valid) {
|
|
2385
2007
|
processEx(`Invalid Yarn version [${version}]`);
|
|
2386
2008
|
}
|
|
2387
2009
|
return 0;
|
|
2388
|
-
}
|
|
2010
|
+
};
|
|
2389
2011
|
export {
|
|
2390
2012
|
build,
|
|
2391
2013
|
clean,
|
|
@@ -2403,6 +2025,7 @@ export {
|
|
|
2403
2025
|
cycleAll,
|
|
2404
2026
|
cyclePackage,
|
|
2405
2027
|
dead,
|
|
2028
|
+
deplint,
|
|
2406
2029
|
deploy,
|
|
2407
2030
|
deployMajor,
|
|
2408
2031
|
deployMinor,
|