@xylabs/ts-scripts-yarn3 6.3.5 → 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 -54
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +25 -65
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +28 -44
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +5 -14
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +4 -7
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +860 -1241
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +16 -31
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +37 -51
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +33 -48
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +28 -44
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +6 -16
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +6 -16
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +12 -29
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +7 -17
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +133 -169
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +43 -59
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +20 -23
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/deepMerge.mjs +0 -5
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +11 -10
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +133 -169
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +3 -8
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +127 -163
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +12 -21
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +5 -14
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs +11 -12
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs +191 -271
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +16 -39
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/publint.mjs +4 -7
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +147 -197
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +37 -71
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +17 -29
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +50 -67
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +25 -43
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +40 -63
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +17 -35
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +16 -32
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +27 -46
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs +16 -30
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +16 -27
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +18 -33
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +19 -53
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +16 -31
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +12 -23
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +134 -172
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +134 -172
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +6 -15
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +6 -15
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +12 -28
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +134 -172
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +128 -165
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +44 -61
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +134 -171
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +13 -23
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +13 -23
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +6 -16
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +16 -38
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs +11 -11
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +16 -38
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +4 -6
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +147 -196
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +16 -38
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +1082 -1237
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1334 -1583
- package/dist/index.mjs.map +1 -1
- package/dist/lib/checkResult.mjs +2 -5
- package/dist/lib/checkResult.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +9 -24
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/defaultBuildConfig.mjs +2 -6
- package/dist/lib/defaultBuildConfig.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs +3 -9
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +12 -23
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +22 -33
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +22 -33
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +1 -3
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/constants.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs +12 -13
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs +14 -15
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs +3 -8
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +27 -43
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +100 -154
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/jsonFormatters.mjs +2 -5
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +4 -8
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +2 -5
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/processEx.mjs +6 -9
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.mjs +13 -19
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +22 -22
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs +19 -31
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/runXyWithWarning.mjs +2 -5
- package/dist/lib/runXyWithWarning.mjs.map +1 -1
- package/dist/lib/safeExit.mjs +10 -13
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/string/empty.mjs +2 -5
- package/dist/lib/string/empty.mjs.map +1 -1
- package/dist/lib/string/index.mjs +3 -9
- package/dist/lib/string/index.mjs.map +1 -1
- package/dist/lib/string/union.mjs +1 -7
- package/dist/lib/string/union.mjs.map +1 -1
- package/dist/lib/withErrnoException.mjs +4 -7
- package/dist/lib/withErrnoException.mjs.map +1 -1
- package/dist/lib/withError.mjs +2 -5
- package/dist/lib/withError.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +11 -30
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +4 -15
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs +5 -16
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +5 -16
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +3 -14
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/lib/yarn/yarnInitCwd.mjs +2 -5
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
- package/dist/loadPackageConfig.mjs +3 -8
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/index.mjs +1082 -1238
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +3 -8
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +1082 -1238
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +276 -382
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +251 -335
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +84 -130
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +145 -193
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +409 -292
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +4 -13
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +3 -22
package/dist/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,247 +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();
|
|
1101
|
-
const fixOptions = fix2 ? [
|
|
1102
|
-
"--fix"
|
|
1103
|
-
] : [];
|
|
1001
|
+
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1104
1002
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1105
|
-
[
|
|
1106
|
-
"yarn",
|
|
1107
|
-
[
|
|
1108
|
-
"eslint",
|
|
1109
|
-
...fixOptions
|
|
1110
|
-
]
|
|
1111
|
-
]
|
|
1003
|
+
["yarn", ["eslint", ...fixOptions]]
|
|
1112
1004
|
]);
|
|
1113
|
-
console.log(
|
|
1005
|
+
console.log(chalk16.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk16.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk16.gray("seconds")}`));
|
|
1114
1006
|
return result;
|
|
1115
|
-
}
|
|
1007
|
+
};
|
|
1116
1008
|
|
|
1117
1009
|
// src/actions/fix.ts
|
|
1118
|
-
var fix =
|
|
1119
|
-
return lint({
|
|
1120
|
-
|
|
1121
|
-
fix: true
|
|
1122
|
-
});
|
|
1123
|
-
}, "fix");
|
|
1010
|
+
var fix = (params) => {
|
|
1011
|
+
return lint({ ...params, fix: true });
|
|
1012
|
+
};
|
|
1124
1013
|
|
|
1125
1014
|
// src/actions/gen-docs.ts
|
|
1126
|
-
var genDocs =
|
|
1127
|
-
return pkg ? genDocsPackage({
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
var
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
"workspace",
|
|
1139
|
-
pkg,
|
|
1140
|
-
"run",
|
|
1141
|
-
"package-gen-docs"
|
|
1142
|
-
]
|
|
1143
|
-
]
|
|
1144
|
-
];
|
|
1145
|
-
return runSteps(`GenDocs [${pkg}]`, [
|
|
1146
|
-
...steps
|
|
1147
|
-
]);
|
|
1148
|
-
}, "genDocsPackage");
|
|
1149
|
-
var genDocsAll = /* @__PURE__ */ __name(({ incremental }) => {
|
|
1150
|
-
const incrementalOptions = incremental ? [
|
|
1151
|
-
"--since",
|
|
1152
|
-
"-pA"
|
|
1153
|
-
] : [
|
|
1154
|
-
"-pA"
|
|
1155
|
-
];
|
|
1156
|
-
const steps = [
|
|
1157
|
-
[
|
|
1158
|
-
"yarn",
|
|
1159
|
-
[
|
|
1160
|
-
"workspaces",
|
|
1161
|
-
"foreach",
|
|
1162
|
-
...incrementalOptions,
|
|
1163
|
-
"run",
|
|
1164
|
-
"package-gen-docs"
|
|
1165
|
-
]
|
|
1166
|
-
]
|
|
1167
|
-
];
|
|
1168
|
-
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [
|
|
1169
|
-
...steps
|
|
1170
|
-
]);
|
|
1171
|
-
}, "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
|
+
};
|
|
1172
1027
|
|
|
1173
1028
|
// src/actions/gitignore-gen.ts
|
|
1174
1029
|
var filename = ".gitignore";
|
|
1175
|
-
var gitignoreGen =
|
|
1030
|
+
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1176
1031
|
|
|
1177
1032
|
// src/actions/gitlint.ts
|
|
1178
|
-
import
|
|
1033
|
+
import chalk17 from "chalk";
|
|
1179
1034
|
import ParseGitConfig from "parse-git-config";
|
|
1180
|
-
var gitlint =
|
|
1035
|
+
var gitlint = () => {
|
|
1181
1036
|
console.log(`
|
|
1182
1037
|
Gitlint Start [${process.cwd()}]
|
|
1183
1038
|
`);
|
|
@@ -1185,10 +1040,10 @@ Gitlint Start [${process.cwd()}]
|
|
|
1185
1040
|
let warnings = 0;
|
|
1186
1041
|
const errors = 0;
|
|
1187
1042
|
const gitConfig = ParseGitConfig.sync();
|
|
1188
|
-
const warn =
|
|
1189
|
-
console.warn(
|
|
1043
|
+
const warn = (message) => {
|
|
1044
|
+
console.warn(chalk17.yellow(`Warning: ${message}`));
|
|
1190
1045
|
warnings++;
|
|
1191
|
-
}
|
|
1046
|
+
};
|
|
1192
1047
|
if (gitConfig.core.ignorecase) {
|
|
1193
1048
|
warn("Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]");
|
|
1194
1049
|
} else {
|
|
@@ -1206,67 +1061,52 @@ Gitlint Start [${process.cwd()}]
|
|
|
1206
1061
|
}
|
|
1207
1062
|
const resultMessages = [];
|
|
1208
1063
|
if (valid > 0) {
|
|
1209
|
-
resultMessages.push(
|
|
1064
|
+
resultMessages.push(chalk17.green(`Passed: ${valid}`));
|
|
1210
1065
|
}
|
|
1211
1066
|
if (warnings > 0) {
|
|
1212
|
-
resultMessages.push(
|
|
1067
|
+
resultMessages.push(chalk17.yellow(`Warnings: ${warnings}`));
|
|
1213
1068
|
}
|
|
1214
1069
|
if (errors > 0) {
|
|
1215
|
-
resultMessages.push(
|
|
1070
|
+
resultMessages.push(chalk17.red(` Errors: ${errors}`));
|
|
1216
1071
|
}
|
|
1217
1072
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1218
1073
|
`);
|
|
1219
1074
|
return warnings + errors === 0 ? 1 : 0;
|
|
1220
|
-
}
|
|
1075
|
+
};
|
|
1221
1076
|
|
|
1222
1077
|
// src/actions/gitlint-fix.ts
|
|
1223
1078
|
import { execSync as execSync2 } from "node:child_process";
|
|
1224
|
-
import
|
|
1079
|
+
import chalk18 from "chalk";
|
|
1225
1080
|
import ParseGitConfig2 from "parse-git-config";
|
|
1226
|
-
var gitlintFix =
|
|
1081
|
+
var gitlintFix = () => {
|
|
1227
1082
|
console.log(`
|
|
1228
1083
|
Gitlint Fix Start [${process.cwd()}]
|
|
1229
1084
|
`);
|
|
1230
1085
|
const gitConfig = ParseGitConfig2.sync();
|
|
1231
1086
|
if (gitConfig.core.ignorecase) {
|
|
1232
|
-
execSync2("git config core.ignorecase false", {
|
|
1233
|
-
|
|
1234
|
-
});
|
|
1235
|
-
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"));
|
|
1236
1089
|
}
|
|
1237
1090
|
if (gitConfig.core.autocrlf !== false) {
|
|
1238
|
-
execSync2("git config core.autocrlf false", {
|
|
1239
|
-
|
|
1240
|
-
});
|
|
1241
|
-
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"));
|
|
1242
1093
|
}
|
|
1243
1094
|
if (gitConfig.core.eol !== "lf") {
|
|
1244
|
-
execSync2("git config core.eol lf", {
|
|
1245
|
-
|
|
1246
|
-
});
|
|
1247
|
-
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'));
|
|
1248
1097
|
}
|
|
1249
1098
|
return 1;
|
|
1250
|
-
}
|
|
1099
|
+
};
|
|
1251
1100
|
|
|
1252
1101
|
// src/actions/knip.ts
|
|
1253
|
-
var knip =
|
|
1254
|
-
return runSteps("Knip", [
|
|
1255
|
-
|
|
1256
|
-
"yarn",
|
|
1257
|
-
[
|
|
1258
|
-
"knip",
|
|
1259
|
-
"--dependencies",
|
|
1260
|
-
"--no-exit-code"
|
|
1261
|
-
]
|
|
1262
|
-
]
|
|
1263
|
-
]);
|
|
1264
|
-
}, "knip");
|
|
1102
|
+
var knip = () => {
|
|
1103
|
+
return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
|
|
1104
|
+
};
|
|
1265
1105
|
|
|
1266
1106
|
// src/actions/license.ts
|
|
1267
|
-
import
|
|
1107
|
+
import chalk19 from "chalk";
|
|
1268
1108
|
import { init } from "license-checker";
|
|
1269
|
-
var license =
|
|
1109
|
+
var license = async (pkg) => {
|
|
1270
1110
|
const workspaces = yarnWorkspaces();
|
|
1271
1111
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1272
1112
|
return pkg === void 0 || name === pkg;
|
|
@@ -1289,112 +1129,98 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1289
1129
|
"LGPL-3.0-or-later",
|
|
1290
1130
|
"Python-2.0"
|
|
1291
1131
|
]);
|
|
1292
|
-
console.log(
|
|
1293
|
-
return (await Promise.all(
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
production: true,
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
if (
|
|
1318
|
-
|
|
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}]`));
|
|
1319
1160
|
}
|
|
1320
|
-
}
|
|
1321
|
-
if (!orLicenseFound) {
|
|
1322
|
-
count++;
|
|
1323
|
-
console.warn(chalk18.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1324
1161
|
}
|
|
1325
1162
|
}
|
|
1326
1163
|
}
|
|
1164
|
+
console.log("\n");
|
|
1165
|
+
resolve(count);
|
|
1327
1166
|
}
|
|
1328
|
-
|
|
1329
|
-
resolve(count);
|
|
1330
|
-
}
|
|
1167
|
+
});
|
|
1331
1168
|
});
|
|
1332
|
-
})
|
|
1333
|
-
|
|
1334
|
-
}
|
|
1169
|
+
})
|
|
1170
|
+
)).reduce((prev, value) => prev || value, 0);
|
|
1171
|
+
};
|
|
1335
1172
|
|
|
1336
1173
|
// src/actions/npmignore-gen.ts
|
|
1337
1174
|
var filename2 = ".npmignore";
|
|
1338
|
-
var npmignoreGen =
|
|
1175
|
+
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1339
1176
|
|
|
1340
1177
|
// src/actions/package/clean-outputs.ts
|
|
1341
|
-
import
|
|
1342
|
-
import
|
|
1343
|
-
var packageCleanOutputs =
|
|
1178
|
+
import path4 from "node:path";
|
|
1179
|
+
import chalk20 from "chalk";
|
|
1180
|
+
var packageCleanOutputs = () => {
|
|
1344
1181
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1345
1182
|
const pkgName = process.env.npm_package_name;
|
|
1346
|
-
const folders = [
|
|
1347
|
-
|
|
1348
|
-
path3.join(pkg, "build"),
|
|
1349
|
-
path3.join(pkg, "docs")
|
|
1350
|
-
];
|
|
1351
|
-
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}]`));
|
|
1352
1185
|
for (let folder of folders) {
|
|
1353
1186
|
deleteGlob(folder);
|
|
1354
1187
|
}
|
|
1355
1188
|
return 0;
|
|
1356
|
-
}
|
|
1189
|
+
};
|
|
1357
1190
|
|
|
1358
1191
|
// src/actions/package/clean-typescript.ts
|
|
1359
|
-
import
|
|
1360
|
-
import
|
|
1361
|
-
var packageCleanTypescript =
|
|
1192
|
+
import path5 from "node:path";
|
|
1193
|
+
import chalk21 from "chalk";
|
|
1194
|
+
var packageCleanTypescript = () => {
|
|
1362
1195
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1363
1196
|
const pkgName = process.env.npm_package_name;
|
|
1364
|
-
console.log(
|
|
1365
|
-
const files = [
|
|
1366
|
-
path4.join(pkg, "*.tsbuildinfo"),
|
|
1367
|
-
path4.join(pkg, ".tsconfig.*"),
|
|
1368
|
-
path4.join(pkg, ".eslintcache")
|
|
1369
|
-
];
|
|
1197
|
+
console.log(chalk21.green(`Cleaning Typescript [${pkgName}]`));
|
|
1198
|
+
const files = [path5.join(pkg, "*.tsbuildinfo"), path5.join(pkg, ".tsconfig.*"), path5.join(pkg, ".eslintcache")];
|
|
1370
1199
|
for (let file of files) {
|
|
1371
1200
|
deleteGlob(file);
|
|
1372
1201
|
}
|
|
1373
1202
|
return 0;
|
|
1374
|
-
}
|
|
1203
|
+
};
|
|
1375
1204
|
|
|
1376
1205
|
// src/actions/package/clean.ts
|
|
1377
|
-
var packageClean =
|
|
1378
|
-
return (await Promise.all([
|
|
1379
|
-
|
|
1380
|
-
packageCleanTypescript()
|
|
1381
|
-
])).reduce((prev, value) => prev + value, 0);
|
|
1382
|
-
}, "packageClean");
|
|
1206
|
+
var packageClean = async () => {
|
|
1207
|
+
return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0);
|
|
1208
|
+
};
|
|
1383
1209
|
|
|
1384
1210
|
// src/actions/package/compile/compile.ts
|
|
1385
|
-
import
|
|
1211
|
+
import chalk25 from "chalk";
|
|
1386
1212
|
|
|
1387
1213
|
// src/actions/package/publint.ts
|
|
1388
|
-
import { promises as
|
|
1389
|
-
import
|
|
1214
|
+
import { promises as fs3 } from "node:fs";
|
|
1215
|
+
import chalk22 from "chalk";
|
|
1390
1216
|
import sortPackageJson from "sort-package-json";
|
|
1391
|
-
var packagePublint =
|
|
1217
|
+
var packagePublint = async (params) => {
|
|
1392
1218
|
const pkgDir = process.env.INIT_CWD;
|
|
1393
|
-
const sortedPkg = sortPackageJson(await
|
|
1394
|
-
await
|
|
1395
|
-
const pkg = JSON.parse(await
|
|
1396
|
-
console.log(
|
|
1397
|
-
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));
|
|
1398
1224
|
const { publint: publint2 } = await import("publint");
|
|
1399
1225
|
const { messages } = await publint2({
|
|
1400
1226
|
level: "suggestion",
|
|
@@ -1402,52 +1228,47 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
|
1402
1228
|
strict: true
|
|
1403
1229
|
});
|
|
1404
1230
|
const { formatMessage } = await import("publint/utils");
|
|
1405
|
-
const validMessage =
|
|
1231
|
+
const validMessage = (_message) => {
|
|
1406
1232
|
return true;
|
|
1407
|
-
}
|
|
1233
|
+
};
|
|
1408
1234
|
const validMessages = messages.filter(validMessage);
|
|
1409
1235
|
for (const message of validMessages) {
|
|
1410
1236
|
switch (message.type) {
|
|
1411
1237
|
case "error": {
|
|
1412
|
-
console.error(
|
|
1238
|
+
console.error(chalk22.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1413
1239
|
break;
|
|
1414
1240
|
}
|
|
1415
1241
|
case "warning": {
|
|
1416
|
-
console.warn(
|
|
1242
|
+
console.warn(chalk22.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1417
1243
|
break;
|
|
1418
1244
|
}
|
|
1419
1245
|
default: {
|
|
1420
|
-
console.log(
|
|
1246
|
+
console.log(chalk22.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1421
1247
|
break;
|
|
1422
1248
|
}
|
|
1423
1249
|
}
|
|
1424
1250
|
}
|
|
1425
1251
|
if (params?.verbose) {
|
|
1426
|
-
console.log(
|
|
1252
|
+
console.log(chalk22.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1427
1253
|
}
|
|
1428
1254
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1429
|
-
}
|
|
1255
|
+
};
|
|
1430
1256
|
|
|
1431
1257
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1432
1258
|
import { build as build2, defineConfig } from "tsup";
|
|
1433
1259
|
|
|
1434
1260
|
// src/actions/package/compile/inputs.ts
|
|
1435
1261
|
import { glob as glob2 } from "glob";
|
|
1436
|
-
var getAllInputs =
|
|
1437
|
-
return glob2.sync(`${folder}/**/*.*`, {
|
|
1438
|
-
|
|
1439
|
-
});
|
|
1440
|
-
}, "getAllInputs");
|
|
1262
|
+
var getAllInputs = (folder) => {
|
|
1263
|
+
return glob2.sync(`${folder}/**/*.*`, { posix: true });
|
|
1264
|
+
};
|
|
1441
1265
|
|
|
1442
1266
|
// src/actions/package/compile/buildEntries.ts
|
|
1443
|
-
var buildEntries =
|
|
1267
|
+
var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true, verbose = false) => {
|
|
1444
1268
|
let entries = [];
|
|
1445
1269
|
switch (entryMode) {
|
|
1446
1270
|
case "platform": {
|
|
1447
|
-
entries = [
|
|
1448
|
-
`${folder}/index-node.ts`,
|
|
1449
|
-
`${folder}/index-browser.ts`
|
|
1450
|
-
];
|
|
1271
|
+
entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`];
|
|
1451
1272
|
break;
|
|
1452
1273
|
}
|
|
1453
1274
|
case "all": {
|
|
@@ -1455,46 +1276,53 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", exclude
|
|
|
1455
1276
|
break;
|
|
1456
1277
|
}
|
|
1457
1278
|
default: {
|
|
1458
|
-
entries = [
|
|
1459
|
-
`${folder}/index.ts`
|
|
1460
|
-
];
|
|
1279
|
+
entries = [`${folder}/index.ts`];
|
|
1461
1280
|
break;
|
|
1462
1281
|
}
|
|
1463
1282
|
}
|
|
1464
1283
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
1465
1284
|
return entries;
|
|
1466
|
-
}
|
|
1285
|
+
};
|
|
1467
1286
|
|
|
1468
1287
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1469
1288
|
import { cwd } from "node:process";
|
|
1470
|
-
import
|
|
1289
|
+
import chalk23 from "chalk";
|
|
1471
1290
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1472
|
-
import {
|
|
1291
|
+
import {
|
|
1292
|
+
DiagnosticCategory,
|
|
1293
|
+
formatDiagnosticsWithColorAndContext,
|
|
1294
|
+
getPreEmitDiagnostics,
|
|
1295
|
+
sys as sys2
|
|
1296
|
+
} from "typescript";
|
|
1473
1297
|
|
|
1474
1298
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
1475
1299
|
import { createRequire } from "node:module";
|
|
1476
1300
|
import deepmerge2 from "deepmerge";
|
|
1477
|
-
import {
|
|
1478
|
-
|
|
1301
|
+
import {
|
|
1302
|
+
findConfigFile,
|
|
1303
|
+
readConfigFile,
|
|
1304
|
+
sys
|
|
1305
|
+
} from "typescript";
|
|
1306
|
+
var getNested = (config2) => {
|
|
1479
1307
|
if (config2.extends) {
|
|
1480
1308
|
const require2 = createRequire(import.meta.url);
|
|
1481
1309
|
const opts = require2(config2.extends);
|
|
1482
1310
|
return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
|
|
1483
1311
|
}
|
|
1484
1312
|
return config2.compilerOptions;
|
|
1485
|
-
}
|
|
1486
|
-
var getCompilerOptionsJSONFollowExtends =
|
|
1313
|
+
};
|
|
1314
|
+
var getCompilerOptionsJSONFollowExtends = (filename3) => {
|
|
1487
1315
|
const config2 = readConfigFile(filename3, sys.readFile).config;
|
|
1488
1316
|
return getNested(config2);
|
|
1489
|
-
}
|
|
1490
|
-
var getCompilerOptions =
|
|
1317
|
+
};
|
|
1318
|
+
var getCompilerOptions = (options = {}, tsconfig = "tsconfig.json") => {
|
|
1491
1319
|
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
1492
1320
|
const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
|
|
1493
1321
|
return deepmerge2(configFileCompilerOptions, options);
|
|
1494
|
-
}
|
|
1322
|
+
};
|
|
1495
1323
|
|
|
1496
1324
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1497
|
-
var packageCompileTscTypes =
|
|
1325
|
+
var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1498
1326
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
1499
1327
|
const verbose = config2?.verbose ?? false;
|
|
1500
1328
|
const compilerOptions = {
|
|
@@ -1510,54 +1338,40 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
1510
1338
|
emitDeclarationOnly: true,
|
|
1511
1339
|
noEmit: false
|
|
1512
1340
|
};
|
|
1513
|
-
const validTsExt = [
|
|
1514
|
-
|
|
1515
|
-
".tsx",
|
|
1516
|
-
".d.ts",
|
|
1517
|
-
".cts",
|
|
1518
|
-
".d.cts",
|
|
1519
|
-
".mts",
|
|
1520
|
-
".d.mts"
|
|
1521
|
-
];
|
|
1522
|
-
const excludes = [
|
|
1523
|
-
".stories.",
|
|
1524
|
-
".spec."
|
|
1525
|
-
];
|
|
1341
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1342
|
+
const excludes = [".stories.", ".spec."];
|
|
1526
1343
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1527
|
-
console.log(
|
|
1344
|
+
console.log(chalk23.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1528
1345
|
if (files.length > 0) {
|
|
1529
1346
|
const program = createProgramFromConfig({
|
|
1530
1347
|
basePath: pkg ?? cwd(),
|
|
1531
1348
|
compilerOptions,
|
|
1532
|
-
exclude: [
|
|
1533
|
-
"dist",
|
|
1534
|
-
"docs",
|
|
1535
|
-
"**/*.spec.*",
|
|
1536
|
-
"**/*.stories.*",
|
|
1537
|
-
"src/**/spec/**/*"
|
|
1538
|
-
],
|
|
1349
|
+
exclude: ["dist", "docs", "**/*.spec.*", "**/*.stories.*", "src/**/spec/**/*"],
|
|
1539
1350
|
files
|
|
1540
1351
|
});
|
|
1541
1352
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
1542
1353
|
if (diagnostics.length > 0) {
|
|
1543
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1354
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1355
|
+
diagnostics,
|
|
1356
|
+
{
|
|
1357
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1358
|
+
getCurrentDirectory: () => folder,
|
|
1359
|
+
getNewLine: () => sys2.newLine
|
|
1360
|
+
}
|
|
1361
|
+
);
|
|
1548
1362
|
console.error(formattedDiagnostics);
|
|
1549
1363
|
}
|
|
1550
1364
|
program.emit();
|
|
1551
1365
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1552
1366
|
}
|
|
1553
1367
|
return 0;
|
|
1554
|
-
}
|
|
1368
|
+
};
|
|
1555
1369
|
|
|
1556
1370
|
// src/actions/package/compile/compileTypes.ts
|
|
1557
|
-
var packageCompileTypes =
|
|
1371
|
+
var packageCompileTypes = async (inConfig = {}) => {
|
|
1558
1372
|
const config2 = await loadConfig(inConfig);
|
|
1559
1373
|
return packageCompileTscTypes(void 0, config2);
|
|
1560
|
-
}
|
|
1374
|
+
};
|
|
1561
1375
|
|
|
1562
1376
|
// src/actions/package/compile/deepMerge.ts
|
|
1563
1377
|
function deepMerge(target, source) {
|
|
@@ -1574,7 +1388,6 @@ function deepMerge(target, source) {
|
|
|
1574
1388
|
}
|
|
1575
1389
|
return target;
|
|
1576
1390
|
}
|
|
1577
|
-
__name(deepMerge, "deepMerge");
|
|
1578
1391
|
function deepMergeObjects(objects) {
|
|
1579
1392
|
const result = {};
|
|
1580
1393
|
for (const obj of objects) {
|
|
@@ -1582,14 +1395,18 @@ function deepMergeObjects(objects) {
|
|
|
1582
1395
|
}
|
|
1583
1396
|
return result;
|
|
1584
1397
|
}
|
|
1585
|
-
__name(deepMergeObjects, "deepMergeObjects");
|
|
1586
1398
|
|
|
1587
1399
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1588
1400
|
import { cwd as cwd2 } from "node:process";
|
|
1589
|
-
import
|
|
1401
|
+
import chalk24 from "chalk";
|
|
1590
1402
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1591
|
-
import {
|
|
1592
|
-
|
|
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) => {
|
|
1593
1410
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1594
1411
|
const verbose = config2?.verbose ?? false;
|
|
1595
1412
|
const compilerOptions = {
|
|
@@ -1604,51 +1421,37 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
1604
1421
|
emitDeclarationOnly: false,
|
|
1605
1422
|
noEmit: true
|
|
1606
1423
|
};
|
|
1607
|
-
const validTsExt = [
|
|
1608
|
-
|
|
1609
|
-
".tsx",
|
|
1610
|
-
".d.ts",
|
|
1611
|
-
".cts",
|
|
1612
|
-
".d.cts",
|
|
1613
|
-
".mts",
|
|
1614
|
-
".d.mts"
|
|
1615
|
-
];
|
|
1616
|
-
const includes = [
|
|
1617
|
-
".stories.",
|
|
1618
|
-
".spec.",
|
|
1619
|
-
".d.ts",
|
|
1620
|
-
".d.cts",
|
|
1621
|
-
".d.mts"
|
|
1622
|
-
];
|
|
1424
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1425
|
+
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1623
1426
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1624
|
-
console.log(
|
|
1427
|
+
console.log(chalk24.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1625
1428
|
if (files.length > 0) {
|
|
1626
1429
|
const program = createProgramFromConfig2({
|
|
1627
1430
|
basePath: pkg ?? cwd2(),
|
|
1628
1431
|
compilerOptions,
|
|
1629
|
-
exclude: [
|
|
1630
|
-
"dist",
|
|
1631
|
-
"docs"
|
|
1632
|
-
],
|
|
1432
|
+
exclude: ["dist", "docs"],
|
|
1633
1433
|
files
|
|
1634
1434
|
});
|
|
1635
1435
|
const diagnostics = getPreEmitDiagnostics2(program);
|
|
1636
1436
|
if (diagnostics.length > 0) {
|
|
1637
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1437
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1438
|
+
diagnostics,
|
|
1439
|
+
{
|
|
1440
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1441
|
+
getCurrentDirectory: () => folder,
|
|
1442
|
+
getNewLine: () => sys3.newLine
|
|
1443
|
+
}
|
|
1444
|
+
);
|
|
1642
1445
|
console.error(formattedDiagnostics);
|
|
1643
1446
|
}
|
|
1644
1447
|
program.emit();
|
|
1645
1448
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
|
|
1646
1449
|
}
|
|
1647
1450
|
return 0;
|
|
1648
|
-
}
|
|
1451
|
+
};
|
|
1649
1452
|
|
|
1650
1453
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1651
|
-
var compileFolder =
|
|
1454
|
+
var compileFolder = async (folder, entryMode = "single", options, verbose) => {
|
|
1652
1455
|
const outDir = options?.outDir ?? "dist";
|
|
1653
1456
|
if (verbose) {
|
|
1654
1457
|
console.log(`compileFolder [${folder}]`);
|
|
@@ -1660,9 +1463,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1660
1463
|
clean: true,
|
|
1661
1464
|
dts: false,
|
|
1662
1465
|
entry,
|
|
1663
|
-
format: [
|
|
1664
|
-
"esm"
|
|
1665
|
-
],
|
|
1466
|
+
format: ["esm"],
|
|
1666
1467
|
outDir,
|
|
1667
1468
|
silent: true,
|
|
1668
1469
|
sourcemap: true,
|
|
@@ -1670,16 +1471,12 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1670
1471
|
tsconfig: "tsconfig.json",
|
|
1671
1472
|
...options
|
|
1672
1473
|
});
|
|
1673
|
-
const optionsList = (await Promise.all(
|
|
1674
|
-
optionsResult
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
return Array.isArray(result) ? result : [
|
|
1680
|
-
result
|
|
1681
|
-
];
|
|
1682
|
-
}))).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();
|
|
1683
1480
|
if (verbose) {
|
|
1684
1481
|
console.log(`TSUP:build:start [${folder}]`);
|
|
1685
1482
|
}
|
|
@@ -1688,8 +1485,8 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1688
1485
|
console.log(`TSUP:build:stop [${folder}]`);
|
|
1689
1486
|
}
|
|
1690
1487
|
return 0;
|
|
1691
|
-
}
|
|
1692
|
-
var tsupOptions =
|
|
1488
|
+
};
|
|
1489
|
+
var tsupOptions = (options = []) => {
|
|
1693
1490
|
const standardLoaders = {
|
|
1694
1491
|
".gif": "copy",
|
|
1695
1492
|
".html": "copy",
|
|
@@ -1701,39 +1498,24 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
|
|
|
1701
1498
|
};
|
|
1702
1499
|
const standardOptions = {
|
|
1703
1500
|
bundle: true,
|
|
1704
|
-
format: [
|
|
1705
|
-
"esm"
|
|
1706
|
-
],
|
|
1501
|
+
format: ["esm"],
|
|
1707
1502
|
loader: standardLoaders,
|
|
1708
|
-
outExtension:
|
|
1709
|
-
js: ".mjs"
|
|
1710
|
-
} : {
|
|
1711
|
-
js: ".cjs"
|
|
1712
|
-
}, "outExtension"),
|
|
1503
|
+
outExtension: ({ format }) => format === "esm" ? { js: ".mjs" } : { js: ".cjs" },
|
|
1713
1504
|
skipNodeModulesBundle: true,
|
|
1714
1505
|
sourcemap: true,
|
|
1715
1506
|
target: "esnext"
|
|
1716
1507
|
};
|
|
1717
|
-
return deepMergeObjects([
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
]);
|
|
1721
|
-
}, "tsupOptions");
|
|
1722
|
-
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1508
|
+
return deepMergeObjects([standardOptions, ...options]);
|
|
1509
|
+
};
|
|
1510
|
+
var packageCompileTsup = async (config2) => {
|
|
1723
1511
|
const compile2 = config2?.compile;
|
|
1724
1512
|
const verbose = config2?.verbose ?? false;
|
|
1725
1513
|
if (verbose) {
|
|
1726
1514
|
console.log(`Compiling with TSUP [Depth: ${compile2?.depth}]`);
|
|
1727
1515
|
}
|
|
1728
|
-
const compileForNode = compile2?.node ?? {
|
|
1729
|
-
|
|
1730
|
-
};
|
|
1731
|
-
const compileForBrowser = compile2?.browser ?? {
|
|
1732
|
-
src: {}
|
|
1733
|
-
};
|
|
1734
|
-
const compileForNeutral = compile2?.neutral ?? {
|
|
1735
|
-
src: {}
|
|
1736
|
-
};
|
|
1516
|
+
const compileForNode = compile2?.node ?? { src: {} };
|
|
1517
|
+
const compileForBrowser = compile2?.browser ?? { src: {} };
|
|
1518
|
+
const compileForNeutral = compile2?.neutral ?? { src: {} };
|
|
1737
1519
|
if (verbose) {
|
|
1738
1520
|
console.log("Calling packageCompileTscTypes");
|
|
1739
1521
|
}
|
|
@@ -1742,46 +1524,58 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1742
1524
|
if (errors > 0) {
|
|
1743
1525
|
return errors;
|
|
1744
1526
|
}
|
|
1745
|
-
return (await Promise.all(
|
|
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
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
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
|
+
};
|
|
1780
1574
|
|
|
1781
1575
|
// src/actions/package/compile/compile.ts
|
|
1782
|
-
var packageCompile =
|
|
1576
|
+
var packageCompile = async (inConfig = {}) => {
|
|
1783
1577
|
const pkg = process.env.INIT_CWD;
|
|
1784
|
-
console.log(
|
|
1578
|
+
console.log(chalk25.green(`Compiling ${pkg}`));
|
|
1785
1579
|
const config2 = await loadConfig(inConfig);
|
|
1786
1580
|
const publint2 = config2.publint;
|
|
1787
1581
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1789,30 +1583,24 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1789
1583
|
return tsupResults;
|
|
1790
1584
|
}
|
|
1791
1585
|
return publint2 ? await packagePublint(config2) : 0;
|
|
1792
|
-
}
|
|
1586
|
+
};
|
|
1793
1587
|
|
|
1794
1588
|
// src/actions/package/copy-assets.ts
|
|
1795
|
-
import
|
|
1796
|
-
import
|
|
1589
|
+
import path6 from "node:path/posix";
|
|
1590
|
+
import chalk26 from "chalk";
|
|
1797
1591
|
import cpy2 from "cpy";
|
|
1798
|
-
var copyTargetAssets2 =
|
|
1592
|
+
var copyTargetAssets2 = async (target, name, location) => {
|
|
1799
1593
|
try {
|
|
1800
|
-
const values = await cpy2(
|
|
1801
|
-
"**/*.jpg",
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
"**/*.gif",
|
|
1809
|
-
"**/*.css"
|
|
1810
|
-
], `../dist/${target}`, {
|
|
1811
|
-
cwd: path5.join(location, "src"),
|
|
1812
|
-
flat: false
|
|
1813
|
-
});
|
|
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
|
+
);
|
|
1814
1602
|
if (values.length > 0) {
|
|
1815
|
-
console.log(
|
|
1603
|
+
console.log(chalk26.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1816
1604
|
}
|
|
1817
1605
|
for (const value of values) {
|
|
1818
1606
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1823,8 +1611,8 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1823
1611
|
console.log(`Copy Assets Failed: ${name}: ${error.message}`);
|
|
1824
1612
|
return 1;
|
|
1825
1613
|
}
|
|
1826
|
-
}
|
|
1827
|
-
var packageCopyAssets =
|
|
1614
|
+
};
|
|
1615
|
+
var packageCopyAssets = async ({ target }) => {
|
|
1828
1616
|
const pkg = process.env.INIT_CWD ?? "./";
|
|
1829
1617
|
const pkgName = process.env.npm_package_name ?? "Unknown";
|
|
1830
1618
|
switch (target) {
|
|
@@ -1838,11 +1626,11 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1838
1626
|
return await copyTargetAssets2("esm", pkgName, pkg) || await copyTargetAssets2("cjs", pkgName, pkg);
|
|
1839
1627
|
}
|
|
1840
1628
|
}
|
|
1841
|
-
}
|
|
1629
|
+
};
|
|
1842
1630
|
|
|
1843
1631
|
// src/actions/package/cycle.ts
|
|
1844
1632
|
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1845
|
-
var packageCycle =
|
|
1633
|
+
var packageCycle = async ({ verbose = false }) => {
|
|
1846
1634
|
const pkg = process.env.INIT_CWD;
|
|
1847
1635
|
const pkgName = process.env.npm_package_name;
|
|
1848
1636
|
const cruiseOptions = {
|
|
@@ -1853,26 +1641,20 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1853
1641
|
severity: "error",
|
|
1854
1642
|
comment: "This dependency creates a circular reference",
|
|
1855
1643
|
from: {},
|
|
1856
|
-
to: {
|
|
1857
|
-
circular: true
|
|
1858
|
-
}
|
|
1644
|
+
to: { circular: true }
|
|
1859
1645
|
}
|
|
1860
1646
|
]
|
|
1861
1647
|
},
|
|
1862
1648
|
exclude: "node_modules|packages/.*/packages",
|
|
1863
1649
|
validate: true,
|
|
1864
|
-
doNotFollow: {
|
|
1865
|
-
path: "node_modules|packages/.*/packages"
|
|
1866
|
-
},
|
|
1650
|
+
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
1867
1651
|
tsPreCompilationDeps: false,
|
|
1868
1652
|
combinedDependencies: true,
|
|
1869
1653
|
outputType: verbose ? "text" : "err"
|
|
1870
1654
|
};
|
|
1871
1655
|
const target = `${pkg}/src`;
|
|
1872
1656
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1873
|
-
const result = await cruise2([
|
|
1874
|
-
target
|
|
1875
|
-
], cruiseOptions);
|
|
1657
|
+
const result = await cruise2([target], cruiseOptions);
|
|
1876
1658
|
if (result.output) {
|
|
1877
1659
|
console.log(result.output);
|
|
1878
1660
|
}
|
|
@@ -1882,13 +1664,18 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1882
1664
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
1883
1665
|
}
|
|
1884
1666
|
return result.exitCode;
|
|
1885
|
-
}
|
|
1667
|
+
};
|
|
1886
1668
|
|
|
1887
1669
|
// src/actions/package/gen-docs.ts
|
|
1888
1670
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1889
|
-
import
|
|
1890
|
-
import
|
|
1891
|
-
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";
|
|
1892
1679
|
var ExitCodes = {
|
|
1893
1680
|
CompileError: 3,
|
|
1894
1681
|
ExceptionThrown: 6,
|
|
@@ -1898,17 +1685,14 @@ var ExitCodes = {
|
|
|
1898
1685
|
OutputError: 5,
|
|
1899
1686
|
ValidationError: 4
|
|
1900
1687
|
};
|
|
1901
|
-
var packageGenDocs =
|
|
1688
|
+
var packageGenDocs = async () => {
|
|
1902
1689
|
const pkg = process.env.INIT_CWD;
|
|
1903
|
-
if (pkg && !existsSync5(
|
|
1690
|
+
if (pkg && !existsSync5(path7.join(pkg, "typedoc.json"))) {
|
|
1904
1691
|
return;
|
|
1905
1692
|
}
|
|
1906
1693
|
const app = await Application.bootstrap({
|
|
1907
1694
|
entryPointStrategy: "merge",
|
|
1908
|
-
entryPoints: [
|
|
1909
|
-
`${pkg}/src/**/*.ts`,
|
|
1910
|
-
`${pkg}/packages/*/dist/docs.json`
|
|
1911
|
-
],
|
|
1695
|
+
entryPoints: [`${pkg}/src/**/*.ts`, `${pkg}/packages/*/dist/docs.json`],
|
|
1912
1696
|
excludeExternals: true,
|
|
1913
1697
|
json: `${pkg}/dist/docs.json`,
|
|
1914
1698
|
logLevel: "Error",
|
|
@@ -1919,8 +1703,8 @@ var packageGenDocs = /* @__PURE__ */ __name(async () => {
|
|
|
1919
1703
|
app.options.addReader(new TSConfigReader());
|
|
1920
1704
|
app.options.addReader(new ArgumentsReader(300));
|
|
1921
1705
|
return await runTypeDoc(app);
|
|
1922
|
-
}
|
|
1923
|
-
var runTypeDoc =
|
|
1706
|
+
};
|
|
1707
|
+
var runTypeDoc = async (app) => {
|
|
1924
1708
|
const pkgName = process.env.npm_package_name;
|
|
1925
1709
|
if (app.options.getValue("version")) {
|
|
1926
1710
|
console.log(app.toString());
|
|
@@ -1989,40 +1773,37 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1989
1773
|
return ExitCodes.OutputError;
|
|
1990
1774
|
}
|
|
1991
1775
|
}
|
|
1992
|
-
console.log(
|
|
1776
|
+
console.log(chalk27.green(`${pkgName} - Ok`));
|
|
1993
1777
|
return ExitCodes.Ok;
|
|
1994
|
-
}
|
|
1778
|
+
};
|
|
1995
1779
|
|
|
1996
1780
|
// src/actions/package/lint.ts
|
|
1997
1781
|
import { readdirSync } from "node:fs";
|
|
1998
|
-
import
|
|
1782
|
+
import path8 from "node:path";
|
|
1999
1783
|
import { cwd as cwd3 } from "node:process";
|
|
2000
1784
|
import { pathToFileURL } from "node:url";
|
|
2001
|
-
import
|
|
1785
|
+
import chalk28 from "chalk";
|
|
2002
1786
|
import { ESLint } from "eslint";
|
|
2003
1787
|
import { findUp } from "find-up";
|
|
2004
1788
|
import picomatch from "picomatch";
|
|
2005
|
-
var dumpMessages =
|
|
2006
|
-
const colors = [
|
|
2007
|
-
|
|
2008
|
-
"yellow",
|
|
2009
|
-
"red"
|
|
2010
|
-
];
|
|
2011
|
-
const severity = [
|
|
2012
|
-
"none",
|
|
2013
|
-
"warning",
|
|
2014
|
-
"error"
|
|
2015
|
-
];
|
|
1789
|
+
var dumpMessages = (lintResults) => {
|
|
1790
|
+
const colors = ["white", "yellow", "red"];
|
|
1791
|
+
const severity = ["none", "warning", "error"];
|
|
2016
1792
|
for (const lintResult of lintResults) {
|
|
2017
1793
|
if (lintResult.messages.length > 0) {
|
|
2018
|
-
console.log(
|
|
1794
|
+
console.log(chalk28.gray(`
|
|
2019
1795
|
${lintResult.filePath}`));
|
|
2020
1796
|
for (const message of lintResult.messages) {
|
|
2021
|
-
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
|
+
);
|
|
2022
1803
|
}
|
|
2023
1804
|
}
|
|
2024
1805
|
}
|
|
2025
|
-
}
|
|
1806
|
+
};
|
|
2026
1807
|
async function getRootESLintConfig() {
|
|
2027
1808
|
const configPath = await findUp("eslint.config.mjs");
|
|
2028
1809
|
if (!configPath) {
|
|
@@ -2030,50 +1811,33 @@ async function getRootESLintConfig() {
|
|
|
2030
1811
|
}
|
|
2031
1812
|
return pathToFileURL(configPath);
|
|
2032
1813
|
}
|
|
2033
|
-
__name(getRootESLintConfig, "getRootESLintConfig");
|
|
2034
1814
|
function getFiles(dir, ignoreFolders) {
|
|
2035
1815
|
const currentDirectory = cwd3();
|
|
2036
1816
|
const subDirectory = dir.split(currentDirectory)[1];
|
|
2037
1817
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2038
|
-
return readdirSync(dir, {
|
|
2039
|
-
|
|
2040
|
-
}).flatMap((dirent) => {
|
|
2041
|
-
const res = path7.resolve(dir, dirent.name);
|
|
1818
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
1819
|
+
const res = path8.resolve(dir, dirent.name);
|
|
2042
1820
|
const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name;
|
|
2043
1821
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
2044
1822
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
2045
|
-
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
|
|
2046
|
-
res
|
|
2047
|
-
];
|
|
1823
|
+
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [res];
|
|
2048
1824
|
});
|
|
2049
1825
|
}
|
|
2050
|
-
|
|
2051
|
-
var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, cache = true) => {
|
|
1826
|
+
var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
2052
1827
|
const pkg = process.env.INIT_CWD;
|
|
2053
1828
|
const configPath = await getRootESLintConfig();
|
|
2054
1829
|
const { default: eslintConfig } = await import(configPath.href);
|
|
2055
1830
|
const start = Date.now();
|
|
2056
|
-
const ignoreFolders = [
|
|
2057
|
-
"node_modules",
|
|
2058
|
-
"dist",
|
|
2059
|
-
"packages",
|
|
2060
|
-
".git",
|
|
2061
|
-
"build",
|
|
2062
|
-
".yarn",
|
|
2063
|
-
".vscode",
|
|
2064
|
-
".github"
|
|
2065
|
-
];
|
|
1831
|
+
const ignoreFolders = ["node_modules", "dist", "packages", ".git", "build", ".yarn", ".vscode", ".github"];
|
|
2066
1832
|
const engine = new ESLint({
|
|
2067
|
-
baseConfig: [
|
|
2068
|
-
...eslintConfig
|
|
2069
|
-
],
|
|
1833
|
+
baseConfig: [...eslintConfig],
|
|
2070
1834
|
fix: fix2,
|
|
2071
1835
|
warnIgnored: false,
|
|
2072
1836
|
cache
|
|
2073
1837
|
});
|
|
2074
1838
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
2075
1839
|
if (verbose) {
|
|
2076
|
-
console.log(
|
|
1840
|
+
console.log(chalk28.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2077
1841
|
}
|
|
2078
1842
|
const lintResults = await engine.lintFiles(files);
|
|
2079
1843
|
dumpMessages(lintResults);
|
|
@@ -2083,75 +1847,43 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2083
1847
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2084
1848
|
const lintTime = Date.now() - start;
|
|
2085
1849
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2086
|
-
console.log(
|
|
1850
|
+
console.log(chalk28.white(`Linted ${chalk28[filesCountColor](files.length)} files in ${chalk28[lintTimeColor](lintTime)}ms`));
|
|
2087
1851
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2088
|
-
}
|
|
1852
|
+
};
|
|
2089
1853
|
|
|
2090
1854
|
// src/actions/package/recompile.ts
|
|
2091
|
-
var packageRecompile =
|
|
1855
|
+
var packageRecompile = async () => {
|
|
2092
1856
|
return await packageClean() || await packageCompile();
|
|
2093
|
-
}
|
|
1857
|
+
};
|
|
2094
1858
|
|
|
2095
1859
|
// src/actions/publint.ts
|
|
2096
|
-
var publint =
|
|
2097
|
-
return pkg ? await publintPackage({
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
[
|
|
2107
|
-
"yarn",
|
|
2108
|
-
[
|
|
2109
|
-
"workspace",
|
|
2110
|
-
pkg,
|
|
2111
|
-
"run",
|
|
2112
|
-
"package-publint"
|
|
2113
|
-
]
|
|
2114
|
-
]
|
|
2115
|
-
]);
|
|
2116
|
-
}, "publintPackage");
|
|
2117
|
-
var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
2118
|
-
const verboseOptions = verbose ? [
|
|
2119
|
-
"--verbose"
|
|
2120
|
-
] : [
|
|
2121
|
-
"--no-verbose"
|
|
2122
|
-
];
|
|
2123
|
-
return runSteps("Publint", [
|
|
2124
|
-
[
|
|
2125
|
-
"yarn",
|
|
2126
|
-
[
|
|
2127
|
-
"workspaces",
|
|
2128
|
-
"foreach",
|
|
2129
|
-
"-pA",
|
|
2130
|
-
...verboseOptions,
|
|
2131
|
-
"run",
|
|
2132
|
-
"package-publint"
|
|
2133
|
-
]
|
|
2134
|
-
]
|
|
2135
|
-
]);
|
|
2136
|
-
}, "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
|
+
};
|
|
2137
1870
|
|
|
2138
1871
|
// src/actions/rebuild.ts
|
|
2139
|
-
var rebuild =
|
|
1872
|
+
var rebuild = ({ target }) => {
|
|
2140
1873
|
return runSteps("Rebuild", [
|
|
2141
|
-
[
|
|
2142
|
-
|
|
2143
|
-
"xy clean"
|
|
2144
|
-
],
|
|
2145
|
-
[
|
|
2146
|
-
"yarn",
|
|
2147
|
-
target ? `xy build -t ${target}` : "xy build"
|
|
2148
|
-
]
|
|
1874
|
+
["yarn", "xy clean"],
|
|
1875
|
+
["yarn", target ? `xy build -t ${target}` : "xy build"]
|
|
2149
1876
|
]);
|
|
2150
|
-
}
|
|
1877
|
+
};
|
|
2151
1878
|
|
|
2152
1879
|
// src/actions/recompile.ts
|
|
2153
|
-
import
|
|
2154
|
-
var recompile =
|
|
1880
|
+
import chalk29 from "chalk";
|
|
1881
|
+
var recompile = async ({
|
|
1882
|
+
verbose,
|
|
1883
|
+
target,
|
|
1884
|
+
pkg,
|
|
1885
|
+
incremental
|
|
1886
|
+
}) => {
|
|
2155
1887
|
return pkg ? await recompilePackage({
|
|
2156
1888
|
pkg,
|
|
2157
1889
|
target,
|
|
@@ -2161,51 +1893,27 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
|
|
|
2161
1893
|
target,
|
|
2162
1894
|
verbose
|
|
2163
1895
|
});
|
|
2164
|
-
}
|
|
2165
|
-
var recompilePackage =
|
|
2166
|
-
const targetOptions = target ? [
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
...targetOptions
|
|
2179
|
-
]
|
|
2180
|
-
]
|
|
2181
|
-
]);
|
|
2182
|
-
}, "recompilePackage");
|
|
2183
|
-
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
|
+
}) => {
|
|
2184
1910
|
const start = Date.now();
|
|
2185
|
-
const verboseOptions = verbose ? [
|
|
2186
|
-
|
|
2187
|
-
] : [
|
|
2188
|
-
|
|
2189
|
-
];
|
|
2190
|
-
const targetOptions = target ? [
|
|
2191
|
-
"-t",
|
|
2192
|
-
target
|
|
2193
|
-
] : [];
|
|
2194
|
-
const incrementalOptions = incremental ? [
|
|
2195
|
-
"--since",
|
|
2196
|
-
"-Apt",
|
|
2197
|
-
"--topological-dev"
|
|
2198
|
-
] : [
|
|
2199
|
-
"--parallel",
|
|
2200
|
-
"-Apt",
|
|
2201
|
-
"--topological-dev"
|
|
2202
|
-
];
|
|
2203
|
-
const jobsOptions = jobs ? [
|
|
2204
|
-
"-j",
|
|
2205
|
-
`${jobs}`
|
|
2206
|
-
] : [];
|
|
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}`] : [];
|
|
2207
1915
|
if (jobs) {
|
|
2208
|
-
console.log(
|
|
1916
|
+
console.log(chalk29.blue(`Jobs set to [${jobs}]`));
|
|
2209
1917
|
}
|
|
2210
1918
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2211
1919
|
[
|
|
@@ -2235,13 +1943,19 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2235
1943
|
]
|
|
2236
1944
|
]
|
|
2237
1945
|
]);
|
|
2238
|
-
console.log(
|
|
1946
|
+
console.log(
|
|
1947
|
+
`${chalk29.gray("Recompiled in")} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`
|
|
1948
|
+
);
|
|
2239
1949
|
return result;
|
|
2240
|
-
}
|
|
1950
|
+
};
|
|
2241
1951
|
|
|
2242
1952
|
// src/actions/reinstall.ts
|
|
2243
|
-
import {
|
|
2244
|
-
|
|
1953
|
+
import {
|
|
1954
|
+
closeSync,
|
|
1955
|
+
openSync,
|
|
1956
|
+
rmSync
|
|
1957
|
+
} from "node:fs";
|
|
1958
|
+
var reinstall = () => {
|
|
2245
1959
|
console.log("Reinstall [Clear Lock File]");
|
|
2246
1960
|
closeSync(openSync("./yarn.lock", "w"));
|
|
2247
1961
|
console.log("Reinstall [Clear Node Modules]");
|
|
@@ -2249,10 +1963,7 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2249
1963
|
const result = workspaces.map(({ location, name }) => {
|
|
2250
1964
|
const dist = `${location}/node_modules`;
|
|
2251
1965
|
try {
|
|
2252
|
-
rmSync(dist, {
|
|
2253
|
-
force: true,
|
|
2254
|
-
recursive: true
|
|
2255
|
-
});
|
|
1966
|
+
rmSync(dist, { force: true, recursive: true });
|
|
2256
1967
|
return 0;
|
|
2257
1968
|
} catch (ex) {
|
|
2258
1969
|
const error = ex;
|
|
@@ -2260,546 +1971,591 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2260
1971
|
return 1;
|
|
2261
1972
|
}
|
|
2262
1973
|
}).reduce((prev, result2) => prev || result2, 0);
|
|
2263
|
-
return result || runSteps("Reinstall", [
|
|
2264
|
-
|
|
2265
|
-
"yarn",
|
|
2266
|
-
"install --network-timeout 10000"
|
|
2267
|
-
]
|
|
2268
|
-
]);
|
|
2269
|
-
}, "reinstall");
|
|
1974
|
+
return result || runSteps("Reinstall", [["yarn", "install --network-timeout 10000"]]);
|
|
1975
|
+
};
|
|
2270
1976
|
|
|
2271
1977
|
// src/actions/relint.ts
|
|
2272
|
-
import
|
|
2273
|
-
var relintPackage =
|
|
2274
|
-
console.log(
|
|
1978
|
+
import chalk30 from "chalk";
|
|
1979
|
+
var relintPackage = ({ pkg }) => {
|
|
1980
|
+
console.log(chalk30.gray(`${"Relint"} [All-Packages]`));
|
|
2275
1981
|
const start = Date.now();
|
|
2276
1982
|
const result = runSteps("Relint [All-Packages]", [
|
|
2277
|
-
[
|
|
2278
|
-
"
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
"package-relint"
|
|
2284
|
-
]
|
|
2285
|
-
]
|
|
1983
|
+
["yarn", [
|
|
1984
|
+
"workspace",
|
|
1985
|
+
pkg,
|
|
1986
|
+
"run",
|
|
1987
|
+
"package-relint"
|
|
1988
|
+
]]
|
|
2286
1989
|
]);
|
|
2287
|
-
console.log(
|
|
1990
|
+
console.log(chalk30.gray(`${"Relinted in"} [${chalk30.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk30.gray("seconds")}`));
|
|
2288
1991
|
return result;
|
|
2289
|
-
}
|
|
2290
|
-
var relint =
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
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]`));
|
|
2300
2002
|
const start = Date.now();
|
|
2301
|
-
const verboseOptions = verbose ? [
|
|
2302
|
-
|
|
2303
|
-
] : [
|
|
2304
|
-
"--no-verbose"
|
|
2305
|
-
];
|
|
2306
|
-
const incrementalOptions = incremental ? [
|
|
2307
|
-
"--since",
|
|
2308
|
-
"-Ap"
|
|
2309
|
-
] : [
|
|
2310
|
-
"--parallel",
|
|
2311
|
-
"-Ap"
|
|
2312
|
-
];
|
|
2003
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2004
|
+
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
2313
2005
|
const result = runSteps(`${"Relint"} [All-Packages]`, [
|
|
2314
|
-
[
|
|
2315
|
-
"
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
"package-relint"
|
|
2323
|
-
]
|
|
2324
|
-
]
|
|
2006
|
+
["yarn", [
|
|
2007
|
+
"workspaces",
|
|
2008
|
+
"foreach",
|
|
2009
|
+
...verboseOptions,
|
|
2010
|
+
...incrementalOptions,
|
|
2011
|
+
"run",
|
|
2012
|
+
"package-relint"
|
|
2013
|
+
]]
|
|
2325
2014
|
]);
|
|
2326
|
-
console.log(
|
|
2015
|
+
console.log(chalk30.gray(`Relinted in [${chalk30.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk30.gray("seconds")}`));
|
|
2327
2016
|
return result;
|
|
2328
|
-
}
|
|
2017
|
+
};
|
|
2329
2018
|
|
|
2330
2019
|
// src/actions/retest.ts
|
|
2331
|
-
var retest =
|
|
2020
|
+
var retest = () => {
|
|
2332
2021
|
return runSteps("Test", [
|
|
2333
|
-
[
|
|
2334
|
-
|
|
2335
|
-
[
|
|
2336
|
-
"jest",
|
|
2337
|
-
"--clearCache"
|
|
2338
|
-
]
|
|
2339
|
-
],
|
|
2340
|
-
[
|
|
2341
|
-
"yarn",
|
|
2342
|
-
[
|
|
2343
|
-
"jest",
|
|
2344
|
-
"."
|
|
2345
|
-
]
|
|
2346
|
-
]
|
|
2022
|
+
["yarn", ["jest", "--clearCache"]],
|
|
2023
|
+
["yarn", ["jest", "."]]
|
|
2347
2024
|
]);
|
|
2348
|
-
}
|
|
2025
|
+
};
|
|
2349
2026
|
|
|
2350
2027
|
// src/actions/sonar.ts
|
|
2351
|
-
var sonar =
|
|
2352
|
-
return runSteps("Sonar", [
|
|
2353
|
-
|
|
2354
|
-
"yarn",
|
|
2355
|
-
[
|
|
2356
|
-
"eslint",
|
|
2357
|
-
"-c",
|
|
2358
|
-
"sonar.eslintrc",
|
|
2359
|
-
"."
|
|
2360
|
-
]
|
|
2361
|
-
]
|
|
2362
|
-
]);
|
|
2363
|
-
}, "sonar");
|
|
2028
|
+
var sonar = () => {
|
|
2029
|
+
return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
|
|
2030
|
+
};
|
|
2364
2031
|
|
|
2365
2032
|
// src/actions/statics.ts
|
|
2366
|
-
import
|
|
2367
|
-
var DefaultDependencies = [
|
|
2368
|
-
|
|
2369
|
-
"
|
|
2370
|
-
"react",
|
|
2371
|
-
"graphql",
|
|
2372
|
-
"react-router",
|
|
2373
|
-
"@mui/material",
|
|
2374
|
-
"@mui/system"
|
|
2375
|
-
];
|
|
2376
|
-
var statics = /* @__PURE__ */ __name(() => {
|
|
2377
|
-
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"));
|
|
2378
2037
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2379
2038
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2380
|
-
}
|
|
2039
|
+
};
|
|
2381
2040
|
|
|
2382
2041
|
// src/actions/test.ts
|
|
2383
|
-
var test =
|
|
2384
|
-
return runSteps("Test", [
|
|
2385
|
-
|
|
2386
|
-
"yarn",
|
|
2387
|
-
[
|
|
2388
|
-
"vitest",
|
|
2389
|
-
"."
|
|
2390
|
-
]
|
|
2391
|
-
]
|
|
2392
|
-
]);
|
|
2393
|
-
}, "test");
|
|
2042
|
+
var test = () => {
|
|
2043
|
+
return runSteps("Test", [["yarn", ["vitest", "."]]]);
|
|
2044
|
+
};
|
|
2394
2045
|
|
|
2395
2046
|
// src/actions/up.ts
|
|
2396
|
-
var up =
|
|
2397
|
-
return runSteps("Up", [
|
|
2398
|
-
|
|
2399
|
-
"yarn",
|
|
2400
|
-
"outdated"
|
|
2401
|
-
]
|
|
2402
|
-
]);
|
|
2403
|
-
}, "up");
|
|
2047
|
+
var up = () => {
|
|
2048
|
+
return runSteps("Up", [["yarn", "outdated"]]);
|
|
2049
|
+
};
|
|
2404
2050
|
|
|
2405
2051
|
// src/actions/updo.ts
|
|
2406
|
-
var updo =
|
|
2052
|
+
var updo = () => {
|
|
2407
2053
|
return runSteps("Updo", [
|
|
2408
|
-
[
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
],
|
|
2412
|
-
[
|
|
2413
|
-
"yarn",
|
|
2414
|
-
"upgrade-interactive"
|
|
2415
|
-
],
|
|
2416
|
-
[
|
|
2417
|
-
"yarn",
|
|
2418
|
-
"dedupe"
|
|
2419
|
-
]
|
|
2054
|
+
["yarn", "install"],
|
|
2055
|
+
["yarn", "upgrade-interactive"],
|
|
2056
|
+
["yarn", "dedupe"]
|
|
2420
2057
|
]);
|
|
2421
|
-
}
|
|
2058
|
+
};
|
|
2422
2059
|
|
|
2423
2060
|
// src/actions/upplug.ts
|
|
2424
|
-
var updateYarnPlugins =
|
|
2061
|
+
var updateYarnPlugins = () => {
|
|
2425
2062
|
return runSteps("Update Yarn Plugins", [
|
|
2426
|
-
[
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
"import",
|
|
2431
|
-
"https://mskelton.dev/yarn-outdated/v3"
|
|
2432
|
-
]
|
|
2433
|
-
],
|
|
2434
|
-
[
|
|
2435
|
-
"yarn",
|
|
2436
|
-
[
|
|
2437
|
-
"plugin",
|
|
2438
|
-
"import",
|
|
2439
|
-
"version"
|
|
2440
|
-
]
|
|
2441
|
-
],
|
|
2442
|
-
[
|
|
2443
|
-
"yarn",
|
|
2444
|
-
[
|
|
2445
|
-
"plugin",
|
|
2446
|
-
"import",
|
|
2447
|
-
"interactive-tools"
|
|
2448
|
-
]
|
|
2449
|
-
],
|
|
2450
|
-
[
|
|
2451
|
-
"yarn",
|
|
2452
|
-
[
|
|
2453
|
-
"plugin",
|
|
2454
|
-
"import",
|
|
2455
|
-
"workspace-tools"
|
|
2456
|
-
]
|
|
2457
|
-
]
|
|
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"]]
|
|
2458
2067
|
]);
|
|
2459
|
-
}
|
|
2068
|
+
};
|
|
2460
2069
|
|
|
2461
2070
|
// src/actions/upyarn.ts
|
|
2462
|
-
var updateYarnVersion =
|
|
2463
|
-
return runSteps("Update Yarn Version", [
|
|
2464
|
-
|
|
2465
|
-
"yarn",
|
|
2466
|
-
[
|
|
2467
|
-
"set",
|
|
2468
|
-
"version",
|
|
2469
|
-
"latest"
|
|
2470
|
-
]
|
|
2471
|
-
]
|
|
2472
|
-
]);
|
|
2473
|
-
}, "updateYarnVersion");
|
|
2071
|
+
var updateYarnVersion = () => {
|
|
2072
|
+
return runSteps("Update Yarn Version", [["yarn", ["set", "version", "latest"]]]);
|
|
2073
|
+
};
|
|
2474
2074
|
|
|
2475
2075
|
// src/actions/yarn3only.ts
|
|
2476
|
-
var yarn3Only =
|
|
2076
|
+
var yarn3Only = () => {
|
|
2477
2077
|
const [valid, version] = isYarnVersionOrGreater(3);
|
|
2478
2078
|
if (!valid) {
|
|
2479
2079
|
processEx(`Invalid Yarn version [${version}]`);
|
|
2480
2080
|
}
|
|
2481
2081
|
return 0;
|
|
2482
|
-
}
|
|
2082
|
+
};
|
|
2483
2083
|
|
|
2484
2084
|
// src/loadPackageConfig.ts
|
|
2485
2085
|
import { readFile } from "node:fs/promises";
|
|
2486
|
-
var loadPackageConfig =
|
|
2086
|
+
var loadPackageConfig = async () => {
|
|
2487
2087
|
const pkg = process.env.INIT_CWD;
|
|
2488
|
-
const pkgConfig = await readFile(`${pkg}/package.json`, {
|
|
2489
|
-
encoding: "utf8"
|
|
2490
|
-
});
|
|
2088
|
+
const pkgConfig = await readFile(`${pkg}/package.json`, { encoding: "utf8" });
|
|
2491
2089
|
return JSON.parse(pkgConfig);
|
|
2492
|
-
}
|
|
2090
|
+
};
|
|
2493
2091
|
|
|
2494
2092
|
// src/xy/xy.ts
|
|
2495
|
-
import
|
|
2093
|
+
import chalk33 from "chalk";
|
|
2496
2094
|
|
|
2497
2095
|
// src/xy/xyBuildCommands.ts
|
|
2498
|
-
var xyBuildCommands =
|
|
2499
|
-
return args.command(
|
|
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
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
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
|
+
};
|
|
2594
2209
|
|
|
2595
2210
|
// src/xy/param.ts
|
|
2596
|
-
var packagePositionalParam =
|
|
2597
|
-
return yargs2.positional("package", {
|
|
2598
|
-
|
|
2599
|
-
});
|
|
2600
|
-
}, "packagePositionalParam");
|
|
2211
|
+
var packagePositionalParam = (yargs2) => {
|
|
2212
|
+
return yargs2.positional("package", { describe: "Specific package to target" });
|
|
2213
|
+
};
|
|
2601
2214
|
|
|
2602
2215
|
// src/xy/xyCommonCommands.ts
|
|
2603
|
-
var xyCommonCommands =
|
|
2604
|
-
return args.command(
|
|
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
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
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
|
+
};
|
|
2667
2337
|
|
|
2668
2338
|
// src/xy/xyDeployCommands.ts
|
|
2669
|
-
var xyDeployCommands =
|
|
2670
|
-
return args.command(
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
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
|
+
};
|
|
2692
2382
|
|
|
2693
2383
|
// src/xy/xyInstallCommands.ts
|
|
2694
|
-
var xyInstallCommands =
|
|
2695
|
-
return args.command(
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
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
|
+
});
|
|
2702
2399
|
}
|
|
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
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
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
|
+
};
|
|
2734
2452
|
|
|
2735
2453
|
// src/xy/xyLintCommands.ts
|
|
2736
|
-
import
|
|
2737
|
-
var xyLintCommands =
|
|
2738
|
-
return args.command(
|
|
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
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
}
|
|
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
|
+
};
|
|
2798
2554
|
|
|
2799
2555
|
// src/xy/xyParseOptions.ts
|
|
2800
2556
|
import yargs from "yargs";
|
|
2801
2557
|
import { hideBin } from "yargs/helpers";
|
|
2802
|
-
var xyParseOptions =
|
|
2558
|
+
var xyParseOptions = () => {
|
|
2803
2559
|
return yargs(hideBin(process.argv)).scriptName("yarn xy").option("jobs", {
|
|
2804
2560
|
alias: "j",
|
|
2805
2561
|
default: void 0,
|
|
@@ -2813,10 +2569,7 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2813
2569
|
}).option("target", {
|
|
2814
2570
|
alias: "t",
|
|
2815
2571
|
default: "esm",
|
|
2816
|
-
choices: [
|
|
2817
|
-
"esm",
|
|
2818
|
-
"cjs"
|
|
2819
|
-
],
|
|
2572
|
+
choices: ["esm", "cjs"],
|
|
2820
2573
|
description: "Limit output to specific target",
|
|
2821
2574
|
type: "string"
|
|
2822
2575
|
}).option("incremental", {
|
|
@@ -2841,23 +2594,20 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2841
2594
|
type: "boolean"
|
|
2842
2595
|
}).option("types", {
|
|
2843
2596
|
default: "tsc",
|
|
2844
|
-
choices: [
|
|
2845
|
-
"tsc",
|
|
2846
|
-
"tsup"
|
|
2847
|
-
],
|
|
2597
|
+
choices: ["tsc", "tsup"],
|
|
2848
2598
|
description: "Tool to generate Typescript types",
|
|
2849
2599
|
type: "string"
|
|
2850
2600
|
});
|
|
2851
|
-
}
|
|
2601
|
+
};
|
|
2852
2602
|
|
|
2853
2603
|
// src/xy/xy.ts
|
|
2854
|
-
var xy =
|
|
2604
|
+
var xy = async () => {
|
|
2855
2605
|
const options = xyParseOptions();
|
|
2856
2606
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2857
|
-
console.error(
|
|
2858
|
-
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"));
|
|
2859
2609
|
}).version().help().argv;
|
|
2860
|
-
}
|
|
2610
|
+
};
|
|
2861
2611
|
export {
|
|
2862
2612
|
CROSS_PLATFORM_NEWLINE,
|
|
2863
2613
|
DuplicateDetector,
|
|
@@ -2884,6 +2634,7 @@ export {
|
|
|
2884
2634
|
defaultBuildConfig,
|
|
2885
2635
|
defaultReadFileSyncOptions,
|
|
2886
2636
|
deleteGlob,
|
|
2637
|
+
deplint,
|
|
2887
2638
|
deploy,
|
|
2888
2639
|
deployMajor,
|
|
2889
2640
|
deployMinor,
|