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