@xylabs/ts-scripts-yarn3 6.3.4 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/build.mjs +39 -87
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-docs.mjs +8 -22
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs +5 -11
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs +16 -29
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +32 -63
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile-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 +191 -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 -50
- 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 +860 -1237
- 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 -44
- 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 +1082 -1233
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1334 -1579
- 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 +1082 -1234
- 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 +1082 -1234
- 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 +409 -288
- 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 +5 -24
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,243 +664,299 @@ 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
|
+
}) {
|
|
764
|
+
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
765
|
+
const {
|
|
766
|
+
prodImportPaths,
|
|
767
|
+
devImportPaths,
|
|
768
|
+
externalProdImports,
|
|
769
|
+
externalDevImports
|
|
770
|
+
} = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
771
|
+
const {
|
|
772
|
+
dependencies,
|
|
773
|
+
devDependencies,
|
|
774
|
+
peerDependencies
|
|
775
|
+
} = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
776
|
+
let unlistedDependencies = 0;
|
|
777
|
+
let unlistedDevDependencies = 0;
|
|
778
|
+
for (const imp of externalProdImports) {
|
|
779
|
+
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
780
|
+
unlistedDependencies++;
|
|
781
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
782
|
+
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
783
|
+
console.log("");
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
for (const dep of dependencies) {
|
|
787
|
+
if (!externalProdImports.includes(dep)) {
|
|
788
|
+
unlistedDependencies++;
|
|
789
|
+
console.log(`[${chalk13.blue(name)}] Unused dependency in package.json: ${chalk13.red(dep)}`);
|
|
790
|
+
console.log(` ${location}/package.json
|
|
791
|
+
`);
|
|
792
|
+
console.log("");
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
for (const dep of peerDependencies) {
|
|
796
|
+
if (!externalProdImports.includes(dep)) {
|
|
797
|
+
unlistedDependencies++;
|
|
798
|
+
console.log(`[${chalk13.blue(name)}] Unused peerDependency in package.json: ${chalk13.red(dep)}`);
|
|
799
|
+
console.log(` ${location}/package.json
|
|
800
|
+
`);
|
|
801
|
+
console.log("");
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
if (devDeps) {
|
|
805
|
+
for (const imp of externalDevImports) {
|
|
806
|
+
if (!devDependencies.includes(imp)) {
|
|
807
|
+
unlistedDevDependencies++;
|
|
808
|
+
console.log(`[${chalk13.blue(name)}] Missing devDependency in package.json: ${chalk13.red(imp)}`);
|
|
809
|
+
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies;
|
|
814
|
+
return totalErrors;
|
|
815
|
+
}
|
|
816
|
+
var deplint = ({ pkg }) => {
|
|
817
|
+
if (pkg) {
|
|
818
|
+
const { location, name } = yarnWorkspace(pkg);
|
|
819
|
+
console.log(`Running Deplint for ${name}`);
|
|
820
|
+
check({
|
|
821
|
+
name,
|
|
822
|
+
location,
|
|
823
|
+
devDeps: true
|
|
824
|
+
});
|
|
825
|
+
} else {
|
|
826
|
+
const workspaces = yarnWorkspaces();
|
|
827
|
+
console.log("Deplint Started...");
|
|
828
|
+
let totalErrors = 0;
|
|
829
|
+
for (const workspace of workspaces) {
|
|
830
|
+
totalErrors += check(workspace);
|
|
831
|
+
}
|
|
832
|
+
if (totalErrors > 0) {
|
|
833
|
+
console.log(`Found ${chalk13.red(totalErrors)} unlisted imports.`);
|
|
834
|
+
} else {
|
|
835
|
+
console.log(`No unlisted imports found. ${chalk13.green("\u2714")}`);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return 0;
|
|
839
|
+
};
|
|
861
840
|
|
|
862
841
|
// src/actions/deploy.ts
|
|
863
|
-
var deploy =
|
|
842
|
+
var deploy = () => {
|
|
864
843
|
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
|
-
]
|
|
844
|
+
["yarn", "workspaces foreach --all version patch --deferred"],
|
|
845
|
+
["yarn", "xy clean"],
|
|
846
|
+
["yarn", "xy build"],
|
|
847
|
+
["yarn", "version apply --all"],
|
|
848
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
885
849
|
]);
|
|
886
|
-
}
|
|
850
|
+
};
|
|
887
851
|
|
|
888
852
|
// src/actions/deploy-major.ts
|
|
889
|
-
var deployMajor =
|
|
853
|
+
var deployMajor = () => {
|
|
890
854
|
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
|
-
]
|
|
855
|
+
["yarn", "workspaces foreach --all version major --deferred"],
|
|
856
|
+
["yarn", "xy clean"],
|
|
857
|
+
["yarn", "xy build"],
|
|
858
|
+
["yarn", "version apply --all"],
|
|
859
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
911
860
|
]);
|
|
912
|
-
}
|
|
861
|
+
};
|
|
913
862
|
|
|
914
863
|
// src/actions/deploy-minor.ts
|
|
915
|
-
var deployMinor =
|
|
864
|
+
var deployMinor = () => {
|
|
916
865
|
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
|
-
]
|
|
866
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
867
|
+
["yarn", "xy clean"],
|
|
868
|
+
["yarn", "xy build"],
|
|
869
|
+
["yarn", "version apply --all"],
|
|
870
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
937
871
|
]);
|
|
938
|
-
}
|
|
872
|
+
};
|
|
939
873
|
|
|
940
874
|
// src/actions/deploy-next.ts
|
|
941
|
-
var deployNext =
|
|
875
|
+
var deployNext = () => {
|
|
942
876
|
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
|
-
]
|
|
877
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
878
|
+
["yarn", "xy clean"],
|
|
879
|
+
["yarn", "xy build"],
|
|
880
|
+
["yarn", "version apply --all --prerelease"],
|
|
881
|
+
["yarn", "workspaces foreach --all --parallel npm publish --tag next"]
|
|
963
882
|
]);
|
|
964
|
-
}
|
|
883
|
+
};
|
|
965
884
|
|
|
966
885
|
// src/actions/dupdeps.ts
|
|
967
|
-
import
|
|
968
|
-
var dupdeps =
|
|
969
|
-
console.log(
|
|
886
|
+
import chalk14 from "chalk";
|
|
887
|
+
var dupdeps = () => {
|
|
888
|
+
console.log(chalk14.green("Checking all Dependencies for Duplicates"));
|
|
970
889
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
971
890
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
972
891
|
return detectDuplicateDependencies(dependencies);
|
|
973
|
-
}
|
|
892
|
+
};
|
|
974
893
|
|
|
975
894
|
// src/actions/lint.ts
|
|
976
|
-
import
|
|
977
|
-
var lintPackage =
|
|
978
|
-
console.log(
|
|
895
|
+
import chalk15 from "chalk";
|
|
896
|
+
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
897
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
979
898
|
const start = Date.now();
|
|
980
899
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
981
|
-
[
|
|
982
|
-
"
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
fix2 ? "package-fix" : "package-lint"
|
|
988
|
-
]
|
|
989
|
-
]
|
|
900
|
+
["yarn", [
|
|
901
|
+
"workspace",
|
|
902
|
+
pkg,
|
|
903
|
+
"run",
|
|
904
|
+
fix2 ? "package-fix" : "package-lint"
|
|
905
|
+
]]
|
|
990
906
|
]);
|
|
991
|
-
console.log(
|
|
907
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
992
908
|
return result;
|
|
993
|
-
}
|
|
994
|
-
var lint =
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
909
|
+
};
|
|
910
|
+
var lint = ({
|
|
911
|
+
pkg,
|
|
912
|
+
verbose,
|
|
913
|
+
incremental,
|
|
914
|
+
fix: fix2
|
|
915
|
+
} = {}) => {
|
|
916
|
+
return pkg ? lintPackage({ pkg, fix: fix2 }) : lintAllPackages({
|
|
999
917
|
verbose,
|
|
1000
918
|
incremental,
|
|
1001
919
|
fix: fix2
|
|
1002
920
|
});
|
|
1003
|
-
}
|
|
1004
|
-
var lintAllPackages =
|
|
1005
|
-
console.log(
|
|
921
|
+
};
|
|
922
|
+
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
923
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1006
924
|
const start = Date.now();
|
|
925
|
+
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1007
926
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1008
|
-
[
|
|
1009
|
-
"yarn",
|
|
1010
|
-
[
|
|
1011
|
-
"eslint"
|
|
1012
|
-
]
|
|
1013
|
-
]
|
|
927
|
+
["yarn", ["eslint", ...fixOptions]]
|
|
1014
928
|
]);
|
|
1015
|
-
console.log(
|
|
929
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1016
930
|
return result;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
// src/actions/fix.ts
|
|
1020
|
-
var fix =
|
|
1021
|
-
return lint({
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
var
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
[
|
|
1038
|
-
"yarn",
|
|
1039
|
-
[
|
|
1040
|
-
"workspace",
|
|
1041
|
-
pkg,
|
|
1042
|
-
"run",
|
|
1043
|
-
"package-gen-docs"
|
|
1044
|
-
]
|
|
1045
|
-
]
|
|
1046
|
-
];
|
|
1047
|
-
return runSteps(`GenDocs [${pkg}]`, [
|
|
1048
|
-
...steps
|
|
1049
|
-
]);
|
|
1050
|
-
}, "genDocsPackage");
|
|
1051
|
-
var genDocsAll = /* @__PURE__ */ __name(({ incremental }) => {
|
|
1052
|
-
const incrementalOptions = incremental ? [
|
|
1053
|
-
"--since",
|
|
1054
|
-
"-pA"
|
|
1055
|
-
] : [
|
|
1056
|
-
"-pA"
|
|
1057
|
-
];
|
|
1058
|
-
const steps = [
|
|
1059
|
-
[
|
|
1060
|
-
"yarn",
|
|
1061
|
-
[
|
|
1062
|
-
"workspaces",
|
|
1063
|
-
"foreach",
|
|
1064
|
-
...incrementalOptions,
|
|
1065
|
-
"run",
|
|
1066
|
-
"package-gen-docs"
|
|
1067
|
-
]
|
|
1068
|
-
]
|
|
1069
|
-
];
|
|
1070
|
-
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [
|
|
1071
|
-
...steps
|
|
1072
|
-
]);
|
|
1073
|
-
}, "genDocsAll");
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
// src/actions/fix.ts
|
|
934
|
+
var fix = (params) => {
|
|
935
|
+
return lint({ ...params, fix: true });
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
// src/actions/gen-docs.ts
|
|
939
|
+
var genDocs = ({ pkg, incremental }) => {
|
|
940
|
+
return pkg ? genDocsPackage({ pkg }) : genDocsAll({ incremental });
|
|
941
|
+
};
|
|
942
|
+
var genDocsPackage = ({ pkg }) => {
|
|
943
|
+
const steps = [["yarn", ["workspace", pkg, "run", "package-gen-docs"]]];
|
|
944
|
+
return runSteps(`GenDocs [${pkg}]`, [...steps]);
|
|
945
|
+
};
|
|
946
|
+
var genDocsAll = ({ incremental }) => {
|
|
947
|
+
const incrementalOptions = incremental ? ["--since", "-pA"] : ["-pA"];
|
|
948
|
+
const steps = [["yarn", ["workspaces", "foreach", ...incrementalOptions, "run", "package-gen-docs"]]];
|
|
949
|
+
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [...steps]);
|
|
950
|
+
};
|
|
1074
951
|
|
|
1075
952
|
// src/actions/gitignore-gen.ts
|
|
1076
953
|
var filename = ".gitignore";
|
|
1077
|
-
var gitignoreGen =
|
|
954
|
+
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1078
955
|
|
|
1079
956
|
// src/actions/gitlint.ts
|
|
1080
|
-
import
|
|
957
|
+
import chalk16 from "chalk";
|
|
1081
958
|
import ParseGitConfig from "parse-git-config";
|
|
1082
|
-
var gitlint =
|
|
959
|
+
var gitlint = () => {
|
|
1083
960
|
console.log(`
|
|
1084
961
|
Gitlint Start [${process.cwd()}]
|
|
1085
962
|
`);
|
|
@@ -1087,10 +964,10 @@ Gitlint Start [${process.cwd()}]
|
|
|
1087
964
|
let warnings = 0;
|
|
1088
965
|
const errors = 0;
|
|
1089
966
|
const gitConfig = ParseGitConfig.sync();
|
|
1090
|
-
const warn =
|
|
1091
|
-
console.warn(
|
|
967
|
+
const warn = (message) => {
|
|
968
|
+
console.warn(chalk16.yellow(`Warning: ${message}`));
|
|
1092
969
|
warnings++;
|
|
1093
|
-
}
|
|
970
|
+
};
|
|
1094
971
|
if (gitConfig.core.ignorecase) {
|
|
1095
972
|
warn("Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]");
|
|
1096
973
|
} else {
|
|
@@ -1108,67 +985,52 @@ Gitlint Start [${process.cwd()}]
|
|
|
1108
985
|
}
|
|
1109
986
|
const resultMessages = [];
|
|
1110
987
|
if (valid > 0) {
|
|
1111
|
-
resultMessages.push(
|
|
988
|
+
resultMessages.push(chalk16.green(`Passed: ${valid}`));
|
|
1112
989
|
}
|
|
1113
990
|
if (warnings > 0) {
|
|
1114
|
-
resultMessages.push(
|
|
991
|
+
resultMessages.push(chalk16.yellow(`Warnings: ${warnings}`));
|
|
1115
992
|
}
|
|
1116
993
|
if (errors > 0) {
|
|
1117
|
-
resultMessages.push(
|
|
994
|
+
resultMessages.push(chalk16.red(` Errors: ${errors}`));
|
|
1118
995
|
}
|
|
1119
996
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1120
997
|
`);
|
|
1121
998
|
return warnings + errors === 0 ? 1 : 0;
|
|
1122
|
-
}
|
|
999
|
+
};
|
|
1123
1000
|
|
|
1124
1001
|
// src/actions/gitlint-fix.ts
|
|
1125
1002
|
import { execSync as execSync2 } from "node:child_process";
|
|
1126
|
-
import
|
|
1003
|
+
import chalk17 from "chalk";
|
|
1127
1004
|
import ParseGitConfig2 from "parse-git-config";
|
|
1128
|
-
var gitlintFix =
|
|
1005
|
+
var gitlintFix = () => {
|
|
1129
1006
|
console.log(`
|
|
1130
1007
|
Gitlint Fix Start [${process.cwd()}]
|
|
1131
1008
|
`);
|
|
1132
1009
|
const gitConfig = ParseGitConfig2.sync();
|
|
1133
1010
|
if (gitConfig.core.ignorecase) {
|
|
1134
|
-
execSync2("git config core.ignorecase false", {
|
|
1135
|
-
|
|
1136
|
-
});
|
|
1137
|
-
console.warn(chalk16.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1011
|
+
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1012
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1138
1013
|
}
|
|
1139
1014
|
if (gitConfig.core.autocrlf !== false) {
|
|
1140
|
-
execSync2("git config core.autocrlf false", {
|
|
1141
|
-
|
|
1142
|
-
});
|
|
1143
|
-
console.warn(chalk16.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1015
|
+
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1016
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1144
1017
|
}
|
|
1145
1018
|
if (gitConfig.core.eol !== "lf") {
|
|
1146
|
-
execSync2("git config core.eol lf", {
|
|
1147
|
-
|
|
1148
|
-
});
|
|
1149
|
-
console.warn(chalk16.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1019
|
+
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1020
|
+
console.warn(chalk17.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1150
1021
|
}
|
|
1151
1022
|
return 1;
|
|
1152
|
-
}
|
|
1023
|
+
};
|
|
1153
1024
|
|
|
1154
1025
|
// src/actions/knip.ts
|
|
1155
|
-
var knip =
|
|
1156
|
-
return runSteps("Knip", [
|
|
1157
|
-
|
|
1158
|
-
"yarn",
|
|
1159
|
-
[
|
|
1160
|
-
"knip",
|
|
1161
|
-
"--dependencies",
|
|
1162
|
-
"--no-exit-code"
|
|
1163
|
-
]
|
|
1164
|
-
]
|
|
1165
|
-
]);
|
|
1166
|
-
}, "knip");
|
|
1026
|
+
var knip = () => {
|
|
1027
|
+
return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
|
|
1028
|
+
};
|
|
1167
1029
|
|
|
1168
1030
|
// src/actions/license.ts
|
|
1169
|
-
import
|
|
1031
|
+
import chalk18 from "chalk";
|
|
1170
1032
|
import { init } from "license-checker";
|
|
1171
|
-
var license =
|
|
1033
|
+
var license = async (pkg) => {
|
|
1172
1034
|
const workspaces = yarnWorkspaces();
|
|
1173
1035
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1174
1036
|
return pkg === void 0 || name === pkg;
|
|
@@ -1191,112 +1053,98 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1191
1053
|
"LGPL-3.0-or-later",
|
|
1192
1054
|
"Python-2.0"
|
|
1193
1055
|
]);
|
|
1194
|
-
console.log(
|
|
1195
|
-
return (await Promise.all(
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
production: true,
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
if (
|
|
1220
|
-
|
|
1056
|
+
console.log(chalk18.green("License Checker"));
|
|
1057
|
+
return (await Promise.all(
|
|
1058
|
+
workspaceList.map(({ location, name }) => {
|
|
1059
|
+
return new Promise((resolve) => {
|
|
1060
|
+
init({ production: true, start: location }, (error, packages) => {
|
|
1061
|
+
if (error) {
|
|
1062
|
+
console.error(chalk18.red(`License Checker [${name}] Error`));
|
|
1063
|
+
console.error(chalk18.gray(error));
|
|
1064
|
+
console.log("\n");
|
|
1065
|
+
resolve(1);
|
|
1066
|
+
} else {
|
|
1067
|
+
console.log(chalk18.green(`License Checker [${name}]`));
|
|
1068
|
+
let count = 0;
|
|
1069
|
+
for (const [name2, info] of Object.entries(packages)) {
|
|
1070
|
+
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
1071
|
+
for (let license2 of licenses) {
|
|
1072
|
+
if (license2) {
|
|
1073
|
+
const processedLicense = license2[0] === "(" && license2.at(-1) === ")" ? license2.slice(1, -2) : license2;
|
|
1074
|
+
const orLicenses = processedLicense.split(" OR ");
|
|
1075
|
+
let orLicenseFound = false;
|
|
1076
|
+
for (const orLicense of orLicenses) {
|
|
1077
|
+
if (exclude.has(orLicense)) {
|
|
1078
|
+
orLicenseFound = true;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
if (!orLicenseFound) {
|
|
1082
|
+
count++;
|
|
1083
|
+
console.warn(chalk18.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1221
1084
|
}
|
|
1222
|
-
}
|
|
1223
|
-
if (!orLicenseFound) {
|
|
1224
|
-
count++;
|
|
1225
|
-
console.warn(chalk17.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1226
1085
|
}
|
|
1227
1086
|
}
|
|
1228
1087
|
}
|
|
1088
|
+
console.log("\n");
|
|
1089
|
+
resolve(count);
|
|
1229
1090
|
}
|
|
1230
|
-
|
|
1231
|
-
resolve(count);
|
|
1232
|
-
}
|
|
1091
|
+
});
|
|
1233
1092
|
});
|
|
1234
|
-
})
|
|
1235
|
-
|
|
1236
|
-
}
|
|
1093
|
+
})
|
|
1094
|
+
)).reduce((prev, value) => prev || value, 0);
|
|
1095
|
+
};
|
|
1237
1096
|
|
|
1238
1097
|
// src/actions/npmignore-gen.ts
|
|
1239
1098
|
var filename2 = ".npmignore";
|
|
1240
|
-
var npmignoreGen =
|
|
1099
|
+
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1241
1100
|
|
|
1242
1101
|
// src/actions/package/clean-outputs.ts
|
|
1243
|
-
import
|
|
1244
|
-
import
|
|
1245
|
-
var packageCleanOutputs =
|
|
1102
|
+
import path4 from "node:path";
|
|
1103
|
+
import chalk19 from "chalk";
|
|
1104
|
+
var packageCleanOutputs = () => {
|
|
1246
1105
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1247
1106
|
const pkgName = process.env.npm_package_name;
|
|
1248
|
-
const folders = [
|
|
1249
|
-
|
|
1250
|
-
path3.join(pkg, "build"),
|
|
1251
|
-
path3.join(pkg, "docs")
|
|
1252
|
-
];
|
|
1253
|
-
console.log(chalk18.green(`Cleaning Outputs [${pkgName}]`));
|
|
1107
|
+
const folders = [path4.join(pkg, "dist"), path4.join(pkg, "build"), path4.join(pkg, "docs")];
|
|
1108
|
+
console.log(chalk19.green(`Cleaning Outputs [${pkgName}]`));
|
|
1254
1109
|
for (let folder of folders) {
|
|
1255
1110
|
deleteGlob(folder);
|
|
1256
1111
|
}
|
|
1257
1112
|
return 0;
|
|
1258
|
-
}
|
|
1113
|
+
};
|
|
1259
1114
|
|
|
1260
1115
|
// src/actions/package/clean-typescript.ts
|
|
1261
|
-
import
|
|
1262
|
-
import
|
|
1263
|
-
var packageCleanTypescript =
|
|
1116
|
+
import path5 from "node:path";
|
|
1117
|
+
import chalk20 from "chalk";
|
|
1118
|
+
var packageCleanTypescript = () => {
|
|
1264
1119
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1265
1120
|
const pkgName = process.env.npm_package_name;
|
|
1266
|
-
console.log(
|
|
1267
|
-
const files = [
|
|
1268
|
-
path4.join(pkg, "*.tsbuildinfo"),
|
|
1269
|
-
path4.join(pkg, ".tsconfig.*"),
|
|
1270
|
-
path4.join(pkg, ".eslintcache")
|
|
1271
|
-
];
|
|
1121
|
+
console.log(chalk20.green(`Cleaning Typescript [${pkgName}]`));
|
|
1122
|
+
const files = [path5.join(pkg, "*.tsbuildinfo"), path5.join(pkg, ".tsconfig.*"), path5.join(pkg, ".eslintcache")];
|
|
1272
1123
|
for (let file of files) {
|
|
1273
1124
|
deleteGlob(file);
|
|
1274
1125
|
}
|
|
1275
1126
|
return 0;
|
|
1276
|
-
}
|
|
1127
|
+
};
|
|
1277
1128
|
|
|
1278
1129
|
// src/actions/package/clean.ts
|
|
1279
|
-
var packageClean =
|
|
1280
|
-
return (await Promise.all([
|
|
1281
|
-
|
|
1282
|
-
packageCleanTypescript()
|
|
1283
|
-
])).reduce((prev, value) => prev + value, 0);
|
|
1284
|
-
}, "packageClean");
|
|
1130
|
+
var packageClean = async () => {
|
|
1131
|
+
return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0);
|
|
1132
|
+
};
|
|
1285
1133
|
|
|
1286
1134
|
// src/actions/package/compile/compile.ts
|
|
1287
|
-
import
|
|
1135
|
+
import chalk24 from "chalk";
|
|
1288
1136
|
|
|
1289
1137
|
// src/actions/package/publint.ts
|
|
1290
|
-
import { promises as
|
|
1291
|
-
import
|
|
1138
|
+
import { promises as fs3 } from "node:fs";
|
|
1139
|
+
import chalk21 from "chalk";
|
|
1292
1140
|
import sortPackageJson from "sort-package-json";
|
|
1293
|
-
var packagePublint =
|
|
1141
|
+
var packagePublint = async (params) => {
|
|
1294
1142
|
const pkgDir = process.env.INIT_CWD;
|
|
1295
|
-
const sortedPkg = sortPackageJson(await
|
|
1296
|
-
await
|
|
1297
|
-
const pkg = JSON.parse(await
|
|
1298
|
-
console.log(
|
|
1299
|
-
console.log(
|
|
1143
|
+
const sortedPkg = sortPackageJson(await fs3.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1144
|
+
await fs3.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1145
|
+
const pkg = JSON.parse(await fs3.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1146
|
+
console.log(chalk21.green(`Publint: ${pkg.name}`));
|
|
1147
|
+
console.log(chalk21.gray(pkgDir));
|
|
1300
1148
|
const { publint: publint2 } = await import("publint");
|
|
1301
1149
|
const { messages } = await publint2({
|
|
1302
1150
|
level: "suggestion",
|
|
@@ -1304,52 +1152,47 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
|
1304
1152
|
strict: true
|
|
1305
1153
|
});
|
|
1306
1154
|
const { formatMessage } = await import("publint/utils");
|
|
1307
|
-
const validMessage =
|
|
1155
|
+
const validMessage = (_message) => {
|
|
1308
1156
|
return true;
|
|
1309
|
-
}
|
|
1157
|
+
};
|
|
1310
1158
|
const validMessages = messages.filter(validMessage);
|
|
1311
1159
|
for (const message of validMessages) {
|
|
1312
1160
|
switch (message.type) {
|
|
1313
1161
|
case "error": {
|
|
1314
|
-
console.error(
|
|
1162
|
+
console.error(chalk21.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1315
1163
|
break;
|
|
1316
1164
|
}
|
|
1317
1165
|
case "warning": {
|
|
1318
|
-
console.warn(
|
|
1166
|
+
console.warn(chalk21.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1319
1167
|
break;
|
|
1320
1168
|
}
|
|
1321
1169
|
default: {
|
|
1322
|
-
console.log(
|
|
1170
|
+
console.log(chalk21.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1323
1171
|
break;
|
|
1324
1172
|
}
|
|
1325
1173
|
}
|
|
1326
1174
|
}
|
|
1327
1175
|
if (params?.verbose) {
|
|
1328
|
-
console.log(
|
|
1176
|
+
console.log(chalk21.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1329
1177
|
}
|
|
1330
1178
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1331
|
-
}
|
|
1179
|
+
};
|
|
1332
1180
|
|
|
1333
1181
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1334
1182
|
import { build as build2, defineConfig } from "tsup";
|
|
1335
1183
|
|
|
1336
1184
|
// src/actions/package/compile/inputs.ts
|
|
1337
1185
|
import { glob as glob2 } from "glob";
|
|
1338
|
-
var getAllInputs =
|
|
1339
|
-
return glob2.sync(`${folder}/**/*.*`, {
|
|
1340
|
-
|
|
1341
|
-
});
|
|
1342
|
-
}, "getAllInputs");
|
|
1186
|
+
var getAllInputs = (folder) => {
|
|
1187
|
+
return glob2.sync(`${folder}/**/*.*`, { posix: true });
|
|
1188
|
+
};
|
|
1343
1189
|
|
|
1344
1190
|
// src/actions/package/compile/buildEntries.ts
|
|
1345
|
-
var buildEntries =
|
|
1191
|
+
var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true, verbose = false) => {
|
|
1346
1192
|
let entries = [];
|
|
1347
1193
|
switch (entryMode) {
|
|
1348
1194
|
case "platform": {
|
|
1349
|
-
entries = [
|
|
1350
|
-
`${folder}/index-node.ts`,
|
|
1351
|
-
`${folder}/index-browser.ts`
|
|
1352
|
-
];
|
|
1195
|
+
entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`];
|
|
1353
1196
|
break;
|
|
1354
1197
|
}
|
|
1355
1198
|
case "all": {
|
|
@@ -1357,46 +1200,53 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", exclude
|
|
|
1357
1200
|
break;
|
|
1358
1201
|
}
|
|
1359
1202
|
default: {
|
|
1360
|
-
entries = [
|
|
1361
|
-
`${folder}/index.ts`
|
|
1362
|
-
];
|
|
1203
|
+
entries = [`${folder}/index.ts`];
|
|
1363
1204
|
break;
|
|
1364
1205
|
}
|
|
1365
1206
|
}
|
|
1366
1207
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
1367
1208
|
return entries;
|
|
1368
|
-
}
|
|
1209
|
+
};
|
|
1369
1210
|
|
|
1370
1211
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1371
1212
|
import { cwd } from "node:process";
|
|
1372
|
-
import
|
|
1213
|
+
import chalk22 from "chalk";
|
|
1373
1214
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1374
|
-
import {
|
|
1215
|
+
import {
|
|
1216
|
+
DiagnosticCategory,
|
|
1217
|
+
formatDiagnosticsWithColorAndContext,
|
|
1218
|
+
getPreEmitDiagnostics,
|
|
1219
|
+
sys as sys2
|
|
1220
|
+
} from "typescript";
|
|
1375
1221
|
|
|
1376
1222
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
1377
1223
|
import { createRequire } from "node:module";
|
|
1378
1224
|
import deepmerge2 from "deepmerge";
|
|
1379
|
-
import {
|
|
1380
|
-
|
|
1225
|
+
import {
|
|
1226
|
+
findConfigFile,
|
|
1227
|
+
readConfigFile,
|
|
1228
|
+
sys
|
|
1229
|
+
} from "typescript";
|
|
1230
|
+
var getNested = (config2) => {
|
|
1381
1231
|
if (config2.extends) {
|
|
1382
1232
|
const require2 = createRequire(import.meta.url);
|
|
1383
1233
|
const opts = require2(config2.extends);
|
|
1384
1234
|
return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
|
|
1385
1235
|
}
|
|
1386
1236
|
return config2.compilerOptions;
|
|
1387
|
-
}
|
|
1388
|
-
var getCompilerOptionsJSONFollowExtends =
|
|
1237
|
+
};
|
|
1238
|
+
var getCompilerOptionsJSONFollowExtends = (filename3) => {
|
|
1389
1239
|
const config2 = readConfigFile(filename3, sys.readFile).config;
|
|
1390
1240
|
return getNested(config2);
|
|
1391
|
-
}
|
|
1392
|
-
var getCompilerOptions =
|
|
1241
|
+
};
|
|
1242
|
+
var getCompilerOptions = (options = {}, tsconfig = "tsconfig.json") => {
|
|
1393
1243
|
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
1394
1244
|
const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
|
|
1395
1245
|
return deepmerge2(configFileCompilerOptions, options);
|
|
1396
|
-
}
|
|
1246
|
+
};
|
|
1397
1247
|
|
|
1398
1248
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1399
|
-
var packageCompileTscTypes =
|
|
1249
|
+
var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1400
1250
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
1401
1251
|
const verbose = config2?.verbose ?? false;
|
|
1402
1252
|
const compilerOptions = {
|
|
@@ -1412,54 +1262,40 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
1412
1262
|
emitDeclarationOnly: true,
|
|
1413
1263
|
noEmit: false
|
|
1414
1264
|
};
|
|
1415
|
-
const validTsExt = [
|
|
1416
|
-
|
|
1417
|
-
".tsx",
|
|
1418
|
-
".d.ts",
|
|
1419
|
-
".cts",
|
|
1420
|
-
".d.cts",
|
|
1421
|
-
".mts",
|
|
1422
|
-
".d.mts"
|
|
1423
|
-
];
|
|
1424
|
-
const excludes = [
|
|
1425
|
-
".stories.",
|
|
1426
|
-
".spec."
|
|
1427
|
-
];
|
|
1265
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1266
|
+
const excludes = [".stories.", ".spec."];
|
|
1428
1267
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1429
|
-
console.log(
|
|
1268
|
+
console.log(chalk22.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1430
1269
|
if (files.length > 0) {
|
|
1431
1270
|
const program = createProgramFromConfig({
|
|
1432
1271
|
basePath: pkg ?? cwd(),
|
|
1433
1272
|
compilerOptions,
|
|
1434
|
-
exclude: [
|
|
1435
|
-
"dist",
|
|
1436
|
-
"docs",
|
|
1437
|
-
"**/*.spec.*",
|
|
1438
|
-
"**/*.stories.*",
|
|
1439
|
-
"src/**/spec/**/*"
|
|
1440
|
-
],
|
|
1273
|
+
exclude: ["dist", "docs", "**/*.spec.*", "**/*.stories.*", "src/**/spec/**/*"],
|
|
1441
1274
|
files
|
|
1442
1275
|
});
|
|
1443
1276
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
1444
1277
|
if (diagnostics.length > 0) {
|
|
1445
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1278
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1279
|
+
diagnostics,
|
|
1280
|
+
{
|
|
1281
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1282
|
+
getCurrentDirectory: () => folder,
|
|
1283
|
+
getNewLine: () => sys2.newLine
|
|
1284
|
+
}
|
|
1285
|
+
);
|
|
1450
1286
|
console.error(formattedDiagnostics);
|
|
1451
1287
|
}
|
|
1452
1288
|
program.emit();
|
|
1453
1289
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1454
1290
|
}
|
|
1455
1291
|
return 0;
|
|
1456
|
-
}
|
|
1292
|
+
};
|
|
1457
1293
|
|
|
1458
1294
|
// src/actions/package/compile/compileTypes.ts
|
|
1459
|
-
var packageCompileTypes =
|
|
1295
|
+
var packageCompileTypes = async (inConfig = {}) => {
|
|
1460
1296
|
const config2 = await loadConfig(inConfig);
|
|
1461
1297
|
return packageCompileTscTypes(void 0, config2);
|
|
1462
|
-
}
|
|
1298
|
+
};
|
|
1463
1299
|
|
|
1464
1300
|
// src/actions/package/compile/deepMerge.ts
|
|
1465
1301
|
function deepMerge(target, source) {
|
|
@@ -1476,7 +1312,6 @@ function deepMerge(target, source) {
|
|
|
1476
1312
|
}
|
|
1477
1313
|
return target;
|
|
1478
1314
|
}
|
|
1479
|
-
__name(deepMerge, "deepMerge");
|
|
1480
1315
|
function deepMergeObjects(objects) {
|
|
1481
1316
|
const result = {};
|
|
1482
1317
|
for (const obj of objects) {
|
|
@@ -1484,14 +1319,18 @@ function deepMergeObjects(objects) {
|
|
|
1484
1319
|
}
|
|
1485
1320
|
return result;
|
|
1486
1321
|
}
|
|
1487
|
-
__name(deepMergeObjects, "deepMergeObjects");
|
|
1488
1322
|
|
|
1489
1323
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1490
1324
|
import { cwd as cwd2 } from "node:process";
|
|
1491
|
-
import
|
|
1325
|
+
import chalk23 from "chalk";
|
|
1492
1326
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1493
|
-
import {
|
|
1494
|
-
|
|
1327
|
+
import {
|
|
1328
|
+
DiagnosticCategory as DiagnosticCategory2,
|
|
1329
|
+
formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2,
|
|
1330
|
+
getPreEmitDiagnostics as getPreEmitDiagnostics2,
|
|
1331
|
+
sys as sys3
|
|
1332
|
+
} from "typescript";
|
|
1333
|
+
var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1495
1334
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1496
1335
|
const verbose = config2?.verbose ?? false;
|
|
1497
1336
|
const compilerOptions = {
|
|
@@ -1506,51 +1345,37 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
1506
1345
|
emitDeclarationOnly: false,
|
|
1507
1346
|
noEmit: true
|
|
1508
1347
|
};
|
|
1509
|
-
const validTsExt = [
|
|
1510
|
-
|
|
1511
|
-
".tsx",
|
|
1512
|
-
".d.ts",
|
|
1513
|
-
".cts",
|
|
1514
|
-
".d.cts",
|
|
1515
|
-
".mts",
|
|
1516
|
-
".d.mts"
|
|
1517
|
-
];
|
|
1518
|
-
const includes = [
|
|
1519
|
-
".stories.",
|
|
1520
|
-
".spec.",
|
|
1521
|
-
".d.ts",
|
|
1522
|
-
".d.cts",
|
|
1523
|
-
".d.mts"
|
|
1524
|
-
];
|
|
1348
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1349
|
+
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1525
1350
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1526
|
-
console.log(
|
|
1351
|
+
console.log(chalk23.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1527
1352
|
if (files.length > 0) {
|
|
1528
1353
|
const program = createProgramFromConfig2({
|
|
1529
1354
|
basePath: pkg ?? cwd2(),
|
|
1530
1355
|
compilerOptions,
|
|
1531
|
-
exclude: [
|
|
1532
|
-
"dist",
|
|
1533
|
-
"docs"
|
|
1534
|
-
],
|
|
1356
|
+
exclude: ["dist", "docs"],
|
|
1535
1357
|
files
|
|
1536
1358
|
});
|
|
1537
1359
|
const diagnostics = getPreEmitDiagnostics2(program);
|
|
1538
1360
|
if (diagnostics.length > 0) {
|
|
1539
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1361
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1362
|
+
diagnostics,
|
|
1363
|
+
{
|
|
1364
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1365
|
+
getCurrentDirectory: () => folder,
|
|
1366
|
+
getNewLine: () => sys3.newLine
|
|
1367
|
+
}
|
|
1368
|
+
);
|
|
1544
1369
|
console.error(formattedDiagnostics);
|
|
1545
1370
|
}
|
|
1546
1371
|
program.emit();
|
|
1547
1372
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
|
|
1548
1373
|
}
|
|
1549
1374
|
return 0;
|
|
1550
|
-
}
|
|
1375
|
+
};
|
|
1551
1376
|
|
|
1552
1377
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1553
|
-
var compileFolder =
|
|
1378
|
+
var compileFolder = async (folder, entryMode = "single", options, verbose) => {
|
|
1554
1379
|
const outDir = options?.outDir ?? "dist";
|
|
1555
1380
|
if (verbose) {
|
|
1556
1381
|
console.log(`compileFolder [${folder}]`);
|
|
@@ -1562,9 +1387,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1562
1387
|
clean: true,
|
|
1563
1388
|
dts: false,
|
|
1564
1389
|
entry,
|
|
1565
|
-
format: [
|
|
1566
|
-
"esm"
|
|
1567
|
-
],
|
|
1390
|
+
format: ["esm"],
|
|
1568
1391
|
outDir,
|
|
1569
1392
|
silent: true,
|
|
1570
1393
|
sourcemap: true,
|
|
@@ -1572,16 +1395,12 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1572
1395
|
tsconfig: "tsconfig.json",
|
|
1573
1396
|
...options
|
|
1574
1397
|
});
|
|
1575
|
-
const optionsList = (await Promise.all(
|
|
1576
|
-
optionsResult
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
return Array.isArray(result) ? result : [
|
|
1582
|
-
result
|
|
1583
|
-
];
|
|
1584
|
-
}))).flat();
|
|
1398
|
+
const optionsList = (await Promise.all(
|
|
1399
|
+
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
1400
|
+
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
1401
|
+
return Array.isArray(result) ? result : [result];
|
|
1402
|
+
})
|
|
1403
|
+
)).flat();
|
|
1585
1404
|
if (verbose) {
|
|
1586
1405
|
console.log(`TSUP:build:start [${folder}]`);
|
|
1587
1406
|
}
|
|
@@ -1590,8 +1409,8 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1590
1409
|
console.log(`TSUP:build:stop [${folder}]`);
|
|
1591
1410
|
}
|
|
1592
1411
|
return 0;
|
|
1593
|
-
}
|
|
1594
|
-
var tsupOptions =
|
|
1412
|
+
};
|
|
1413
|
+
var tsupOptions = (options = []) => {
|
|
1595
1414
|
const standardLoaders = {
|
|
1596
1415
|
".gif": "copy",
|
|
1597
1416
|
".html": "copy",
|
|
@@ -1603,39 +1422,24 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
|
|
|
1603
1422
|
};
|
|
1604
1423
|
const standardOptions = {
|
|
1605
1424
|
bundle: true,
|
|
1606
|
-
format: [
|
|
1607
|
-
"esm"
|
|
1608
|
-
],
|
|
1425
|
+
format: ["esm"],
|
|
1609
1426
|
loader: standardLoaders,
|
|
1610
|
-
outExtension:
|
|
1611
|
-
js: ".mjs"
|
|
1612
|
-
} : {
|
|
1613
|
-
js: ".cjs"
|
|
1614
|
-
}, "outExtension"),
|
|
1427
|
+
outExtension: ({ format }) => format === "esm" ? { js: ".mjs" } : { js: ".cjs" },
|
|
1615
1428
|
skipNodeModulesBundle: true,
|
|
1616
1429
|
sourcemap: true,
|
|
1617
1430
|
target: "esnext"
|
|
1618
1431
|
};
|
|
1619
|
-
return deepMergeObjects([
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
]);
|
|
1623
|
-
}, "tsupOptions");
|
|
1624
|
-
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1432
|
+
return deepMergeObjects([standardOptions, ...options]);
|
|
1433
|
+
};
|
|
1434
|
+
var packageCompileTsup = async (config2) => {
|
|
1625
1435
|
const compile2 = config2?.compile;
|
|
1626
1436
|
const verbose = config2?.verbose ?? false;
|
|
1627
1437
|
if (verbose) {
|
|
1628
1438
|
console.log(`Compiling with TSUP [Depth: ${compile2?.depth}]`);
|
|
1629
1439
|
}
|
|
1630
|
-
const compileForNode = compile2?.node ?? {
|
|
1631
|
-
|
|
1632
|
-
};
|
|
1633
|
-
const compileForBrowser = compile2?.browser ?? {
|
|
1634
|
-
src: {}
|
|
1635
|
-
};
|
|
1636
|
-
const compileForNeutral = compile2?.neutral ?? {
|
|
1637
|
-
src: {}
|
|
1638
|
-
};
|
|
1440
|
+
const compileForNode = compile2?.node ?? { src: {} };
|
|
1441
|
+
const compileForBrowser = compile2?.browser ?? { src: {} };
|
|
1442
|
+
const compileForNeutral = compile2?.neutral ?? { src: {} };
|
|
1639
1443
|
if (verbose) {
|
|
1640
1444
|
console.log("Calling packageCompileTscTypes");
|
|
1641
1445
|
}
|
|
@@ -1644,46 +1448,58 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1644
1448
|
if (errors > 0) {
|
|
1645
1449
|
return errors;
|
|
1646
1450
|
}
|
|
1647
|
-
return (await Promise.all(
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
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
|
-
|
|
1451
|
+
return (await Promise.all(
|
|
1452
|
+
Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
1453
|
+
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1454
|
+
return folder ? await compileFolder(
|
|
1455
|
+
folder,
|
|
1456
|
+
compile2?.entryMode,
|
|
1457
|
+
tsupOptions([
|
|
1458
|
+
inEsBuildOptions,
|
|
1459
|
+
compile2?.tsup?.options ?? {},
|
|
1460
|
+
typeof options === "object" ? options : {},
|
|
1461
|
+
{ platform: "node", outDir: "dist/node" }
|
|
1462
|
+
]),
|
|
1463
|
+
verbose
|
|
1464
|
+
) : 0;
|
|
1465
|
+
})
|
|
1466
|
+
)).reduce((prev, value) => prev + value, 0) || (await Promise.all(
|
|
1467
|
+
Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
1468
|
+
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1469
|
+
return folder ? await compileFolder(
|
|
1470
|
+
folder,
|
|
1471
|
+
compile2?.entryMode,
|
|
1472
|
+
tsupOptions([
|
|
1473
|
+
inEsBuildOptions,
|
|
1474
|
+
compile2?.tsup?.options ?? {},
|
|
1475
|
+
typeof options === "object" ? options : {},
|
|
1476
|
+
{ platform: "browser", outDir: "dist/browser" }
|
|
1477
|
+
]),
|
|
1478
|
+
verbose
|
|
1479
|
+
) : 0;
|
|
1480
|
+
})
|
|
1481
|
+
)).reduce((prev, value) => prev + value, 0) || (await Promise.all(
|
|
1482
|
+
Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
1483
|
+
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1484
|
+
return folder ? await compileFolder(
|
|
1485
|
+
folder,
|
|
1486
|
+
compile2?.entryMode,
|
|
1487
|
+
tsupOptions([
|
|
1488
|
+
inEsBuildOptions,
|
|
1489
|
+
compile2?.tsup?.options ?? {},
|
|
1490
|
+
typeof options === "object" ? options : {},
|
|
1491
|
+
{ platform: "neutral", outDir: "dist/neutral" }
|
|
1492
|
+
]),
|
|
1493
|
+
verbose
|
|
1494
|
+
) : 0;
|
|
1495
|
+
})
|
|
1496
|
+
)).reduce((prev, value) => prev + value, 0) || 0;
|
|
1497
|
+
};
|
|
1682
1498
|
|
|
1683
1499
|
// src/actions/package/compile/compile.ts
|
|
1684
|
-
var packageCompile =
|
|
1500
|
+
var packageCompile = async (inConfig = {}) => {
|
|
1685
1501
|
const pkg = process.env.INIT_CWD;
|
|
1686
|
-
console.log(
|
|
1502
|
+
console.log(chalk24.green(`Compiling ${pkg}`));
|
|
1687
1503
|
const config2 = await loadConfig(inConfig);
|
|
1688
1504
|
const publint2 = config2.publint;
|
|
1689
1505
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1691,30 +1507,24 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1691
1507
|
return tsupResults;
|
|
1692
1508
|
}
|
|
1693
1509
|
return publint2 ? await packagePublint(config2) : 0;
|
|
1694
|
-
}
|
|
1510
|
+
};
|
|
1695
1511
|
|
|
1696
1512
|
// src/actions/package/copy-assets.ts
|
|
1697
|
-
import
|
|
1698
|
-
import
|
|
1513
|
+
import path6 from "node:path/posix";
|
|
1514
|
+
import chalk25 from "chalk";
|
|
1699
1515
|
import cpy2 from "cpy";
|
|
1700
|
-
var copyTargetAssets2 =
|
|
1516
|
+
var copyTargetAssets2 = async (target, name, location) => {
|
|
1701
1517
|
try {
|
|
1702
|
-
const values = await cpy2(
|
|
1703
|
-
"**/*.jpg",
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
"**/*.gif",
|
|
1711
|
-
"**/*.css"
|
|
1712
|
-
], `../dist/${target}`, {
|
|
1713
|
-
cwd: path5.join(location, "src"),
|
|
1714
|
-
flat: false
|
|
1715
|
-
});
|
|
1518
|
+
const values = await cpy2(
|
|
1519
|
+
["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
|
|
1520
|
+
`../dist/${target}`,
|
|
1521
|
+
{
|
|
1522
|
+
cwd: path6.join(location, "src"),
|
|
1523
|
+
flat: false
|
|
1524
|
+
}
|
|
1525
|
+
);
|
|
1716
1526
|
if (values.length > 0) {
|
|
1717
|
-
console.log(
|
|
1527
|
+
console.log(chalk25.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1718
1528
|
}
|
|
1719
1529
|
for (const value of values) {
|
|
1720
1530
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1725,8 +1535,8 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1725
1535
|
console.log(`Copy Assets Failed: ${name}: ${error.message}`);
|
|
1726
1536
|
return 1;
|
|
1727
1537
|
}
|
|
1728
|
-
}
|
|
1729
|
-
var packageCopyAssets =
|
|
1538
|
+
};
|
|
1539
|
+
var packageCopyAssets = async ({ target }) => {
|
|
1730
1540
|
const pkg = process.env.INIT_CWD ?? "./";
|
|
1731
1541
|
const pkgName = process.env.npm_package_name ?? "Unknown";
|
|
1732
1542
|
switch (target) {
|
|
@@ -1740,11 +1550,11 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1740
1550
|
return await copyTargetAssets2("esm", pkgName, pkg) || await copyTargetAssets2("cjs", pkgName, pkg);
|
|
1741
1551
|
}
|
|
1742
1552
|
}
|
|
1743
|
-
}
|
|
1553
|
+
};
|
|
1744
1554
|
|
|
1745
1555
|
// src/actions/package/cycle.ts
|
|
1746
1556
|
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1747
|
-
var packageCycle =
|
|
1557
|
+
var packageCycle = async ({ verbose = false }) => {
|
|
1748
1558
|
const pkg = process.env.INIT_CWD;
|
|
1749
1559
|
const pkgName = process.env.npm_package_name;
|
|
1750
1560
|
const cruiseOptions = {
|
|
@@ -1755,26 +1565,20 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1755
1565
|
severity: "error",
|
|
1756
1566
|
comment: "This dependency creates a circular reference",
|
|
1757
1567
|
from: {},
|
|
1758
|
-
to: {
|
|
1759
|
-
circular: true
|
|
1760
|
-
}
|
|
1568
|
+
to: { circular: true }
|
|
1761
1569
|
}
|
|
1762
1570
|
]
|
|
1763
1571
|
},
|
|
1764
1572
|
exclude: "node_modules|packages/.*/packages",
|
|
1765
1573
|
validate: true,
|
|
1766
|
-
doNotFollow: {
|
|
1767
|
-
path: "node_modules|packages/.*/packages"
|
|
1768
|
-
},
|
|
1574
|
+
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
1769
1575
|
tsPreCompilationDeps: false,
|
|
1770
1576
|
combinedDependencies: true,
|
|
1771
1577
|
outputType: verbose ? "text" : "err"
|
|
1772
1578
|
};
|
|
1773
1579
|
const target = `${pkg}/src`;
|
|
1774
1580
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1775
|
-
const result = await cruise2([
|
|
1776
|
-
target
|
|
1777
|
-
], cruiseOptions);
|
|
1581
|
+
const result = await cruise2([target], cruiseOptions);
|
|
1778
1582
|
if (result.output) {
|
|
1779
1583
|
console.log(result.output);
|
|
1780
1584
|
}
|
|
@@ -1784,13 +1588,18 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1784
1588
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
1785
1589
|
}
|
|
1786
1590
|
return result.exitCode;
|
|
1787
|
-
}
|
|
1591
|
+
};
|
|
1788
1592
|
|
|
1789
1593
|
// src/actions/package/gen-docs.ts
|
|
1790
1594
|
import { existsSync as existsSync4 } from "node:fs";
|
|
1791
|
-
import
|
|
1792
|
-
import
|
|
1793
|
-
import {
|
|
1595
|
+
import path7 from "node:path";
|
|
1596
|
+
import chalk26 from "chalk";
|
|
1597
|
+
import {
|
|
1598
|
+
Application,
|
|
1599
|
+
ArgumentsReader,
|
|
1600
|
+
TSConfigReader,
|
|
1601
|
+
TypeDocReader
|
|
1602
|
+
} from "typedoc";
|
|
1794
1603
|
var ExitCodes = {
|
|
1795
1604
|
CompileError: 3,
|
|
1796
1605
|
ExceptionThrown: 6,
|
|
@@ -1800,17 +1609,14 @@ var ExitCodes = {
|
|
|
1800
1609
|
OutputError: 5,
|
|
1801
1610
|
ValidationError: 4
|
|
1802
1611
|
};
|
|
1803
|
-
var packageGenDocs =
|
|
1612
|
+
var packageGenDocs = async () => {
|
|
1804
1613
|
const pkg = process.env.INIT_CWD;
|
|
1805
|
-
if (pkg && !existsSync4(
|
|
1614
|
+
if (pkg && !existsSync4(path7.join(pkg, "typedoc.json"))) {
|
|
1806
1615
|
return;
|
|
1807
1616
|
}
|
|
1808
1617
|
const app = await Application.bootstrap({
|
|
1809
1618
|
entryPointStrategy: "merge",
|
|
1810
|
-
entryPoints: [
|
|
1811
|
-
`${pkg}/src/**/*.ts`,
|
|
1812
|
-
`${pkg}/packages/*/dist/docs.json`
|
|
1813
|
-
],
|
|
1619
|
+
entryPoints: [`${pkg}/src/**/*.ts`, `${pkg}/packages/*/dist/docs.json`],
|
|
1814
1620
|
excludeExternals: true,
|
|
1815
1621
|
json: `${pkg}/dist/docs.json`,
|
|
1816
1622
|
logLevel: "Error",
|
|
@@ -1821,8 +1627,8 @@ var packageGenDocs = /* @__PURE__ */ __name(async () => {
|
|
|
1821
1627
|
app.options.addReader(new TSConfigReader());
|
|
1822
1628
|
app.options.addReader(new ArgumentsReader(300));
|
|
1823
1629
|
return await runTypeDoc(app);
|
|
1824
|
-
}
|
|
1825
|
-
var runTypeDoc =
|
|
1630
|
+
};
|
|
1631
|
+
var runTypeDoc = async (app) => {
|
|
1826
1632
|
const pkgName = process.env.npm_package_name;
|
|
1827
1633
|
if (app.options.getValue("version")) {
|
|
1828
1634
|
console.log(app.toString());
|
|
@@ -1891,40 +1697,37 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1891
1697
|
return ExitCodes.OutputError;
|
|
1892
1698
|
}
|
|
1893
1699
|
}
|
|
1894
|
-
console.log(
|
|
1700
|
+
console.log(chalk26.green(`${pkgName} - Ok`));
|
|
1895
1701
|
return ExitCodes.Ok;
|
|
1896
|
-
}
|
|
1702
|
+
};
|
|
1897
1703
|
|
|
1898
1704
|
// src/actions/package/lint.ts
|
|
1899
1705
|
import { readdirSync } from "node:fs";
|
|
1900
|
-
import
|
|
1706
|
+
import path8 from "node:path";
|
|
1901
1707
|
import { cwd as cwd3 } from "node:process";
|
|
1902
1708
|
import { pathToFileURL } from "node:url";
|
|
1903
|
-
import
|
|
1709
|
+
import chalk27 from "chalk";
|
|
1904
1710
|
import { ESLint } from "eslint";
|
|
1905
1711
|
import { findUp } from "find-up";
|
|
1906
1712
|
import picomatch from "picomatch";
|
|
1907
|
-
var dumpMessages =
|
|
1908
|
-
const colors = [
|
|
1909
|
-
|
|
1910
|
-
"yellow",
|
|
1911
|
-
"red"
|
|
1912
|
-
];
|
|
1913
|
-
const severity = [
|
|
1914
|
-
"none",
|
|
1915
|
-
"warning",
|
|
1916
|
-
"error"
|
|
1917
|
-
];
|
|
1713
|
+
var dumpMessages = (lintResults) => {
|
|
1714
|
+
const colors = ["white", "yellow", "red"];
|
|
1715
|
+
const severity = ["none", "warning", "error"];
|
|
1918
1716
|
for (const lintResult of lintResults) {
|
|
1919
1717
|
if (lintResult.messages.length > 0) {
|
|
1920
|
-
console.log(
|
|
1718
|
+
console.log(chalk27.gray(`
|
|
1921
1719
|
${lintResult.filePath}`));
|
|
1922
1720
|
for (const message of lintResult.messages) {
|
|
1923
|
-
console.log(
|
|
1721
|
+
console.log(
|
|
1722
|
+
chalk27.gray(` ${message.line}:${message.column}`),
|
|
1723
|
+
chalk27[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1724
|
+
chalk27.white(` ${message.message}`),
|
|
1725
|
+
chalk27.gray(` ${message.ruleId}`)
|
|
1726
|
+
);
|
|
1924
1727
|
}
|
|
1925
1728
|
}
|
|
1926
1729
|
}
|
|
1927
|
-
}
|
|
1730
|
+
};
|
|
1928
1731
|
async function getRootESLintConfig() {
|
|
1929
1732
|
const configPath = await findUp("eslint.config.mjs");
|
|
1930
1733
|
if (!configPath) {
|
|
@@ -1932,50 +1735,33 @@ async function getRootESLintConfig() {
|
|
|
1932
1735
|
}
|
|
1933
1736
|
return pathToFileURL(configPath);
|
|
1934
1737
|
}
|
|
1935
|
-
__name(getRootESLintConfig, "getRootESLintConfig");
|
|
1936
1738
|
function getFiles(dir, ignoreFolders) {
|
|
1937
1739
|
const currentDirectory = cwd3();
|
|
1938
1740
|
const subDirectory = dir.split(currentDirectory)[1];
|
|
1939
1741
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
1940
|
-
return readdirSync(dir, {
|
|
1941
|
-
|
|
1942
|
-
}).flatMap((dirent) => {
|
|
1943
|
-
const res = path7.resolve(dir, dirent.name);
|
|
1742
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
1743
|
+
const res = path8.resolve(dir, dirent.name);
|
|
1944
1744
|
const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name;
|
|
1945
1745
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
1946
1746
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
1947
|
-
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
|
|
1948
|
-
res
|
|
1949
|
-
];
|
|
1747
|
+
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [res];
|
|
1950
1748
|
});
|
|
1951
1749
|
}
|
|
1952
|
-
|
|
1953
|
-
var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, cache = true) => {
|
|
1750
|
+
var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
1954
1751
|
const pkg = process.env.INIT_CWD;
|
|
1955
1752
|
const configPath = await getRootESLintConfig();
|
|
1956
1753
|
const { default: eslintConfig } = await import(configPath.href);
|
|
1957
1754
|
const start = Date.now();
|
|
1958
|
-
const ignoreFolders = [
|
|
1959
|
-
"node_modules",
|
|
1960
|
-
"dist",
|
|
1961
|
-
"packages",
|
|
1962
|
-
".git",
|
|
1963
|
-
"build",
|
|
1964
|
-
".yarn",
|
|
1965
|
-
".vscode",
|
|
1966
|
-
".github"
|
|
1967
|
-
];
|
|
1755
|
+
const ignoreFolders = ["node_modules", "dist", "packages", ".git", "build", ".yarn", ".vscode", ".github"];
|
|
1968
1756
|
const engine = new ESLint({
|
|
1969
|
-
baseConfig: [
|
|
1970
|
-
...eslintConfig
|
|
1971
|
-
],
|
|
1757
|
+
baseConfig: [...eslintConfig],
|
|
1972
1758
|
fix: fix2,
|
|
1973
1759
|
warnIgnored: false,
|
|
1974
1760
|
cache
|
|
1975
1761
|
});
|
|
1976
1762
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
1977
1763
|
if (verbose) {
|
|
1978
|
-
console.log(
|
|
1764
|
+
console.log(chalk27.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
1979
1765
|
}
|
|
1980
1766
|
const lintResults = await engine.lintFiles(files);
|
|
1981
1767
|
dumpMessages(lintResults);
|
|
@@ -1985,75 +1771,43 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
1985
1771
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
1986
1772
|
const lintTime = Date.now() - start;
|
|
1987
1773
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
1988
|
-
console.log(
|
|
1774
|
+
console.log(chalk27.white(`Linted ${chalk27[filesCountColor](files.length)} files in ${chalk27[lintTimeColor](lintTime)}ms`));
|
|
1989
1775
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1990
|
-
}
|
|
1776
|
+
};
|
|
1991
1777
|
|
|
1992
1778
|
// src/actions/package/recompile.ts
|
|
1993
|
-
var packageRecompile =
|
|
1779
|
+
var packageRecompile = async () => {
|
|
1994
1780
|
return await packageClean() || await packageCompile();
|
|
1995
|
-
}
|
|
1781
|
+
};
|
|
1996
1782
|
|
|
1997
1783
|
// src/actions/publint.ts
|
|
1998
|
-
var publint =
|
|
1999
|
-
return pkg ? await publintPackage({
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
[
|
|
2009
|
-
"yarn",
|
|
2010
|
-
[
|
|
2011
|
-
"workspace",
|
|
2012
|
-
pkg,
|
|
2013
|
-
"run",
|
|
2014
|
-
"package-publint"
|
|
2015
|
-
]
|
|
2016
|
-
]
|
|
2017
|
-
]);
|
|
2018
|
-
}, "publintPackage");
|
|
2019
|
-
var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
2020
|
-
const verboseOptions = verbose ? [
|
|
2021
|
-
"--verbose"
|
|
2022
|
-
] : [
|
|
2023
|
-
"--no-verbose"
|
|
2024
|
-
];
|
|
2025
|
-
return runSteps("Publint", [
|
|
2026
|
-
[
|
|
2027
|
-
"yarn",
|
|
2028
|
-
[
|
|
2029
|
-
"workspaces",
|
|
2030
|
-
"foreach",
|
|
2031
|
-
"-pA",
|
|
2032
|
-
...verboseOptions,
|
|
2033
|
-
"run",
|
|
2034
|
-
"package-publint"
|
|
2035
|
-
]
|
|
2036
|
-
]
|
|
2037
|
-
]);
|
|
2038
|
-
}, "publintAll");
|
|
1784
|
+
var publint = async ({ verbose, pkg }) => {
|
|
1785
|
+
return pkg ? await publintPackage({ pkg, verbose }) : publintAll({ verbose });
|
|
1786
|
+
};
|
|
1787
|
+
var publintPackage = ({ pkg }) => {
|
|
1788
|
+
return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
|
|
1789
|
+
};
|
|
1790
|
+
var publintAll = ({ verbose }) => {
|
|
1791
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1792
|
+
return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
|
|
1793
|
+
};
|
|
2039
1794
|
|
|
2040
1795
|
// src/actions/rebuild.ts
|
|
2041
|
-
var rebuild =
|
|
1796
|
+
var rebuild = ({ target }) => {
|
|
2042
1797
|
return runSteps("Rebuild", [
|
|
2043
|
-
[
|
|
2044
|
-
|
|
2045
|
-
"xy clean"
|
|
2046
|
-
],
|
|
2047
|
-
[
|
|
2048
|
-
"yarn",
|
|
2049
|
-
target ? `xy build -t ${target}` : "xy build"
|
|
2050
|
-
]
|
|
1798
|
+
["yarn", "xy clean"],
|
|
1799
|
+
["yarn", target ? `xy build -t ${target}` : "xy build"]
|
|
2051
1800
|
]);
|
|
2052
|
-
}
|
|
1801
|
+
};
|
|
2053
1802
|
|
|
2054
1803
|
// src/actions/recompile.ts
|
|
2055
|
-
import
|
|
2056
|
-
var recompile =
|
|
1804
|
+
import chalk28 from "chalk";
|
|
1805
|
+
var recompile = async ({
|
|
1806
|
+
verbose,
|
|
1807
|
+
target,
|
|
1808
|
+
pkg,
|
|
1809
|
+
incremental
|
|
1810
|
+
}) => {
|
|
2057
1811
|
return pkg ? await recompilePackage({
|
|
2058
1812
|
pkg,
|
|
2059
1813
|
target,
|
|
@@ -2063,51 +1817,27 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
|
|
|
2063
1817
|
target,
|
|
2064
1818
|
verbose
|
|
2065
1819
|
});
|
|
2066
|
-
}
|
|
2067
|
-
var recompilePackage =
|
|
2068
|
-
const targetOptions = target ? [
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
...targetOptions
|
|
2081
|
-
]
|
|
2082
|
-
]
|
|
2083
|
-
]);
|
|
2084
|
-
}, "recompilePackage");
|
|
2085
|
-
var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, incremental }) => {
|
|
1820
|
+
};
|
|
1821
|
+
var recompilePackage = ({ target, pkg }) => {
|
|
1822
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
1823
|
+
return runStepsAsync(
|
|
1824
|
+
`Recompile [${pkg}]`,
|
|
1825
|
+
[["yarn", ["workspace", pkg, "run", "package-recompile", ...targetOptions]]]
|
|
1826
|
+
);
|
|
1827
|
+
};
|
|
1828
|
+
var recompileAll = async ({
|
|
1829
|
+
jobs,
|
|
1830
|
+
verbose,
|
|
1831
|
+
target,
|
|
1832
|
+
incremental
|
|
1833
|
+
}) => {
|
|
2086
1834
|
const start = Date.now();
|
|
2087
|
-
const verboseOptions = verbose ? [
|
|
2088
|
-
|
|
2089
|
-
] : [
|
|
2090
|
-
|
|
2091
|
-
];
|
|
2092
|
-
const targetOptions = target ? [
|
|
2093
|
-
"-t",
|
|
2094
|
-
target
|
|
2095
|
-
] : [];
|
|
2096
|
-
const incrementalOptions = incremental ? [
|
|
2097
|
-
"--since",
|
|
2098
|
-
"-Apt",
|
|
2099
|
-
"--topological-dev"
|
|
2100
|
-
] : [
|
|
2101
|
-
"--parallel",
|
|
2102
|
-
"-Apt",
|
|
2103
|
-
"--topological-dev"
|
|
2104
|
-
];
|
|
2105
|
-
const jobsOptions = jobs ? [
|
|
2106
|
-
"-j",
|
|
2107
|
-
`${jobs}`
|
|
2108
|
-
] : [];
|
|
1835
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1836
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
1837
|
+
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1838
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2109
1839
|
if (jobs) {
|
|
2110
|
-
console.log(
|
|
1840
|
+
console.log(chalk28.blue(`Jobs set to [${jobs}]`));
|
|
2111
1841
|
}
|
|
2112
1842
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2113
1843
|
[
|
|
@@ -2137,13 +1867,19 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2137
1867
|
]
|
|
2138
1868
|
]
|
|
2139
1869
|
]);
|
|
2140
|
-
console.log(
|
|
1870
|
+
console.log(
|
|
1871
|
+
`${chalk28.gray("Recompiled in")} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`
|
|
1872
|
+
);
|
|
2141
1873
|
return result;
|
|
2142
|
-
}
|
|
1874
|
+
};
|
|
2143
1875
|
|
|
2144
1876
|
// src/actions/reinstall.ts
|
|
2145
|
-
import {
|
|
2146
|
-
|
|
1877
|
+
import {
|
|
1878
|
+
closeSync,
|
|
1879
|
+
openSync,
|
|
1880
|
+
rmSync
|
|
1881
|
+
} from "node:fs";
|
|
1882
|
+
var reinstall = () => {
|
|
2147
1883
|
console.log("Reinstall [Clear Lock File]");
|
|
2148
1884
|
closeSync(openSync("./yarn.lock", "w"));
|
|
2149
1885
|
console.log("Reinstall [Clear Node Modules]");
|
|
@@ -2151,10 +1887,7 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2151
1887
|
const result = workspaces.map(({ location, name }) => {
|
|
2152
1888
|
const dist = `${location}/node_modules`;
|
|
2153
1889
|
try {
|
|
2154
|
-
rmSync(dist, {
|
|
2155
|
-
force: true,
|
|
2156
|
-
recursive: true
|
|
2157
|
-
});
|
|
1890
|
+
rmSync(dist, { force: true, recursive: true });
|
|
2158
1891
|
return 0;
|
|
2159
1892
|
} catch (ex) {
|
|
2160
1893
|
const error = ex;
|
|
@@ -2162,226 +1895,115 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2162
1895
|
return 1;
|
|
2163
1896
|
}
|
|
2164
1897
|
}).reduce((prev, result2) => prev || result2, 0);
|
|
2165
|
-
return result || runSteps("Reinstall", [
|
|
2166
|
-
|
|
2167
|
-
"yarn",
|
|
2168
|
-
"install --network-timeout 10000"
|
|
2169
|
-
]
|
|
2170
|
-
]);
|
|
2171
|
-
}, "reinstall");
|
|
1898
|
+
return result || runSteps("Reinstall", [["yarn", "install --network-timeout 10000"]]);
|
|
1899
|
+
};
|
|
2172
1900
|
|
|
2173
1901
|
// src/actions/relint.ts
|
|
2174
|
-
import
|
|
2175
|
-
var relintPackage =
|
|
2176
|
-
console.log(
|
|
1902
|
+
import chalk29 from "chalk";
|
|
1903
|
+
var relintPackage = ({ pkg }) => {
|
|
1904
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2177
1905
|
const start = Date.now();
|
|
2178
1906
|
const result = runSteps("Relint [All-Packages]", [
|
|
2179
|
-
[
|
|
2180
|
-
"
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
"package-relint"
|
|
2186
|
-
]
|
|
2187
|
-
]
|
|
1907
|
+
["yarn", [
|
|
1908
|
+
"workspace",
|
|
1909
|
+
pkg,
|
|
1910
|
+
"run",
|
|
1911
|
+
"package-relint"
|
|
1912
|
+
]]
|
|
2188
1913
|
]);
|
|
2189
|
-
console.log(
|
|
1914
|
+
console.log(chalk29.gray(`${"Relinted in"} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2190
1915
|
return result;
|
|
2191
|
-
}
|
|
2192
|
-
var relint =
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
console.log(chalk28.gray(`${"Relint"} [All-Packages]`));
|
|
1916
|
+
};
|
|
1917
|
+
var relint = ({
|
|
1918
|
+
pkg,
|
|
1919
|
+
verbose,
|
|
1920
|
+
incremental
|
|
1921
|
+
} = {}) => {
|
|
1922
|
+
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
1923
|
+
};
|
|
1924
|
+
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
1925
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2202
1926
|
const start = Date.now();
|
|
2203
|
-
const verboseOptions = verbose ? [
|
|
2204
|
-
|
|
2205
|
-
] : [
|
|
2206
|
-
"--no-verbose"
|
|
2207
|
-
];
|
|
2208
|
-
const incrementalOptions = incremental ? [
|
|
2209
|
-
"--since",
|
|
2210
|
-
"-Ap"
|
|
2211
|
-
] : [
|
|
2212
|
-
"--parallel",
|
|
2213
|
-
"-Ap"
|
|
2214
|
-
];
|
|
1927
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1928
|
+
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
2215
1929
|
const result = runSteps(`${"Relint"} [All-Packages]`, [
|
|
2216
|
-
[
|
|
2217
|
-
"
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
"package-relint"
|
|
2225
|
-
]
|
|
2226
|
-
]
|
|
1930
|
+
["yarn", [
|
|
1931
|
+
"workspaces",
|
|
1932
|
+
"foreach",
|
|
1933
|
+
...verboseOptions,
|
|
1934
|
+
...incrementalOptions,
|
|
1935
|
+
"run",
|
|
1936
|
+
"package-relint"
|
|
1937
|
+
]]
|
|
2227
1938
|
]);
|
|
2228
|
-
console.log(
|
|
1939
|
+
console.log(chalk29.gray(`Relinted in [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2229
1940
|
return result;
|
|
2230
|
-
}
|
|
1941
|
+
};
|
|
2231
1942
|
|
|
2232
1943
|
// src/actions/retest.ts
|
|
2233
|
-
var retest =
|
|
1944
|
+
var retest = () => {
|
|
2234
1945
|
return runSteps("Test", [
|
|
2235
|
-
[
|
|
2236
|
-
|
|
2237
|
-
[
|
|
2238
|
-
"jest",
|
|
2239
|
-
"--clearCache"
|
|
2240
|
-
]
|
|
2241
|
-
],
|
|
2242
|
-
[
|
|
2243
|
-
"yarn",
|
|
2244
|
-
[
|
|
2245
|
-
"jest",
|
|
2246
|
-
"."
|
|
2247
|
-
]
|
|
2248
|
-
]
|
|
1946
|
+
["yarn", ["jest", "--clearCache"]],
|
|
1947
|
+
["yarn", ["jest", "."]]
|
|
2249
1948
|
]);
|
|
2250
|
-
}
|
|
1949
|
+
};
|
|
2251
1950
|
|
|
2252
1951
|
// src/actions/sonar.ts
|
|
2253
|
-
var sonar =
|
|
2254
|
-
return runSteps("Sonar", [
|
|
2255
|
-
|
|
2256
|
-
"yarn",
|
|
2257
|
-
[
|
|
2258
|
-
"eslint",
|
|
2259
|
-
"-c",
|
|
2260
|
-
"sonar.eslintrc",
|
|
2261
|
-
"."
|
|
2262
|
-
]
|
|
2263
|
-
]
|
|
2264
|
-
]);
|
|
2265
|
-
}, "sonar");
|
|
1952
|
+
var sonar = () => {
|
|
1953
|
+
return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
|
|
1954
|
+
};
|
|
2266
1955
|
|
|
2267
1956
|
// src/actions/statics.ts
|
|
2268
|
-
import
|
|
2269
|
-
var DefaultDependencies = [
|
|
2270
|
-
|
|
2271
|
-
"
|
|
2272
|
-
"react",
|
|
2273
|
-
"graphql",
|
|
2274
|
-
"react-router",
|
|
2275
|
-
"@mui/material",
|
|
2276
|
-
"@mui/system"
|
|
2277
|
-
];
|
|
2278
|
-
var statics = /* @__PURE__ */ __name(() => {
|
|
2279
|
-
console.log(chalk29.green("Check Required Static Dependencies"));
|
|
1957
|
+
import chalk30 from "chalk";
|
|
1958
|
+
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
1959
|
+
var statics = () => {
|
|
1960
|
+
console.log(chalk30.green("Check Required Static Dependencies"));
|
|
2280
1961
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2281
1962
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2282
|
-
}
|
|
1963
|
+
};
|
|
2283
1964
|
|
|
2284
1965
|
// src/actions/test.ts
|
|
2285
|
-
var test =
|
|
2286
|
-
return runSteps("Test", [
|
|
2287
|
-
|
|
2288
|
-
"yarn",
|
|
2289
|
-
[
|
|
2290
|
-
"vitest",
|
|
2291
|
-
"."
|
|
2292
|
-
]
|
|
2293
|
-
]
|
|
2294
|
-
]);
|
|
2295
|
-
}, "test");
|
|
1966
|
+
var test = () => {
|
|
1967
|
+
return runSteps("Test", [["yarn", ["vitest", "."]]]);
|
|
1968
|
+
};
|
|
2296
1969
|
|
|
2297
1970
|
// src/actions/up.ts
|
|
2298
|
-
var up =
|
|
2299
|
-
return runSteps("Up", [
|
|
2300
|
-
|
|
2301
|
-
"yarn",
|
|
2302
|
-
"outdated"
|
|
2303
|
-
]
|
|
2304
|
-
]);
|
|
2305
|
-
}, "up");
|
|
1971
|
+
var up = () => {
|
|
1972
|
+
return runSteps("Up", [["yarn", "outdated"]]);
|
|
1973
|
+
};
|
|
2306
1974
|
|
|
2307
1975
|
// src/actions/updo.ts
|
|
2308
|
-
var updo =
|
|
1976
|
+
var updo = () => {
|
|
2309
1977
|
return runSteps("Updo", [
|
|
2310
|
-
[
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
],
|
|
2314
|
-
[
|
|
2315
|
-
"yarn",
|
|
2316
|
-
"upgrade-interactive"
|
|
2317
|
-
],
|
|
2318
|
-
[
|
|
2319
|
-
"yarn",
|
|
2320
|
-
"dedupe"
|
|
2321
|
-
]
|
|
1978
|
+
["yarn", "install"],
|
|
1979
|
+
["yarn", "upgrade-interactive"],
|
|
1980
|
+
["yarn", "dedupe"]
|
|
2322
1981
|
]);
|
|
2323
|
-
}
|
|
1982
|
+
};
|
|
2324
1983
|
|
|
2325
1984
|
// src/actions/upplug.ts
|
|
2326
|
-
var updateYarnPlugins =
|
|
1985
|
+
var updateYarnPlugins = () => {
|
|
2327
1986
|
return runSteps("Update Yarn Plugins", [
|
|
2328
|
-
[
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
"import",
|
|
2333
|
-
"https://mskelton.dev/yarn-outdated/v3"
|
|
2334
|
-
]
|
|
2335
|
-
],
|
|
2336
|
-
[
|
|
2337
|
-
"yarn",
|
|
2338
|
-
[
|
|
2339
|
-
"plugin",
|
|
2340
|
-
"import",
|
|
2341
|
-
"version"
|
|
2342
|
-
]
|
|
2343
|
-
],
|
|
2344
|
-
[
|
|
2345
|
-
"yarn",
|
|
2346
|
-
[
|
|
2347
|
-
"plugin",
|
|
2348
|
-
"import",
|
|
2349
|
-
"interactive-tools"
|
|
2350
|
-
]
|
|
2351
|
-
],
|
|
2352
|
-
[
|
|
2353
|
-
"yarn",
|
|
2354
|
-
[
|
|
2355
|
-
"plugin",
|
|
2356
|
-
"import",
|
|
2357
|
-
"workspace-tools"
|
|
2358
|
-
]
|
|
2359
|
-
]
|
|
1987
|
+
["yarn", ["plugin", "import", "https://mskelton.dev/yarn-outdated/v3"]],
|
|
1988
|
+
["yarn", ["plugin", "import", "version"]],
|
|
1989
|
+
["yarn", ["plugin", "import", "interactive-tools"]],
|
|
1990
|
+
["yarn", ["plugin", "import", "workspace-tools"]]
|
|
2360
1991
|
]);
|
|
2361
|
-
}
|
|
1992
|
+
};
|
|
2362
1993
|
|
|
2363
1994
|
// src/actions/upyarn.ts
|
|
2364
|
-
var updateYarnVersion =
|
|
2365
|
-
return runSteps("Update Yarn Version", [
|
|
2366
|
-
|
|
2367
|
-
"yarn",
|
|
2368
|
-
[
|
|
2369
|
-
"set",
|
|
2370
|
-
"version",
|
|
2371
|
-
"latest"
|
|
2372
|
-
]
|
|
2373
|
-
]
|
|
2374
|
-
]);
|
|
2375
|
-
}, "updateYarnVersion");
|
|
1995
|
+
var updateYarnVersion = () => {
|
|
1996
|
+
return runSteps("Update Yarn Version", [["yarn", ["set", "version", "latest"]]]);
|
|
1997
|
+
};
|
|
2376
1998
|
|
|
2377
1999
|
// src/actions/yarn3only.ts
|
|
2378
|
-
var yarn3Only =
|
|
2000
|
+
var yarn3Only = () => {
|
|
2379
2001
|
const [valid, version] = isYarnVersionOrGreater(3);
|
|
2380
2002
|
if (!valid) {
|
|
2381
2003
|
processEx(`Invalid Yarn version [${version}]`);
|
|
2382
2004
|
}
|
|
2383
2005
|
return 0;
|
|
2384
|
-
}
|
|
2006
|
+
};
|
|
2385
2007
|
export {
|
|
2386
2008
|
build,
|
|
2387
2009
|
clean,
|
|
@@ -2399,6 +2021,7 @@ export {
|
|
|
2399
2021
|
cycleAll,
|
|
2400
2022
|
cyclePackage,
|
|
2401
2023
|
dead,
|
|
2024
|
+
deplint,
|
|
2402
2025
|
deploy,
|
|
2403
2026
|
deployMajor,
|
|
2404
2027
|
deployMinor,
|