@xylabs/ts-scripts-yarn3 6.3.5 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/build.mjs +39 -87
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-docs.mjs +8 -22
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs +5 -11
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs +16 -29
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +32 -63
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile-types.mjs +45 -68
- package/dist/actions/compile-types.mjs.map +1 -1
- package/dist/actions/compile.mjs +50 -76
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs +23 -38
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.mjs +28 -57
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs +16 -31
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint.mjs +195 -0
- package/dist/actions/deplint.mjs.map +1 -0
- package/dist/actions/deploy-major.mjs +20 -41
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +20 -41
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +20 -41
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +20 -41
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +26 -37
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs +36 -54
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +25 -65
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +28 -44
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +5 -14
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +4 -7
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +864 -1241
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +16 -31
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +37 -51
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +33 -48
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +28 -44
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +6 -16
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +6 -16
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +12 -29
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +7 -17
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +133 -169
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +43 -59
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +20 -23
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/deepMerge.mjs +0 -5
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +11 -10
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +133 -169
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +3 -8
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +127 -163
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +12 -21
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +5 -14
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs +11 -12
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs +191 -271
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +16 -39
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/publint.mjs +4 -7
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +147 -197
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +37 -71
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +17 -29
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +50 -67
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +25 -43
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +40 -63
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +17 -35
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +16 -32
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +27 -46
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs +16 -30
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +16 -27
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +18 -33
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +19 -53
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +16 -31
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +12 -23
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +134 -172
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +134 -172
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +6 -15
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +6 -15
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +12 -28
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +134 -172
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +128 -165
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +44 -61
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +134 -171
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +13 -23
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +13 -23
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +6 -16
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +16 -38
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs +11 -11
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +16 -38
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +4 -6
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +147 -196
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +16 -38
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +1086 -1237
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1338 -1583
- package/dist/index.mjs.map +1 -1
- package/dist/lib/checkResult.mjs +2 -5
- package/dist/lib/checkResult.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +9 -24
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/defaultBuildConfig.mjs +2 -6
- package/dist/lib/defaultBuildConfig.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs +3 -9
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +12 -23
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +22 -33
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +22 -33
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +1 -3
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/constants.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs +12 -13
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs +14 -15
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs +3 -8
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +27 -43
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +100 -154
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/jsonFormatters.mjs +2 -5
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +4 -8
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +2 -5
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/processEx.mjs +6 -9
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.mjs +13 -19
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +22 -22
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs +19 -31
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/runXyWithWarning.mjs +2 -5
- package/dist/lib/runXyWithWarning.mjs.map +1 -1
- package/dist/lib/safeExit.mjs +10 -13
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/string/empty.mjs +2 -5
- package/dist/lib/string/empty.mjs.map +1 -1
- package/dist/lib/string/index.mjs +3 -9
- package/dist/lib/string/index.mjs.map +1 -1
- package/dist/lib/string/union.mjs +1 -7
- package/dist/lib/string/union.mjs.map +1 -1
- package/dist/lib/withErrnoException.mjs +4 -7
- package/dist/lib/withErrnoException.mjs.map +1 -1
- package/dist/lib/withError.mjs +2 -5
- package/dist/lib/withError.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +11 -30
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +4 -15
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs +5 -16
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +5 -16
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +3 -14
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/lib/yarn/yarnInitCwd.mjs +2 -5
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
- package/dist/loadPackageConfig.mjs +3 -8
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/index.mjs +1086 -1238
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +3 -8
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +1086 -1238
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +276 -382
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +251 -335
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +84 -130
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +145 -193
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +413 -292
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +4 -13
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +3 -22
package/dist/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,303 @@ 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
|
+
peerDeps = false
|
|
840
|
+
}) {
|
|
841
|
+
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
842
|
+
const {
|
|
843
|
+
prodImportPaths,
|
|
844
|
+
devImportPaths,
|
|
845
|
+
externalProdImports,
|
|
846
|
+
externalDevImports
|
|
847
|
+
} = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
848
|
+
const {
|
|
849
|
+
dependencies,
|
|
850
|
+
devDependencies,
|
|
851
|
+
peerDependencies
|
|
852
|
+
} = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
853
|
+
let unlistedDependencies = 0;
|
|
854
|
+
let unlistedDevDependencies = 0;
|
|
855
|
+
let unusedDependencies = 0;
|
|
856
|
+
for (const imp of externalProdImports) {
|
|
857
|
+
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
858
|
+
unlistedDependencies++;
|
|
859
|
+
console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
|
|
860
|
+
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
861
|
+
console.log("");
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
for (const dep of dependencies) {
|
|
865
|
+
if (!externalProdImports.includes(dep)) {
|
|
866
|
+
unusedDependencies++;
|
|
867
|
+
console.log(`[${chalk14.blue(name)}] Unused dependency in package.json: ${chalk14.red(dep)}`);
|
|
868
|
+
console.log(` ${location}/package.json
|
|
869
|
+
`);
|
|
870
|
+
console.log("");
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
if (peerDeps) {
|
|
874
|
+
for (const dep of peerDependencies) {
|
|
875
|
+
if (!externalProdImports.includes(dep)) {
|
|
876
|
+
unusedDependencies++;
|
|
877
|
+
console.log(`[${chalk14.blue(name)}] Unused peerDependency in package.json: ${chalk14.red(dep)}`);
|
|
878
|
+
console.log(` ${location}/package.json
|
|
879
|
+
`);
|
|
880
|
+
console.log("");
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (devDeps) {
|
|
885
|
+
for (const imp of externalDevImports) {
|
|
886
|
+
if (!devDependencies.includes(imp)) {
|
|
887
|
+
unlistedDevDependencies++;
|
|
888
|
+
console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
|
|
889
|
+
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies;
|
|
894
|
+
return totalErrors;
|
|
895
|
+
}
|
|
896
|
+
var deplint = ({ pkg }) => {
|
|
897
|
+
if (pkg) {
|
|
898
|
+
const { location, name } = yarnWorkspace(pkg);
|
|
899
|
+
console.log(`Running Deplint for ${name}`);
|
|
900
|
+
check({
|
|
901
|
+
name,
|
|
902
|
+
location,
|
|
903
|
+
devDeps: true
|
|
904
|
+
});
|
|
905
|
+
} else {
|
|
906
|
+
const workspaces = yarnWorkspaces();
|
|
907
|
+
console.log("Deplint Started...");
|
|
908
|
+
let totalErrors = 0;
|
|
909
|
+
for (const workspace of workspaces) {
|
|
910
|
+
totalErrors += check(workspace);
|
|
911
|
+
}
|
|
912
|
+
if (totalErrors > 0) {
|
|
913
|
+
console.log(`Found ${chalk14.red(totalErrors)} unlisted imports.`);
|
|
914
|
+
} else {
|
|
915
|
+
console.log(`No unlisted imports found. ${chalk14.green("\u2714")}`);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return 0;
|
|
919
|
+
};
|
|
955
920
|
|
|
956
921
|
// src/actions/deploy.ts
|
|
957
|
-
var deploy =
|
|
922
|
+
var deploy = () => {
|
|
958
923
|
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
|
-
]
|
|
924
|
+
["yarn", "workspaces foreach --all version patch --deferred"],
|
|
925
|
+
["yarn", "xy clean"],
|
|
926
|
+
["yarn", "xy build"],
|
|
927
|
+
["yarn", "version apply --all"],
|
|
928
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
979
929
|
]);
|
|
980
|
-
}
|
|
930
|
+
};
|
|
981
931
|
|
|
982
932
|
// src/actions/deploy-major.ts
|
|
983
|
-
var deployMajor =
|
|
933
|
+
var deployMajor = () => {
|
|
984
934
|
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
|
-
]
|
|
935
|
+
["yarn", "workspaces foreach --all version major --deferred"],
|
|
936
|
+
["yarn", "xy clean"],
|
|
937
|
+
["yarn", "xy build"],
|
|
938
|
+
["yarn", "version apply --all"],
|
|
939
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
1005
940
|
]);
|
|
1006
|
-
}
|
|
941
|
+
};
|
|
1007
942
|
|
|
1008
943
|
// src/actions/deploy-minor.ts
|
|
1009
|
-
var deployMinor =
|
|
944
|
+
var deployMinor = () => {
|
|
1010
945
|
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
|
-
]
|
|
946
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
947
|
+
["yarn", "xy clean"],
|
|
948
|
+
["yarn", "xy build"],
|
|
949
|
+
["yarn", "version apply --all"],
|
|
950
|
+
["yarn", "workspaces foreach --all --parallel npm publish"]
|
|
1031
951
|
]);
|
|
1032
|
-
}
|
|
952
|
+
};
|
|
1033
953
|
|
|
1034
954
|
// src/actions/deploy-next.ts
|
|
1035
|
-
var deployNext =
|
|
955
|
+
var deployNext = () => {
|
|
1036
956
|
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
|
-
]
|
|
957
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
958
|
+
["yarn", "xy clean"],
|
|
959
|
+
["yarn", "xy build"],
|
|
960
|
+
["yarn", "version apply --all --prerelease"],
|
|
961
|
+
["yarn", "workspaces foreach --all --parallel npm publish --tag next"]
|
|
1057
962
|
]);
|
|
1058
|
-
}
|
|
963
|
+
};
|
|
1059
964
|
|
|
1060
965
|
// src/actions/dupdeps.ts
|
|
1061
|
-
import
|
|
1062
|
-
var dupdeps =
|
|
1063
|
-
console.log(
|
|
966
|
+
import chalk15 from "chalk";
|
|
967
|
+
var dupdeps = () => {
|
|
968
|
+
console.log(chalk15.green("Checking all Dependencies for Duplicates"));
|
|
1064
969
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1065
970
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1066
971
|
return detectDuplicateDependencies(dependencies);
|
|
1067
|
-
}
|
|
972
|
+
};
|
|
1068
973
|
|
|
1069
974
|
// src/actions/lint.ts
|
|
1070
|
-
import
|
|
1071
|
-
var lintPackage =
|
|
1072
|
-
console.log(
|
|
975
|
+
import chalk16 from "chalk";
|
|
976
|
+
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
977
|
+
console.log(chalk16.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1073
978
|
const start = Date.now();
|
|
1074
979
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1075
|
-
[
|
|
1076
|
-
"
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
fix2 ? "package-fix" : "package-lint"
|
|
1082
|
-
]
|
|
1083
|
-
]
|
|
980
|
+
["yarn", [
|
|
981
|
+
"workspace",
|
|
982
|
+
pkg,
|
|
983
|
+
"run",
|
|
984
|
+
fix2 ? "package-fix" : "package-lint"
|
|
985
|
+
]]
|
|
1084
986
|
]);
|
|
1085
|
-
console.log(
|
|
987
|
+
console.log(chalk16.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk16.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk16.gray("seconds")}`));
|
|
1086
988
|
return result;
|
|
1087
|
-
}
|
|
1088
|
-
var lint =
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
989
|
+
};
|
|
990
|
+
var lint = ({
|
|
991
|
+
pkg,
|
|
992
|
+
verbose,
|
|
993
|
+
incremental,
|
|
994
|
+
fix: fix2
|
|
995
|
+
} = {}) => {
|
|
996
|
+
return pkg ? lintPackage({ pkg, fix: fix2 }) : lintAllPackages({
|
|
1093
997
|
verbose,
|
|
1094
998
|
incremental,
|
|
1095
999
|
fix: fix2
|
|
1096
1000
|
});
|
|
1097
|
-
}
|
|
1098
|
-
var lintAllPackages =
|
|
1099
|
-
console.log(
|
|
1001
|
+
};
|
|
1002
|
+
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1003
|
+
console.log(chalk16.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1100
1004
|
const start = Date.now();
|
|
1101
|
-
const fixOptions = fix2 ? [
|
|
1102
|
-
"--fix"
|
|
1103
|
-
] : [];
|
|
1005
|
+
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1104
1006
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1105
|
-
[
|
|
1106
|
-
"yarn",
|
|
1107
|
-
[
|
|
1108
|
-
"eslint",
|
|
1109
|
-
...fixOptions
|
|
1110
|
-
]
|
|
1111
|
-
]
|
|
1007
|
+
["yarn", ["eslint", ...fixOptions]]
|
|
1112
1008
|
]);
|
|
1113
|
-
console.log(
|
|
1009
|
+
console.log(chalk16.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk16.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk16.gray("seconds")}`));
|
|
1114
1010
|
return result;
|
|
1115
|
-
}
|
|
1011
|
+
};
|
|
1116
1012
|
|
|
1117
1013
|
// src/actions/fix.ts
|
|
1118
|
-
var fix =
|
|
1119
|
-
return lint({
|
|
1120
|
-
|
|
1121
|
-
fix: true
|
|
1122
|
-
});
|
|
1123
|
-
}, "fix");
|
|
1014
|
+
var fix = (params) => {
|
|
1015
|
+
return lint({ ...params, fix: true });
|
|
1016
|
+
};
|
|
1124
1017
|
|
|
1125
1018
|
// 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");
|
|
1019
|
+
var genDocs = ({ pkg, incremental }) => {
|
|
1020
|
+
return pkg ? genDocsPackage({ pkg }) : genDocsAll({ incremental });
|
|
1021
|
+
};
|
|
1022
|
+
var genDocsPackage = ({ pkg }) => {
|
|
1023
|
+
const steps = [["yarn", ["workspace", pkg, "run", "package-gen-docs"]]];
|
|
1024
|
+
return runSteps(`GenDocs [${pkg}]`, [...steps]);
|
|
1025
|
+
};
|
|
1026
|
+
var genDocsAll = ({ incremental }) => {
|
|
1027
|
+
const incrementalOptions = incremental ? ["--since", "-pA"] : ["-pA"];
|
|
1028
|
+
const steps = [["yarn", ["workspaces", "foreach", ...incrementalOptions, "run", "package-gen-docs"]]];
|
|
1029
|
+
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [...steps]);
|
|
1030
|
+
};
|
|
1172
1031
|
|
|
1173
1032
|
// src/actions/gitignore-gen.ts
|
|
1174
1033
|
var filename = ".gitignore";
|
|
1175
|
-
var gitignoreGen =
|
|
1034
|
+
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1176
1035
|
|
|
1177
1036
|
// src/actions/gitlint.ts
|
|
1178
|
-
import
|
|
1037
|
+
import chalk17 from "chalk";
|
|
1179
1038
|
import ParseGitConfig from "parse-git-config";
|
|
1180
|
-
var gitlint =
|
|
1039
|
+
var gitlint = () => {
|
|
1181
1040
|
console.log(`
|
|
1182
1041
|
Gitlint Start [${process.cwd()}]
|
|
1183
1042
|
`);
|
|
@@ -1185,10 +1044,10 @@ Gitlint Start [${process.cwd()}]
|
|
|
1185
1044
|
let warnings = 0;
|
|
1186
1045
|
const errors = 0;
|
|
1187
1046
|
const gitConfig = ParseGitConfig.sync();
|
|
1188
|
-
const warn =
|
|
1189
|
-
console.warn(
|
|
1047
|
+
const warn = (message) => {
|
|
1048
|
+
console.warn(chalk17.yellow(`Warning: ${message}`));
|
|
1190
1049
|
warnings++;
|
|
1191
|
-
}
|
|
1050
|
+
};
|
|
1192
1051
|
if (gitConfig.core.ignorecase) {
|
|
1193
1052
|
warn("Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]");
|
|
1194
1053
|
} else {
|
|
@@ -1206,67 +1065,52 @@ Gitlint Start [${process.cwd()}]
|
|
|
1206
1065
|
}
|
|
1207
1066
|
const resultMessages = [];
|
|
1208
1067
|
if (valid > 0) {
|
|
1209
|
-
resultMessages.push(
|
|
1068
|
+
resultMessages.push(chalk17.green(`Passed: ${valid}`));
|
|
1210
1069
|
}
|
|
1211
1070
|
if (warnings > 0) {
|
|
1212
|
-
resultMessages.push(
|
|
1071
|
+
resultMessages.push(chalk17.yellow(`Warnings: ${warnings}`));
|
|
1213
1072
|
}
|
|
1214
1073
|
if (errors > 0) {
|
|
1215
|
-
resultMessages.push(
|
|
1074
|
+
resultMessages.push(chalk17.red(` Errors: ${errors}`));
|
|
1216
1075
|
}
|
|
1217
1076
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1218
1077
|
`);
|
|
1219
1078
|
return warnings + errors === 0 ? 1 : 0;
|
|
1220
|
-
}
|
|
1079
|
+
};
|
|
1221
1080
|
|
|
1222
1081
|
// src/actions/gitlint-fix.ts
|
|
1223
1082
|
import { execSync as execSync2 } from "node:child_process";
|
|
1224
|
-
import
|
|
1083
|
+
import chalk18 from "chalk";
|
|
1225
1084
|
import ParseGitConfig2 from "parse-git-config";
|
|
1226
|
-
var gitlintFix =
|
|
1085
|
+
var gitlintFix = () => {
|
|
1227
1086
|
console.log(`
|
|
1228
1087
|
Gitlint Fix Start [${process.cwd()}]
|
|
1229
1088
|
`);
|
|
1230
1089
|
const gitConfig = ParseGitConfig2.sync();
|
|
1231
1090
|
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"));
|
|
1091
|
+
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1092
|
+
console.warn(chalk18.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1236
1093
|
}
|
|
1237
1094
|
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"));
|
|
1095
|
+
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1096
|
+
console.warn(chalk18.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1242
1097
|
}
|
|
1243
1098
|
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'));
|
|
1099
|
+
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1100
|
+
console.warn(chalk18.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1248
1101
|
}
|
|
1249
1102
|
return 1;
|
|
1250
|
-
}
|
|
1103
|
+
};
|
|
1251
1104
|
|
|
1252
1105
|
// 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");
|
|
1106
|
+
var knip = () => {
|
|
1107
|
+
return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
|
|
1108
|
+
};
|
|
1265
1109
|
|
|
1266
1110
|
// src/actions/license.ts
|
|
1267
|
-
import
|
|
1111
|
+
import chalk19 from "chalk";
|
|
1268
1112
|
import { init } from "license-checker";
|
|
1269
|
-
var license =
|
|
1113
|
+
var license = async (pkg) => {
|
|
1270
1114
|
const workspaces = yarnWorkspaces();
|
|
1271
1115
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1272
1116
|
return pkg === void 0 || name === pkg;
|
|
@@ -1289,112 +1133,98 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1289
1133
|
"LGPL-3.0-or-later",
|
|
1290
1134
|
"Python-2.0"
|
|
1291
1135
|
]);
|
|
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
|
-
|
|
1136
|
+
console.log(chalk19.green("License Checker"));
|
|
1137
|
+
return (await Promise.all(
|
|
1138
|
+
workspaceList.map(({ location, name }) => {
|
|
1139
|
+
return new Promise((resolve) => {
|
|
1140
|
+
init({ production: true, start: location }, (error, packages) => {
|
|
1141
|
+
if (error) {
|
|
1142
|
+
console.error(chalk19.red(`License Checker [${name}] Error`));
|
|
1143
|
+
console.error(chalk19.gray(error));
|
|
1144
|
+
console.log("\n");
|
|
1145
|
+
resolve(1);
|
|
1146
|
+
} else {
|
|
1147
|
+
console.log(chalk19.green(`License Checker [${name}]`));
|
|
1148
|
+
let count = 0;
|
|
1149
|
+
for (const [name2, info] of Object.entries(packages)) {
|
|
1150
|
+
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
1151
|
+
for (let license2 of licenses) {
|
|
1152
|
+
if (license2) {
|
|
1153
|
+
const processedLicense = license2[0] === "(" && license2.at(-1) === ")" ? license2.slice(1, -2) : license2;
|
|
1154
|
+
const orLicenses = processedLicense.split(" OR ");
|
|
1155
|
+
let orLicenseFound = false;
|
|
1156
|
+
for (const orLicense of orLicenses) {
|
|
1157
|
+
if (exclude.has(orLicense)) {
|
|
1158
|
+
orLicenseFound = true;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
if (!orLicenseFound) {
|
|
1162
|
+
count++;
|
|
1163
|
+
console.warn(chalk19.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1319
1164
|
}
|
|
1320
|
-
}
|
|
1321
|
-
if (!orLicenseFound) {
|
|
1322
|
-
count++;
|
|
1323
|
-
console.warn(chalk18.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1324
1165
|
}
|
|
1325
1166
|
}
|
|
1326
1167
|
}
|
|
1168
|
+
console.log("\n");
|
|
1169
|
+
resolve(count);
|
|
1327
1170
|
}
|
|
1328
|
-
|
|
1329
|
-
resolve(count);
|
|
1330
|
-
}
|
|
1171
|
+
});
|
|
1331
1172
|
});
|
|
1332
|
-
})
|
|
1333
|
-
|
|
1334
|
-
}
|
|
1173
|
+
})
|
|
1174
|
+
)).reduce((prev, value) => prev || value, 0);
|
|
1175
|
+
};
|
|
1335
1176
|
|
|
1336
1177
|
// src/actions/npmignore-gen.ts
|
|
1337
1178
|
var filename2 = ".npmignore";
|
|
1338
|
-
var npmignoreGen =
|
|
1179
|
+
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1339
1180
|
|
|
1340
1181
|
// src/actions/package/clean-outputs.ts
|
|
1341
|
-
import
|
|
1342
|
-
import
|
|
1343
|
-
var packageCleanOutputs =
|
|
1182
|
+
import path4 from "node:path";
|
|
1183
|
+
import chalk20 from "chalk";
|
|
1184
|
+
var packageCleanOutputs = () => {
|
|
1344
1185
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1345
1186
|
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}]`));
|
|
1187
|
+
const folders = [path4.join(pkg, "dist"), path4.join(pkg, "build"), path4.join(pkg, "docs")];
|
|
1188
|
+
console.log(chalk20.green(`Cleaning Outputs [${pkgName}]`));
|
|
1352
1189
|
for (let folder of folders) {
|
|
1353
1190
|
deleteGlob(folder);
|
|
1354
1191
|
}
|
|
1355
1192
|
return 0;
|
|
1356
|
-
}
|
|
1193
|
+
};
|
|
1357
1194
|
|
|
1358
1195
|
// src/actions/package/clean-typescript.ts
|
|
1359
|
-
import
|
|
1360
|
-
import
|
|
1361
|
-
var packageCleanTypescript =
|
|
1196
|
+
import path5 from "node:path";
|
|
1197
|
+
import chalk21 from "chalk";
|
|
1198
|
+
var packageCleanTypescript = () => {
|
|
1362
1199
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1363
1200
|
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
|
-
];
|
|
1201
|
+
console.log(chalk21.green(`Cleaning Typescript [${pkgName}]`));
|
|
1202
|
+
const files = [path5.join(pkg, "*.tsbuildinfo"), path5.join(pkg, ".tsconfig.*"), path5.join(pkg, ".eslintcache")];
|
|
1370
1203
|
for (let file of files) {
|
|
1371
1204
|
deleteGlob(file);
|
|
1372
1205
|
}
|
|
1373
1206
|
return 0;
|
|
1374
|
-
}
|
|
1207
|
+
};
|
|
1375
1208
|
|
|
1376
1209
|
// 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");
|
|
1210
|
+
var packageClean = async () => {
|
|
1211
|
+
return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0);
|
|
1212
|
+
};
|
|
1383
1213
|
|
|
1384
1214
|
// src/actions/package/compile/compile.ts
|
|
1385
|
-
import
|
|
1215
|
+
import chalk25 from "chalk";
|
|
1386
1216
|
|
|
1387
1217
|
// src/actions/package/publint.ts
|
|
1388
|
-
import { promises as
|
|
1389
|
-
import
|
|
1218
|
+
import { promises as fs3 } from "node:fs";
|
|
1219
|
+
import chalk22 from "chalk";
|
|
1390
1220
|
import sortPackageJson from "sort-package-json";
|
|
1391
|
-
var packagePublint =
|
|
1221
|
+
var packagePublint = async (params) => {
|
|
1392
1222
|
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(
|
|
1223
|
+
const sortedPkg = sortPackageJson(await fs3.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1224
|
+
await fs3.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1225
|
+
const pkg = JSON.parse(await fs3.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1226
|
+
console.log(chalk22.green(`Publint: ${pkg.name}`));
|
|
1227
|
+
console.log(chalk22.gray(pkgDir));
|
|
1398
1228
|
const { publint: publint2 } = await import("publint");
|
|
1399
1229
|
const { messages } = await publint2({
|
|
1400
1230
|
level: "suggestion",
|
|
@@ -1402,52 +1232,47 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
|
1402
1232
|
strict: true
|
|
1403
1233
|
});
|
|
1404
1234
|
const { formatMessage } = await import("publint/utils");
|
|
1405
|
-
const validMessage =
|
|
1235
|
+
const validMessage = (_message) => {
|
|
1406
1236
|
return true;
|
|
1407
|
-
}
|
|
1237
|
+
};
|
|
1408
1238
|
const validMessages = messages.filter(validMessage);
|
|
1409
1239
|
for (const message of validMessages) {
|
|
1410
1240
|
switch (message.type) {
|
|
1411
1241
|
case "error": {
|
|
1412
|
-
console.error(
|
|
1242
|
+
console.error(chalk22.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1413
1243
|
break;
|
|
1414
1244
|
}
|
|
1415
1245
|
case "warning": {
|
|
1416
|
-
console.warn(
|
|
1246
|
+
console.warn(chalk22.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1417
1247
|
break;
|
|
1418
1248
|
}
|
|
1419
1249
|
default: {
|
|
1420
|
-
console.log(
|
|
1250
|
+
console.log(chalk22.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1421
1251
|
break;
|
|
1422
1252
|
}
|
|
1423
1253
|
}
|
|
1424
1254
|
}
|
|
1425
1255
|
if (params?.verbose) {
|
|
1426
|
-
console.log(
|
|
1256
|
+
console.log(chalk22.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1427
1257
|
}
|
|
1428
1258
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1429
|
-
}
|
|
1259
|
+
};
|
|
1430
1260
|
|
|
1431
1261
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1432
1262
|
import { build as build2, defineConfig } from "tsup";
|
|
1433
1263
|
|
|
1434
1264
|
// src/actions/package/compile/inputs.ts
|
|
1435
1265
|
import { glob as glob2 } from "glob";
|
|
1436
|
-
var getAllInputs =
|
|
1437
|
-
return glob2.sync(`${folder}/**/*.*`, {
|
|
1438
|
-
|
|
1439
|
-
});
|
|
1440
|
-
}, "getAllInputs");
|
|
1266
|
+
var getAllInputs = (folder) => {
|
|
1267
|
+
return glob2.sync(`${folder}/**/*.*`, { posix: true });
|
|
1268
|
+
};
|
|
1441
1269
|
|
|
1442
1270
|
// src/actions/package/compile/buildEntries.ts
|
|
1443
|
-
var buildEntries =
|
|
1271
|
+
var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true, verbose = false) => {
|
|
1444
1272
|
let entries = [];
|
|
1445
1273
|
switch (entryMode) {
|
|
1446
1274
|
case "platform": {
|
|
1447
|
-
entries = [
|
|
1448
|
-
`${folder}/index-node.ts`,
|
|
1449
|
-
`${folder}/index-browser.ts`
|
|
1450
|
-
];
|
|
1275
|
+
entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`];
|
|
1451
1276
|
break;
|
|
1452
1277
|
}
|
|
1453
1278
|
case "all": {
|
|
@@ -1455,46 +1280,53 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", exclude
|
|
|
1455
1280
|
break;
|
|
1456
1281
|
}
|
|
1457
1282
|
default: {
|
|
1458
|
-
entries = [
|
|
1459
|
-
`${folder}/index.ts`
|
|
1460
|
-
];
|
|
1283
|
+
entries = [`${folder}/index.ts`];
|
|
1461
1284
|
break;
|
|
1462
1285
|
}
|
|
1463
1286
|
}
|
|
1464
1287
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
1465
1288
|
return entries;
|
|
1466
|
-
}
|
|
1289
|
+
};
|
|
1467
1290
|
|
|
1468
1291
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1469
1292
|
import { cwd } from "node:process";
|
|
1470
|
-
import
|
|
1293
|
+
import chalk23 from "chalk";
|
|
1471
1294
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1472
|
-
import {
|
|
1295
|
+
import {
|
|
1296
|
+
DiagnosticCategory,
|
|
1297
|
+
formatDiagnosticsWithColorAndContext,
|
|
1298
|
+
getPreEmitDiagnostics,
|
|
1299
|
+
sys as sys2
|
|
1300
|
+
} from "typescript";
|
|
1473
1301
|
|
|
1474
1302
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
1475
1303
|
import { createRequire } from "node:module";
|
|
1476
1304
|
import deepmerge2 from "deepmerge";
|
|
1477
|
-
import {
|
|
1478
|
-
|
|
1305
|
+
import {
|
|
1306
|
+
findConfigFile,
|
|
1307
|
+
readConfigFile,
|
|
1308
|
+
sys
|
|
1309
|
+
} from "typescript";
|
|
1310
|
+
var getNested = (config2) => {
|
|
1479
1311
|
if (config2.extends) {
|
|
1480
1312
|
const require2 = createRequire(import.meta.url);
|
|
1481
1313
|
const opts = require2(config2.extends);
|
|
1482
1314
|
return deepmerge2(getNested(opts), config2.compilerOptions ?? {});
|
|
1483
1315
|
}
|
|
1484
1316
|
return config2.compilerOptions;
|
|
1485
|
-
}
|
|
1486
|
-
var getCompilerOptionsJSONFollowExtends =
|
|
1317
|
+
};
|
|
1318
|
+
var getCompilerOptionsJSONFollowExtends = (filename3) => {
|
|
1487
1319
|
const config2 = readConfigFile(filename3, sys.readFile).config;
|
|
1488
1320
|
return getNested(config2);
|
|
1489
|
-
}
|
|
1490
|
-
var getCompilerOptions =
|
|
1321
|
+
};
|
|
1322
|
+
var getCompilerOptions = (options = {}, tsconfig = "tsconfig.json") => {
|
|
1491
1323
|
const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
|
|
1492
1324
|
const configFileCompilerOptions = (configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0) ?? {};
|
|
1493
1325
|
return deepmerge2(configFileCompilerOptions, options);
|
|
1494
|
-
}
|
|
1326
|
+
};
|
|
1495
1327
|
|
|
1496
1328
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1497
|
-
var packageCompileTscTypes =
|
|
1329
|
+
var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1498
1330
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
1499
1331
|
const verbose = config2?.verbose ?? false;
|
|
1500
1332
|
const compilerOptions = {
|
|
@@ -1510,54 +1342,40 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
1510
1342
|
emitDeclarationOnly: true,
|
|
1511
1343
|
noEmit: false
|
|
1512
1344
|
};
|
|
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
|
-
];
|
|
1345
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1346
|
+
const excludes = [".stories.", ".spec."];
|
|
1526
1347
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1527
|
-
console.log(
|
|
1348
|
+
console.log(chalk23.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1528
1349
|
if (files.length > 0) {
|
|
1529
1350
|
const program = createProgramFromConfig({
|
|
1530
1351
|
basePath: pkg ?? cwd(),
|
|
1531
1352
|
compilerOptions,
|
|
1532
|
-
exclude: [
|
|
1533
|
-
"dist",
|
|
1534
|
-
"docs",
|
|
1535
|
-
"**/*.spec.*",
|
|
1536
|
-
"**/*.stories.*",
|
|
1537
|
-
"src/**/spec/**/*"
|
|
1538
|
-
],
|
|
1353
|
+
exclude: ["dist", "docs", "**/*.spec.*", "**/*.stories.*", "src/**/spec/**/*"],
|
|
1539
1354
|
files
|
|
1540
1355
|
});
|
|
1541
1356
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
1542
1357
|
if (diagnostics.length > 0) {
|
|
1543
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1358
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1359
|
+
diagnostics,
|
|
1360
|
+
{
|
|
1361
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1362
|
+
getCurrentDirectory: () => folder,
|
|
1363
|
+
getNewLine: () => sys2.newLine
|
|
1364
|
+
}
|
|
1365
|
+
);
|
|
1548
1366
|
console.error(formattedDiagnostics);
|
|
1549
1367
|
}
|
|
1550
1368
|
program.emit();
|
|
1551
1369
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1552
1370
|
}
|
|
1553
1371
|
return 0;
|
|
1554
|
-
}
|
|
1372
|
+
};
|
|
1555
1373
|
|
|
1556
1374
|
// src/actions/package/compile/compileTypes.ts
|
|
1557
|
-
var packageCompileTypes =
|
|
1375
|
+
var packageCompileTypes = async (inConfig = {}) => {
|
|
1558
1376
|
const config2 = await loadConfig(inConfig);
|
|
1559
1377
|
return packageCompileTscTypes(void 0, config2);
|
|
1560
|
-
}
|
|
1378
|
+
};
|
|
1561
1379
|
|
|
1562
1380
|
// src/actions/package/compile/deepMerge.ts
|
|
1563
1381
|
function deepMerge(target, source) {
|
|
@@ -1574,7 +1392,6 @@ function deepMerge(target, source) {
|
|
|
1574
1392
|
}
|
|
1575
1393
|
return target;
|
|
1576
1394
|
}
|
|
1577
|
-
__name(deepMerge, "deepMerge");
|
|
1578
1395
|
function deepMergeObjects(objects) {
|
|
1579
1396
|
const result = {};
|
|
1580
1397
|
for (const obj of objects) {
|
|
@@ -1582,14 +1399,18 @@ function deepMergeObjects(objects) {
|
|
|
1582
1399
|
}
|
|
1583
1400
|
return result;
|
|
1584
1401
|
}
|
|
1585
|
-
__name(deepMergeObjects, "deepMergeObjects");
|
|
1586
1402
|
|
|
1587
1403
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1588
1404
|
import { cwd as cwd2 } from "node:process";
|
|
1589
|
-
import
|
|
1405
|
+
import chalk24 from "chalk";
|
|
1590
1406
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1591
|
-
import {
|
|
1592
|
-
|
|
1407
|
+
import {
|
|
1408
|
+
DiagnosticCategory as DiagnosticCategory2,
|
|
1409
|
+
formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2,
|
|
1410
|
+
getPreEmitDiagnostics as getPreEmitDiagnostics2,
|
|
1411
|
+
sys as sys3
|
|
1412
|
+
} from "typescript";
|
|
1413
|
+
var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1593
1414
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1594
1415
|
const verbose = config2?.verbose ?? false;
|
|
1595
1416
|
const compilerOptions = {
|
|
@@ -1604,51 +1425,37 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
1604
1425
|
emitDeclarationOnly: false,
|
|
1605
1426
|
noEmit: true
|
|
1606
1427
|
};
|
|
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
|
-
];
|
|
1428
|
+
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1429
|
+
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1623
1430
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1624
|
-
console.log(
|
|
1431
|
+
console.log(chalk24.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1625
1432
|
if (files.length > 0) {
|
|
1626
1433
|
const program = createProgramFromConfig2({
|
|
1627
1434
|
basePath: pkg ?? cwd2(),
|
|
1628
1435
|
compilerOptions,
|
|
1629
|
-
exclude: [
|
|
1630
|
-
"dist",
|
|
1631
|
-
"docs"
|
|
1632
|
-
],
|
|
1436
|
+
exclude: ["dist", "docs"],
|
|
1633
1437
|
files
|
|
1634
1438
|
});
|
|
1635
1439
|
const diagnostics = getPreEmitDiagnostics2(program);
|
|
1636
1440
|
if (diagnostics.length > 0) {
|
|
1637
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1441
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1442
|
+
diagnostics,
|
|
1443
|
+
{
|
|
1444
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1445
|
+
getCurrentDirectory: () => folder,
|
|
1446
|
+
getNewLine: () => sys3.newLine
|
|
1447
|
+
}
|
|
1448
|
+
);
|
|
1642
1449
|
console.error(formattedDiagnostics);
|
|
1643
1450
|
}
|
|
1644
1451
|
program.emit();
|
|
1645
1452
|
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
|
|
1646
1453
|
}
|
|
1647
1454
|
return 0;
|
|
1648
|
-
}
|
|
1455
|
+
};
|
|
1649
1456
|
|
|
1650
1457
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1651
|
-
var compileFolder =
|
|
1458
|
+
var compileFolder = async (folder, entryMode = "single", options, verbose) => {
|
|
1652
1459
|
const outDir = options?.outDir ?? "dist";
|
|
1653
1460
|
if (verbose) {
|
|
1654
1461
|
console.log(`compileFolder [${folder}]`);
|
|
@@ -1660,9 +1467,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1660
1467
|
clean: true,
|
|
1661
1468
|
dts: false,
|
|
1662
1469
|
entry,
|
|
1663
|
-
format: [
|
|
1664
|
-
"esm"
|
|
1665
|
-
],
|
|
1470
|
+
format: ["esm"],
|
|
1666
1471
|
outDir,
|
|
1667
1472
|
silent: true,
|
|
1668
1473
|
sourcemap: true,
|
|
@@ -1670,16 +1475,12 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1670
1475
|
tsconfig: "tsconfig.json",
|
|
1671
1476
|
...options
|
|
1672
1477
|
});
|
|
1673
|
-
const optionsList = (await Promise.all(
|
|
1674
|
-
optionsResult
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
return Array.isArray(result) ? result : [
|
|
1680
|
-
result
|
|
1681
|
-
];
|
|
1682
|
-
}))).flat();
|
|
1478
|
+
const optionsList = (await Promise.all(
|
|
1479
|
+
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
1480
|
+
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
1481
|
+
return Array.isArray(result) ? result : [result];
|
|
1482
|
+
})
|
|
1483
|
+
)).flat();
|
|
1683
1484
|
if (verbose) {
|
|
1684
1485
|
console.log(`TSUP:build:start [${folder}]`);
|
|
1685
1486
|
}
|
|
@@ -1688,8 +1489,8 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1688
1489
|
console.log(`TSUP:build:stop [${folder}]`);
|
|
1689
1490
|
}
|
|
1690
1491
|
return 0;
|
|
1691
|
-
}
|
|
1692
|
-
var tsupOptions =
|
|
1492
|
+
};
|
|
1493
|
+
var tsupOptions = (options = []) => {
|
|
1693
1494
|
const standardLoaders = {
|
|
1694
1495
|
".gif": "copy",
|
|
1695
1496
|
".html": "copy",
|
|
@@ -1701,39 +1502,24 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
|
|
|
1701
1502
|
};
|
|
1702
1503
|
const standardOptions = {
|
|
1703
1504
|
bundle: true,
|
|
1704
|
-
format: [
|
|
1705
|
-
"esm"
|
|
1706
|
-
],
|
|
1505
|
+
format: ["esm"],
|
|
1707
1506
|
loader: standardLoaders,
|
|
1708
|
-
outExtension:
|
|
1709
|
-
js: ".mjs"
|
|
1710
|
-
} : {
|
|
1711
|
-
js: ".cjs"
|
|
1712
|
-
}, "outExtension"),
|
|
1507
|
+
outExtension: ({ format }) => format === "esm" ? { js: ".mjs" } : { js: ".cjs" },
|
|
1713
1508
|
skipNodeModulesBundle: true,
|
|
1714
1509
|
sourcemap: true,
|
|
1715
1510
|
target: "esnext"
|
|
1716
1511
|
};
|
|
1717
|
-
return deepMergeObjects([
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
]);
|
|
1721
|
-
}, "tsupOptions");
|
|
1722
|
-
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1512
|
+
return deepMergeObjects([standardOptions, ...options]);
|
|
1513
|
+
};
|
|
1514
|
+
var packageCompileTsup = async (config2) => {
|
|
1723
1515
|
const compile2 = config2?.compile;
|
|
1724
1516
|
const verbose = config2?.verbose ?? false;
|
|
1725
1517
|
if (verbose) {
|
|
1726
1518
|
console.log(`Compiling with TSUP [Depth: ${compile2?.depth}]`);
|
|
1727
1519
|
}
|
|
1728
|
-
const compileForNode = compile2?.node ?? {
|
|
1729
|
-
|
|
1730
|
-
};
|
|
1731
|
-
const compileForBrowser = compile2?.browser ?? {
|
|
1732
|
-
src: {}
|
|
1733
|
-
};
|
|
1734
|
-
const compileForNeutral = compile2?.neutral ?? {
|
|
1735
|
-
src: {}
|
|
1736
|
-
};
|
|
1520
|
+
const compileForNode = compile2?.node ?? { src: {} };
|
|
1521
|
+
const compileForBrowser = compile2?.browser ?? { src: {} };
|
|
1522
|
+
const compileForNeutral = compile2?.neutral ?? { src: {} };
|
|
1737
1523
|
if (verbose) {
|
|
1738
1524
|
console.log("Calling packageCompileTscTypes");
|
|
1739
1525
|
}
|
|
@@ -1742,46 +1528,58 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1742
1528
|
if (errors > 0) {
|
|
1743
1529
|
return errors;
|
|
1744
1530
|
}
|
|
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
|
-
|
|
1531
|
+
return (await Promise.all(
|
|
1532
|
+
Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
1533
|
+
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1534
|
+
return folder ? await compileFolder(
|
|
1535
|
+
folder,
|
|
1536
|
+
compile2?.entryMode,
|
|
1537
|
+
tsupOptions([
|
|
1538
|
+
inEsBuildOptions,
|
|
1539
|
+
compile2?.tsup?.options ?? {},
|
|
1540
|
+
typeof options === "object" ? options : {},
|
|
1541
|
+
{ platform: "node", outDir: "dist/node" }
|
|
1542
|
+
]),
|
|
1543
|
+
verbose
|
|
1544
|
+
) : 0;
|
|
1545
|
+
})
|
|
1546
|
+
)).reduce((prev, value) => prev + value, 0) || (await Promise.all(
|
|
1547
|
+
Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
1548
|
+
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1549
|
+
return folder ? await compileFolder(
|
|
1550
|
+
folder,
|
|
1551
|
+
compile2?.entryMode,
|
|
1552
|
+
tsupOptions([
|
|
1553
|
+
inEsBuildOptions,
|
|
1554
|
+
compile2?.tsup?.options ?? {},
|
|
1555
|
+
typeof options === "object" ? options : {},
|
|
1556
|
+
{ platform: "browser", outDir: "dist/browser" }
|
|
1557
|
+
]),
|
|
1558
|
+
verbose
|
|
1559
|
+
) : 0;
|
|
1560
|
+
})
|
|
1561
|
+
)).reduce((prev, value) => prev + value, 0) || (await Promise.all(
|
|
1562
|
+
Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
1563
|
+
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1564
|
+
return folder ? await compileFolder(
|
|
1565
|
+
folder,
|
|
1566
|
+
compile2?.entryMode,
|
|
1567
|
+
tsupOptions([
|
|
1568
|
+
inEsBuildOptions,
|
|
1569
|
+
compile2?.tsup?.options ?? {},
|
|
1570
|
+
typeof options === "object" ? options : {},
|
|
1571
|
+
{ platform: "neutral", outDir: "dist/neutral" }
|
|
1572
|
+
]),
|
|
1573
|
+
verbose
|
|
1574
|
+
) : 0;
|
|
1575
|
+
})
|
|
1576
|
+
)).reduce((prev, value) => prev + value, 0) || 0;
|
|
1577
|
+
};
|
|
1780
1578
|
|
|
1781
1579
|
// src/actions/package/compile/compile.ts
|
|
1782
|
-
var packageCompile =
|
|
1580
|
+
var packageCompile = async (inConfig = {}) => {
|
|
1783
1581
|
const pkg = process.env.INIT_CWD;
|
|
1784
|
-
console.log(
|
|
1582
|
+
console.log(chalk25.green(`Compiling ${pkg}`));
|
|
1785
1583
|
const config2 = await loadConfig(inConfig);
|
|
1786
1584
|
const publint2 = config2.publint;
|
|
1787
1585
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1789,30 +1587,24 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1789
1587
|
return tsupResults;
|
|
1790
1588
|
}
|
|
1791
1589
|
return publint2 ? await packagePublint(config2) : 0;
|
|
1792
|
-
}
|
|
1590
|
+
};
|
|
1793
1591
|
|
|
1794
1592
|
// src/actions/package/copy-assets.ts
|
|
1795
|
-
import
|
|
1796
|
-
import
|
|
1593
|
+
import path6 from "node:path/posix";
|
|
1594
|
+
import chalk26 from "chalk";
|
|
1797
1595
|
import cpy2 from "cpy";
|
|
1798
|
-
var copyTargetAssets2 =
|
|
1596
|
+
var copyTargetAssets2 = async (target, name, location) => {
|
|
1799
1597
|
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
|
-
});
|
|
1598
|
+
const values = await cpy2(
|
|
1599
|
+
["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
|
|
1600
|
+
`../dist/${target}`,
|
|
1601
|
+
{
|
|
1602
|
+
cwd: path6.join(location, "src"),
|
|
1603
|
+
flat: false
|
|
1604
|
+
}
|
|
1605
|
+
);
|
|
1814
1606
|
if (values.length > 0) {
|
|
1815
|
-
console.log(
|
|
1607
|
+
console.log(chalk26.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1816
1608
|
}
|
|
1817
1609
|
for (const value of values) {
|
|
1818
1610
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1823,8 +1615,8 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1823
1615
|
console.log(`Copy Assets Failed: ${name}: ${error.message}`);
|
|
1824
1616
|
return 1;
|
|
1825
1617
|
}
|
|
1826
|
-
}
|
|
1827
|
-
var packageCopyAssets =
|
|
1618
|
+
};
|
|
1619
|
+
var packageCopyAssets = async ({ target }) => {
|
|
1828
1620
|
const pkg = process.env.INIT_CWD ?? "./";
|
|
1829
1621
|
const pkgName = process.env.npm_package_name ?? "Unknown";
|
|
1830
1622
|
switch (target) {
|
|
@@ -1838,11 +1630,11 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1838
1630
|
return await copyTargetAssets2("esm", pkgName, pkg) || await copyTargetAssets2("cjs", pkgName, pkg);
|
|
1839
1631
|
}
|
|
1840
1632
|
}
|
|
1841
|
-
}
|
|
1633
|
+
};
|
|
1842
1634
|
|
|
1843
1635
|
// src/actions/package/cycle.ts
|
|
1844
1636
|
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1845
|
-
var packageCycle =
|
|
1637
|
+
var packageCycle = async ({ verbose = false }) => {
|
|
1846
1638
|
const pkg = process.env.INIT_CWD;
|
|
1847
1639
|
const pkgName = process.env.npm_package_name;
|
|
1848
1640
|
const cruiseOptions = {
|
|
@@ -1853,26 +1645,20 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1853
1645
|
severity: "error",
|
|
1854
1646
|
comment: "This dependency creates a circular reference",
|
|
1855
1647
|
from: {},
|
|
1856
|
-
to: {
|
|
1857
|
-
circular: true
|
|
1858
|
-
}
|
|
1648
|
+
to: { circular: true }
|
|
1859
1649
|
}
|
|
1860
1650
|
]
|
|
1861
1651
|
},
|
|
1862
1652
|
exclude: "node_modules|packages/.*/packages",
|
|
1863
1653
|
validate: true,
|
|
1864
|
-
doNotFollow: {
|
|
1865
|
-
path: "node_modules|packages/.*/packages"
|
|
1866
|
-
},
|
|
1654
|
+
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
1867
1655
|
tsPreCompilationDeps: false,
|
|
1868
1656
|
combinedDependencies: true,
|
|
1869
1657
|
outputType: verbose ? "text" : "err"
|
|
1870
1658
|
};
|
|
1871
1659
|
const target = `${pkg}/src`;
|
|
1872
1660
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1873
|
-
const result = await cruise2([
|
|
1874
|
-
target
|
|
1875
|
-
], cruiseOptions);
|
|
1661
|
+
const result = await cruise2([target], cruiseOptions);
|
|
1876
1662
|
if (result.output) {
|
|
1877
1663
|
console.log(result.output);
|
|
1878
1664
|
}
|
|
@@ -1882,13 +1668,18 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1882
1668
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
1883
1669
|
}
|
|
1884
1670
|
return result.exitCode;
|
|
1885
|
-
}
|
|
1671
|
+
};
|
|
1886
1672
|
|
|
1887
1673
|
// src/actions/package/gen-docs.ts
|
|
1888
1674
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1889
|
-
import
|
|
1890
|
-
import
|
|
1891
|
-
import {
|
|
1675
|
+
import path7 from "node:path";
|
|
1676
|
+
import chalk27 from "chalk";
|
|
1677
|
+
import {
|
|
1678
|
+
Application,
|
|
1679
|
+
ArgumentsReader,
|
|
1680
|
+
TSConfigReader,
|
|
1681
|
+
TypeDocReader
|
|
1682
|
+
} from "typedoc";
|
|
1892
1683
|
var ExitCodes = {
|
|
1893
1684
|
CompileError: 3,
|
|
1894
1685
|
ExceptionThrown: 6,
|
|
@@ -1898,17 +1689,14 @@ var ExitCodes = {
|
|
|
1898
1689
|
OutputError: 5,
|
|
1899
1690
|
ValidationError: 4
|
|
1900
1691
|
};
|
|
1901
|
-
var packageGenDocs =
|
|
1692
|
+
var packageGenDocs = async () => {
|
|
1902
1693
|
const pkg = process.env.INIT_CWD;
|
|
1903
|
-
if (pkg && !existsSync5(
|
|
1694
|
+
if (pkg && !existsSync5(path7.join(pkg, "typedoc.json"))) {
|
|
1904
1695
|
return;
|
|
1905
1696
|
}
|
|
1906
1697
|
const app = await Application.bootstrap({
|
|
1907
1698
|
entryPointStrategy: "merge",
|
|
1908
|
-
entryPoints: [
|
|
1909
|
-
`${pkg}/src/**/*.ts`,
|
|
1910
|
-
`${pkg}/packages/*/dist/docs.json`
|
|
1911
|
-
],
|
|
1699
|
+
entryPoints: [`${pkg}/src/**/*.ts`, `${pkg}/packages/*/dist/docs.json`],
|
|
1912
1700
|
excludeExternals: true,
|
|
1913
1701
|
json: `${pkg}/dist/docs.json`,
|
|
1914
1702
|
logLevel: "Error",
|
|
@@ -1919,8 +1707,8 @@ var packageGenDocs = /* @__PURE__ */ __name(async () => {
|
|
|
1919
1707
|
app.options.addReader(new TSConfigReader());
|
|
1920
1708
|
app.options.addReader(new ArgumentsReader(300));
|
|
1921
1709
|
return await runTypeDoc(app);
|
|
1922
|
-
}
|
|
1923
|
-
var runTypeDoc =
|
|
1710
|
+
};
|
|
1711
|
+
var runTypeDoc = async (app) => {
|
|
1924
1712
|
const pkgName = process.env.npm_package_name;
|
|
1925
1713
|
if (app.options.getValue("version")) {
|
|
1926
1714
|
console.log(app.toString());
|
|
@@ -1989,40 +1777,37 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1989
1777
|
return ExitCodes.OutputError;
|
|
1990
1778
|
}
|
|
1991
1779
|
}
|
|
1992
|
-
console.log(
|
|
1780
|
+
console.log(chalk27.green(`${pkgName} - Ok`));
|
|
1993
1781
|
return ExitCodes.Ok;
|
|
1994
|
-
}
|
|
1782
|
+
};
|
|
1995
1783
|
|
|
1996
1784
|
// src/actions/package/lint.ts
|
|
1997
1785
|
import { readdirSync } from "node:fs";
|
|
1998
|
-
import
|
|
1786
|
+
import path8 from "node:path";
|
|
1999
1787
|
import { cwd as cwd3 } from "node:process";
|
|
2000
1788
|
import { pathToFileURL } from "node:url";
|
|
2001
|
-
import
|
|
1789
|
+
import chalk28 from "chalk";
|
|
2002
1790
|
import { ESLint } from "eslint";
|
|
2003
1791
|
import { findUp } from "find-up";
|
|
2004
1792
|
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
|
-
];
|
|
1793
|
+
var dumpMessages = (lintResults) => {
|
|
1794
|
+
const colors = ["white", "yellow", "red"];
|
|
1795
|
+
const severity = ["none", "warning", "error"];
|
|
2016
1796
|
for (const lintResult of lintResults) {
|
|
2017
1797
|
if (lintResult.messages.length > 0) {
|
|
2018
|
-
console.log(
|
|
1798
|
+
console.log(chalk28.gray(`
|
|
2019
1799
|
${lintResult.filePath}`));
|
|
2020
1800
|
for (const message of lintResult.messages) {
|
|
2021
|
-
console.log(
|
|
1801
|
+
console.log(
|
|
1802
|
+
chalk28.gray(` ${message.line}:${message.column}`),
|
|
1803
|
+
chalk28[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1804
|
+
chalk28.white(` ${message.message}`),
|
|
1805
|
+
chalk28.gray(` ${message.ruleId}`)
|
|
1806
|
+
);
|
|
2022
1807
|
}
|
|
2023
1808
|
}
|
|
2024
1809
|
}
|
|
2025
|
-
}
|
|
1810
|
+
};
|
|
2026
1811
|
async function getRootESLintConfig() {
|
|
2027
1812
|
const configPath = await findUp("eslint.config.mjs");
|
|
2028
1813
|
if (!configPath) {
|
|
@@ -2030,50 +1815,33 @@ async function getRootESLintConfig() {
|
|
|
2030
1815
|
}
|
|
2031
1816
|
return pathToFileURL(configPath);
|
|
2032
1817
|
}
|
|
2033
|
-
__name(getRootESLintConfig, "getRootESLintConfig");
|
|
2034
1818
|
function getFiles(dir, ignoreFolders) {
|
|
2035
1819
|
const currentDirectory = cwd3();
|
|
2036
1820
|
const subDirectory = dir.split(currentDirectory)[1];
|
|
2037
1821
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2038
|
-
return readdirSync(dir, {
|
|
2039
|
-
|
|
2040
|
-
}).flatMap((dirent) => {
|
|
2041
|
-
const res = path7.resolve(dir, dirent.name);
|
|
1822
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
1823
|
+
const res = path8.resolve(dir, dirent.name);
|
|
2042
1824
|
const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name;
|
|
2043
1825
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
2044
1826
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
2045
|
-
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
|
|
2046
|
-
res
|
|
2047
|
-
];
|
|
1827
|
+
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [res];
|
|
2048
1828
|
});
|
|
2049
1829
|
}
|
|
2050
|
-
|
|
2051
|
-
var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, cache = true) => {
|
|
1830
|
+
var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
2052
1831
|
const pkg = process.env.INIT_CWD;
|
|
2053
1832
|
const configPath = await getRootESLintConfig();
|
|
2054
1833
|
const { default: eslintConfig } = await import(configPath.href);
|
|
2055
1834
|
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
|
-
];
|
|
1835
|
+
const ignoreFolders = ["node_modules", "dist", "packages", ".git", "build", ".yarn", ".vscode", ".github"];
|
|
2066
1836
|
const engine = new ESLint({
|
|
2067
|
-
baseConfig: [
|
|
2068
|
-
...eslintConfig
|
|
2069
|
-
],
|
|
1837
|
+
baseConfig: [...eslintConfig],
|
|
2070
1838
|
fix: fix2,
|
|
2071
1839
|
warnIgnored: false,
|
|
2072
1840
|
cache
|
|
2073
1841
|
});
|
|
2074
1842
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
2075
1843
|
if (verbose) {
|
|
2076
|
-
console.log(
|
|
1844
|
+
console.log(chalk28.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2077
1845
|
}
|
|
2078
1846
|
const lintResults = await engine.lintFiles(files);
|
|
2079
1847
|
dumpMessages(lintResults);
|
|
@@ -2083,75 +1851,43 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2083
1851
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2084
1852
|
const lintTime = Date.now() - start;
|
|
2085
1853
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2086
|
-
console.log(
|
|
1854
|
+
console.log(chalk28.white(`Linted ${chalk28[filesCountColor](files.length)} files in ${chalk28[lintTimeColor](lintTime)}ms`));
|
|
2087
1855
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2088
|
-
}
|
|
1856
|
+
};
|
|
2089
1857
|
|
|
2090
1858
|
// src/actions/package/recompile.ts
|
|
2091
|
-
var packageRecompile =
|
|
1859
|
+
var packageRecompile = async () => {
|
|
2092
1860
|
return await packageClean() || await packageCompile();
|
|
2093
|
-
}
|
|
1861
|
+
};
|
|
2094
1862
|
|
|
2095
1863
|
// 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");
|
|
1864
|
+
var publint = async ({ verbose, pkg }) => {
|
|
1865
|
+
return pkg ? await publintPackage({ pkg, verbose }) : publintAll({ verbose });
|
|
1866
|
+
};
|
|
1867
|
+
var publintPackage = ({ pkg }) => {
|
|
1868
|
+
return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
|
|
1869
|
+
};
|
|
1870
|
+
var publintAll = ({ verbose }) => {
|
|
1871
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1872
|
+
return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
|
|
1873
|
+
};
|
|
2137
1874
|
|
|
2138
1875
|
// src/actions/rebuild.ts
|
|
2139
|
-
var rebuild =
|
|
1876
|
+
var rebuild = ({ target }) => {
|
|
2140
1877
|
return runSteps("Rebuild", [
|
|
2141
|
-
[
|
|
2142
|
-
|
|
2143
|
-
"xy clean"
|
|
2144
|
-
],
|
|
2145
|
-
[
|
|
2146
|
-
"yarn",
|
|
2147
|
-
target ? `xy build -t ${target}` : "xy build"
|
|
2148
|
-
]
|
|
1878
|
+
["yarn", "xy clean"],
|
|
1879
|
+
["yarn", target ? `xy build -t ${target}` : "xy build"]
|
|
2149
1880
|
]);
|
|
2150
|
-
}
|
|
1881
|
+
};
|
|
2151
1882
|
|
|
2152
1883
|
// src/actions/recompile.ts
|
|
2153
|
-
import
|
|
2154
|
-
var recompile =
|
|
1884
|
+
import chalk29 from "chalk";
|
|
1885
|
+
var recompile = async ({
|
|
1886
|
+
verbose,
|
|
1887
|
+
target,
|
|
1888
|
+
pkg,
|
|
1889
|
+
incremental
|
|
1890
|
+
}) => {
|
|
2155
1891
|
return pkg ? await recompilePackage({
|
|
2156
1892
|
pkg,
|
|
2157
1893
|
target,
|
|
@@ -2161,51 +1897,27 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
|
|
|
2161
1897
|
target,
|
|
2162
1898
|
verbose
|
|
2163
1899
|
});
|
|
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 }) => {
|
|
1900
|
+
};
|
|
1901
|
+
var recompilePackage = ({ target, pkg }) => {
|
|
1902
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
1903
|
+
return runStepsAsync(
|
|
1904
|
+
`Recompile [${pkg}]`,
|
|
1905
|
+
[["yarn", ["workspace", pkg, "run", "package-recompile", ...targetOptions]]]
|
|
1906
|
+
);
|
|
1907
|
+
};
|
|
1908
|
+
var recompileAll = async ({
|
|
1909
|
+
jobs,
|
|
1910
|
+
verbose,
|
|
1911
|
+
target,
|
|
1912
|
+
incremental
|
|
1913
|
+
}) => {
|
|
2184
1914
|
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
|
-
] : [];
|
|
1915
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1916
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
1917
|
+
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1918
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2207
1919
|
if (jobs) {
|
|
2208
|
-
console.log(
|
|
1920
|
+
console.log(chalk29.blue(`Jobs set to [${jobs}]`));
|
|
2209
1921
|
}
|
|
2210
1922
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2211
1923
|
[
|
|
@@ -2235,13 +1947,19 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2235
1947
|
]
|
|
2236
1948
|
]
|
|
2237
1949
|
]);
|
|
2238
|
-
console.log(
|
|
1950
|
+
console.log(
|
|
1951
|
+
`${chalk29.gray("Recompiled in")} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`
|
|
1952
|
+
);
|
|
2239
1953
|
return result;
|
|
2240
|
-
}
|
|
1954
|
+
};
|
|
2241
1955
|
|
|
2242
1956
|
// src/actions/reinstall.ts
|
|
2243
|
-
import {
|
|
2244
|
-
|
|
1957
|
+
import {
|
|
1958
|
+
closeSync,
|
|
1959
|
+
openSync,
|
|
1960
|
+
rmSync
|
|
1961
|
+
} from "node:fs";
|
|
1962
|
+
var reinstall = () => {
|
|
2245
1963
|
console.log("Reinstall [Clear Lock File]");
|
|
2246
1964
|
closeSync(openSync("./yarn.lock", "w"));
|
|
2247
1965
|
console.log("Reinstall [Clear Node Modules]");
|
|
@@ -2249,10 +1967,7 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2249
1967
|
const result = workspaces.map(({ location, name }) => {
|
|
2250
1968
|
const dist = `${location}/node_modules`;
|
|
2251
1969
|
try {
|
|
2252
|
-
rmSync(dist, {
|
|
2253
|
-
force: true,
|
|
2254
|
-
recursive: true
|
|
2255
|
-
});
|
|
1970
|
+
rmSync(dist, { force: true, recursive: true });
|
|
2256
1971
|
return 0;
|
|
2257
1972
|
} catch (ex) {
|
|
2258
1973
|
const error = ex;
|
|
@@ -2260,546 +1975,591 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2260
1975
|
return 1;
|
|
2261
1976
|
}
|
|
2262
1977
|
}).reduce((prev, result2) => prev || result2, 0);
|
|
2263
|
-
return result || runSteps("Reinstall", [
|
|
2264
|
-
|
|
2265
|
-
"yarn",
|
|
2266
|
-
"install --network-timeout 10000"
|
|
2267
|
-
]
|
|
2268
|
-
]);
|
|
2269
|
-
}, "reinstall");
|
|
1978
|
+
return result || runSteps("Reinstall", [["yarn", "install --network-timeout 10000"]]);
|
|
1979
|
+
};
|
|
2270
1980
|
|
|
2271
1981
|
// src/actions/relint.ts
|
|
2272
|
-
import
|
|
2273
|
-
var relintPackage =
|
|
2274
|
-
console.log(
|
|
1982
|
+
import chalk30 from "chalk";
|
|
1983
|
+
var relintPackage = ({ pkg }) => {
|
|
1984
|
+
console.log(chalk30.gray(`${"Relint"} [All-Packages]`));
|
|
2275
1985
|
const start = Date.now();
|
|
2276
1986
|
const result = runSteps("Relint [All-Packages]", [
|
|
2277
|
-
[
|
|
2278
|
-
"
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
"package-relint"
|
|
2284
|
-
]
|
|
2285
|
-
]
|
|
1987
|
+
["yarn", [
|
|
1988
|
+
"workspace",
|
|
1989
|
+
pkg,
|
|
1990
|
+
"run",
|
|
1991
|
+
"package-relint"
|
|
1992
|
+
]]
|
|
2286
1993
|
]);
|
|
2287
|
-
console.log(
|
|
1994
|
+
console.log(chalk30.gray(`${"Relinted in"} [${chalk30.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk30.gray("seconds")}`));
|
|
2288
1995
|
return result;
|
|
2289
|
-
}
|
|
2290
|
-
var relint =
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
1996
|
+
};
|
|
1997
|
+
var relint = ({
|
|
1998
|
+
pkg,
|
|
1999
|
+
verbose,
|
|
2000
|
+
incremental
|
|
2001
|
+
} = {}) => {
|
|
2002
|
+
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
2003
|
+
};
|
|
2004
|
+
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
2005
|
+
console.log(chalk30.gray(`${"Relint"} [All-Packages]`));
|
|
2300
2006
|
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
|
-
];
|
|
2007
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2008
|
+
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
2313
2009
|
const result = runSteps(`${"Relint"} [All-Packages]`, [
|
|
2314
|
-
[
|
|
2315
|
-
"
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
"package-relint"
|
|
2323
|
-
]
|
|
2324
|
-
]
|
|
2010
|
+
["yarn", [
|
|
2011
|
+
"workspaces",
|
|
2012
|
+
"foreach",
|
|
2013
|
+
...verboseOptions,
|
|
2014
|
+
...incrementalOptions,
|
|
2015
|
+
"run",
|
|
2016
|
+
"package-relint"
|
|
2017
|
+
]]
|
|
2325
2018
|
]);
|
|
2326
|
-
console.log(
|
|
2019
|
+
console.log(chalk30.gray(`Relinted in [${chalk30.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk30.gray("seconds")}`));
|
|
2327
2020
|
return result;
|
|
2328
|
-
}
|
|
2021
|
+
};
|
|
2329
2022
|
|
|
2330
2023
|
// src/actions/retest.ts
|
|
2331
|
-
var retest =
|
|
2024
|
+
var retest = () => {
|
|
2332
2025
|
return runSteps("Test", [
|
|
2333
|
-
[
|
|
2334
|
-
|
|
2335
|
-
[
|
|
2336
|
-
"jest",
|
|
2337
|
-
"--clearCache"
|
|
2338
|
-
]
|
|
2339
|
-
],
|
|
2340
|
-
[
|
|
2341
|
-
"yarn",
|
|
2342
|
-
[
|
|
2343
|
-
"jest",
|
|
2344
|
-
"."
|
|
2345
|
-
]
|
|
2346
|
-
]
|
|
2026
|
+
["yarn", ["jest", "--clearCache"]],
|
|
2027
|
+
["yarn", ["jest", "."]]
|
|
2347
2028
|
]);
|
|
2348
|
-
}
|
|
2029
|
+
};
|
|
2349
2030
|
|
|
2350
2031
|
// 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");
|
|
2032
|
+
var sonar = () => {
|
|
2033
|
+
return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
|
|
2034
|
+
};
|
|
2364
2035
|
|
|
2365
2036
|
// 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"));
|
|
2037
|
+
import chalk31 from "chalk";
|
|
2038
|
+
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2039
|
+
var statics = () => {
|
|
2040
|
+
console.log(chalk31.green("Check Required Static Dependencies"));
|
|
2378
2041
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2379
2042
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2380
|
-
}
|
|
2043
|
+
};
|
|
2381
2044
|
|
|
2382
2045
|
// src/actions/test.ts
|
|
2383
|
-
var test =
|
|
2384
|
-
return runSteps("Test", [
|
|
2385
|
-
|
|
2386
|
-
"yarn",
|
|
2387
|
-
[
|
|
2388
|
-
"vitest",
|
|
2389
|
-
"."
|
|
2390
|
-
]
|
|
2391
|
-
]
|
|
2392
|
-
]);
|
|
2393
|
-
}, "test");
|
|
2046
|
+
var test = () => {
|
|
2047
|
+
return runSteps("Test", [["yarn", ["vitest", "."]]]);
|
|
2048
|
+
};
|
|
2394
2049
|
|
|
2395
2050
|
// src/actions/up.ts
|
|
2396
|
-
var up =
|
|
2397
|
-
return runSteps("Up", [
|
|
2398
|
-
|
|
2399
|
-
"yarn",
|
|
2400
|
-
"outdated"
|
|
2401
|
-
]
|
|
2402
|
-
]);
|
|
2403
|
-
}, "up");
|
|
2051
|
+
var up = () => {
|
|
2052
|
+
return runSteps("Up", [["yarn", "outdated"]]);
|
|
2053
|
+
};
|
|
2404
2054
|
|
|
2405
2055
|
// src/actions/updo.ts
|
|
2406
|
-
var updo =
|
|
2056
|
+
var updo = () => {
|
|
2407
2057
|
return runSteps("Updo", [
|
|
2408
|
-
[
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
],
|
|
2412
|
-
[
|
|
2413
|
-
"yarn",
|
|
2414
|
-
"upgrade-interactive"
|
|
2415
|
-
],
|
|
2416
|
-
[
|
|
2417
|
-
"yarn",
|
|
2418
|
-
"dedupe"
|
|
2419
|
-
]
|
|
2058
|
+
["yarn", "install"],
|
|
2059
|
+
["yarn", "upgrade-interactive"],
|
|
2060
|
+
["yarn", "dedupe"]
|
|
2420
2061
|
]);
|
|
2421
|
-
}
|
|
2062
|
+
};
|
|
2422
2063
|
|
|
2423
2064
|
// src/actions/upplug.ts
|
|
2424
|
-
var updateYarnPlugins =
|
|
2065
|
+
var updateYarnPlugins = () => {
|
|
2425
2066
|
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
|
-
]
|
|
2067
|
+
["yarn", ["plugin", "import", "https://mskelton.dev/yarn-outdated/v3"]],
|
|
2068
|
+
["yarn", ["plugin", "import", "version"]],
|
|
2069
|
+
["yarn", ["plugin", "import", "interactive-tools"]],
|
|
2070
|
+
["yarn", ["plugin", "import", "workspace-tools"]]
|
|
2458
2071
|
]);
|
|
2459
|
-
}
|
|
2072
|
+
};
|
|
2460
2073
|
|
|
2461
2074
|
// 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");
|
|
2075
|
+
var updateYarnVersion = () => {
|
|
2076
|
+
return runSteps("Update Yarn Version", [["yarn", ["set", "version", "latest"]]]);
|
|
2077
|
+
};
|
|
2474
2078
|
|
|
2475
2079
|
// src/actions/yarn3only.ts
|
|
2476
|
-
var yarn3Only =
|
|
2080
|
+
var yarn3Only = () => {
|
|
2477
2081
|
const [valid, version] = isYarnVersionOrGreater(3);
|
|
2478
2082
|
if (!valid) {
|
|
2479
2083
|
processEx(`Invalid Yarn version [${version}]`);
|
|
2480
2084
|
}
|
|
2481
2085
|
return 0;
|
|
2482
|
-
}
|
|
2086
|
+
};
|
|
2483
2087
|
|
|
2484
2088
|
// src/loadPackageConfig.ts
|
|
2485
2089
|
import { readFile } from "node:fs/promises";
|
|
2486
|
-
var loadPackageConfig =
|
|
2090
|
+
var loadPackageConfig = async () => {
|
|
2487
2091
|
const pkg = process.env.INIT_CWD;
|
|
2488
|
-
const pkgConfig = await readFile(`${pkg}/package.json`, {
|
|
2489
|
-
encoding: "utf8"
|
|
2490
|
-
});
|
|
2092
|
+
const pkgConfig = await readFile(`${pkg}/package.json`, { encoding: "utf8" });
|
|
2491
2093
|
return JSON.parse(pkgConfig);
|
|
2492
|
-
}
|
|
2094
|
+
};
|
|
2493
2095
|
|
|
2494
2096
|
// src/xy/xy.ts
|
|
2495
|
-
import
|
|
2097
|
+
import chalk33 from "chalk";
|
|
2496
2098
|
|
|
2497
2099
|
// 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
|
-
|
|
2100
|
+
var xyBuildCommands = (args) => {
|
|
2101
|
+
return args.command(
|
|
2102
|
+
"build [package]",
|
|
2103
|
+
"Build - Compile & Lint",
|
|
2104
|
+
(yargs2) => {
|
|
2105
|
+
return yargs2.positional("package", { describe: "Specific package to build" });
|
|
2106
|
+
},
|
|
2107
|
+
async (argv) => {
|
|
2108
|
+
if (argv.verbose) {
|
|
2109
|
+
console.log(`Building: ${argv.package ?? "all"}`);
|
|
2110
|
+
}
|
|
2111
|
+
process.exitCode = await build({
|
|
2112
|
+
incremental: !!argv.incremental,
|
|
2113
|
+
jobs: argv.jobs,
|
|
2114
|
+
pkg: argv.package,
|
|
2115
|
+
target: argv.target,
|
|
2116
|
+
verbose: !!argv.verbose
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
).command(
|
|
2120
|
+
"compile [package]",
|
|
2121
|
+
"Compile with Typescript & Copy Images",
|
|
2122
|
+
(yargs2) => {
|
|
2123
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2124
|
+
},
|
|
2125
|
+
(argv) => {
|
|
2126
|
+
if (argv.verbose) {
|
|
2127
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2128
|
+
}
|
|
2129
|
+
process.exitCode = compile({
|
|
2130
|
+
incremental: !!argv.incremental,
|
|
2131
|
+
jobs: argv.jobs,
|
|
2132
|
+
pkg: argv.package,
|
|
2133
|
+
target: argv.target,
|
|
2134
|
+
verbose: !!argv.verbose
|
|
2135
|
+
});
|
|
2136
|
+
}
|
|
2137
|
+
).command(
|
|
2138
|
+
"compile-types [package]",
|
|
2139
|
+
"Compile types with Typescript",
|
|
2140
|
+
(yargs2) => {
|
|
2141
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2142
|
+
},
|
|
2143
|
+
(argv) => {
|
|
2144
|
+
if (argv.verbose) {
|
|
2145
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2146
|
+
}
|
|
2147
|
+
process.exitCode = compileTypes({
|
|
2148
|
+
incremental: !!argv.incremental,
|
|
2149
|
+
jobs: argv.jobs,
|
|
2150
|
+
pkg: argv.package,
|
|
2151
|
+
verbose: !!argv.verbose
|
|
2152
|
+
});
|
|
2153
|
+
}
|
|
2154
|
+
).command(
|
|
2155
|
+
"compile-only [package]",
|
|
2156
|
+
"Compile with Typescript & Copy Images (No Publint)",
|
|
2157
|
+
(yargs2) => {
|
|
2158
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2159
|
+
},
|
|
2160
|
+
(argv) => {
|
|
2161
|
+
if (argv.verbose) {
|
|
2162
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2163
|
+
}
|
|
2164
|
+
process.exitCode = compile({
|
|
2165
|
+
incremental: !!argv.incremental,
|
|
2166
|
+
jobs: argv.jobs,
|
|
2167
|
+
pkg: argv.package,
|
|
2168
|
+
publint: false,
|
|
2169
|
+
target: argv.target,
|
|
2170
|
+
verbose: !!argv.verbose
|
|
2171
|
+
});
|
|
2172
|
+
}
|
|
2173
|
+
).command(
|
|
2174
|
+
"recompile [package]",
|
|
2175
|
+
"Re-compile with Typescript & Copy Images",
|
|
2176
|
+
(yargs2) => {
|
|
2177
|
+
return yargs2.positional("package", { describe: "Specific package to re-compile" });
|
|
2178
|
+
},
|
|
2179
|
+
async (argv) => {
|
|
2180
|
+
if (argv.verbose) {
|
|
2181
|
+
console.log(`Re-compiling: ${argv.package ?? "all"}`);
|
|
2182
|
+
}
|
|
2183
|
+
process.exitCode = await recompile({
|
|
2184
|
+
incremental: !!argv.incremental,
|
|
2185
|
+
jobs: argv.jobs,
|
|
2186
|
+
pkg: argv.package,
|
|
2187
|
+
target: argv.target,
|
|
2188
|
+
verbose: !!argv.verbose
|
|
2189
|
+
});
|
|
2190
|
+
}
|
|
2191
|
+
).command(
|
|
2192
|
+
"rebuild [package]",
|
|
2193
|
+
"Rebuild - Clean, Compile & Lint",
|
|
2194
|
+
(yargs2) => {
|
|
2195
|
+
return yargs2.positional("package", { describe: "Specific package to rebuild" });
|
|
2196
|
+
},
|
|
2197
|
+
(argv) => {
|
|
2198
|
+
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
|
|
2199
|
+
process.exitCode = rebuild({ target: argv.target });
|
|
2200
|
+
}
|
|
2201
|
+
).command(
|
|
2202
|
+
"copy-assets [package]",
|
|
2203
|
+
"Copy Assets - Copy the assets from src to dist",
|
|
2204
|
+
(yargs2) => {
|
|
2205
|
+
return yargs2.positional("package", { describe: "Specific package to copy assets" });
|
|
2206
|
+
},
|
|
2207
|
+
async (argv) => {
|
|
2208
|
+
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
|
|
2209
|
+
process.exitCode = await copyAssets({ target: argv.target });
|
|
2210
|
+
}
|
|
2211
|
+
);
|
|
2212
|
+
};
|
|
2594
2213
|
|
|
2595
2214
|
// src/xy/param.ts
|
|
2596
|
-
var packagePositionalParam =
|
|
2597
|
-
return yargs2.positional("package", {
|
|
2598
|
-
|
|
2599
|
-
});
|
|
2600
|
-
}, "packagePositionalParam");
|
|
2215
|
+
var packagePositionalParam = (yargs2) => {
|
|
2216
|
+
return yargs2.positional("package", { describe: "Specific package to target" });
|
|
2217
|
+
};
|
|
2601
2218
|
|
|
2602
2219
|
// 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
|
-
|
|
2220
|
+
var xyCommonCommands = (args) => {
|
|
2221
|
+
return args.command(
|
|
2222
|
+
"license [package]",
|
|
2223
|
+
"License - Check licenses of dependencies",
|
|
2224
|
+
(yargs2) => {
|
|
2225
|
+
return packagePositionalParam(yargs2);
|
|
2226
|
+
},
|
|
2227
|
+
async (argv) => {
|
|
2228
|
+
if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
|
|
2229
|
+
process.exitCode = await license();
|
|
2230
|
+
}
|
|
2231
|
+
).command(
|
|
2232
|
+
"dead [package]",
|
|
2233
|
+
"Dead - Check for dead code",
|
|
2234
|
+
(yargs2) => {
|
|
2235
|
+
return packagePositionalParam(yargs2);
|
|
2236
|
+
},
|
|
2237
|
+
(argv) => {
|
|
2238
|
+
if (argv.verbose) console.log("Dead");
|
|
2239
|
+
process.exitCode = dead();
|
|
2240
|
+
}
|
|
2241
|
+
).command(
|
|
2242
|
+
"gen-docs [package]",
|
|
2243
|
+
"GenDocs - Generate TypeDocs",
|
|
2244
|
+
(yargs2) => {
|
|
2245
|
+
return packagePositionalParam(yargs2);
|
|
2246
|
+
},
|
|
2247
|
+
(argv) => {
|
|
2248
|
+
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
2249
|
+
process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
|
|
2250
|
+
}
|
|
2251
|
+
).command(
|
|
2252
|
+
"clean-docs",
|
|
2253
|
+
"CleanDocs - Clean TypeDocs",
|
|
2254
|
+
(yargs2) => yargs2,
|
|
2255
|
+
(argv) => {
|
|
2256
|
+
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
2257
|
+
process.exitCode = cleanDocs();
|
|
2258
|
+
}
|
|
2259
|
+
).command(
|
|
2260
|
+
"gitlint [package]",
|
|
2261
|
+
"Gitlint - Lint your git config",
|
|
2262
|
+
(yargs2) => {
|
|
2263
|
+
return yargs2;
|
|
2264
|
+
},
|
|
2265
|
+
(argv) => {
|
|
2266
|
+
if (argv.verbose) console.log("Gitlint");
|
|
2267
|
+
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
2268
|
+
}
|
|
2269
|
+
).command(
|
|
2270
|
+
"gitignore-gen",
|
|
2271
|
+
"GitIgnore Gen - Generate .gitignore files",
|
|
2272
|
+
(yargs2) => {
|
|
2273
|
+
return yargs2;
|
|
2274
|
+
},
|
|
2275
|
+
(argv) => {
|
|
2276
|
+
if (argv.verbose) console.log("GitIgnore Gen");
|
|
2277
|
+
process.exitCode = gitignoreGen();
|
|
2278
|
+
}
|
|
2279
|
+
).command(
|
|
2280
|
+
"npmignore-gen",
|
|
2281
|
+
"NpmIgnore Gen - Generate .npmignore files",
|
|
2282
|
+
(yargs2) => {
|
|
2283
|
+
return yargs2;
|
|
2284
|
+
},
|
|
2285
|
+
(argv) => {
|
|
2286
|
+
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
2287
|
+
process.exitCode = npmignoreGen();
|
|
2288
|
+
}
|
|
2289
|
+
).command(
|
|
2290
|
+
"retest",
|
|
2291
|
+
"Re-Test - Run Jest Tests with cleaned cache",
|
|
2292
|
+
(yargs2) => {
|
|
2293
|
+
return yargs2;
|
|
2294
|
+
},
|
|
2295
|
+
(argv) => {
|
|
2296
|
+
if (argv.verbose) console.log("Re-Testing");
|
|
2297
|
+
process.exitCode = retest();
|
|
2298
|
+
}
|
|
2299
|
+
).command(
|
|
2300
|
+
"test",
|
|
2301
|
+
"Test - Run Jest Tests",
|
|
2302
|
+
(yargs2) => {
|
|
2303
|
+
return yargs2;
|
|
2304
|
+
},
|
|
2305
|
+
(argv) => {
|
|
2306
|
+
if (argv.verbose) console.log("Testing");
|
|
2307
|
+
process.exitCode = test();
|
|
2308
|
+
}
|
|
2309
|
+
).command(
|
|
2310
|
+
"upplug",
|
|
2311
|
+
"UpPlug - Update Yarn Plugins",
|
|
2312
|
+
(yargs2) => {
|
|
2313
|
+
return yargs2;
|
|
2314
|
+
},
|
|
2315
|
+
(argv) => {
|
|
2316
|
+
if (argv.verbose) console.log("UpPlug");
|
|
2317
|
+
process.exitCode = updateYarnPlugins();
|
|
2318
|
+
}
|
|
2319
|
+
).command(
|
|
2320
|
+
"upyarn",
|
|
2321
|
+
"UpYarn - Update Yarn Version",
|
|
2322
|
+
(yargs2) => {
|
|
2323
|
+
return yargs2;
|
|
2324
|
+
},
|
|
2325
|
+
(argv) => {
|
|
2326
|
+
if (argv.verbose) console.log("UpYarn");
|
|
2327
|
+
process.exitCode = updateYarnVersion();
|
|
2328
|
+
}
|
|
2329
|
+
).command(
|
|
2330
|
+
"yarn3only",
|
|
2331
|
+
"Yarn3Only - Check if using Yarn v3",
|
|
2332
|
+
(yargs2) => {
|
|
2333
|
+
return yargs2;
|
|
2334
|
+
},
|
|
2335
|
+
(argv) => {
|
|
2336
|
+
if (argv.verbose) console.log("Yarn 3 Check");
|
|
2337
|
+
process.exitCode = yarn3Only();
|
|
2338
|
+
}
|
|
2339
|
+
);
|
|
2340
|
+
};
|
|
2667
2341
|
|
|
2668
2342
|
// 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
|
-
|
|
2343
|
+
var xyDeployCommands = (args) => {
|
|
2344
|
+
return args.command(
|
|
2345
|
+
"deploy",
|
|
2346
|
+
"Deploy - Deploy patch",
|
|
2347
|
+
(yargs2) => {
|
|
2348
|
+
return yargs2;
|
|
2349
|
+
},
|
|
2350
|
+
(argv) => {
|
|
2351
|
+
if (argv.verbose) console.log("Deploy patch");
|
|
2352
|
+
process.exitCode = deploy();
|
|
2353
|
+
}
|
|
2354
|
+
).command(
|
|
2355
|
+
"deploy-minor",
|
|
2356
|
+
"Deploy - Deploy minor",
|
|
2357
|
+
(yargs2) => {
|
|
2358
|
+
return yargs2;
|
|
2359
|
+
},
|
|
2360
|
+
(argv) => {
|
|
2361
|
+
if (argv.verbose) console.log("Deploy minor");
|
|
2362
|
+
process.exitCode = deployMinor();
|
|
2363
|
+
}
|
|
2364
|
+
).command(
|
|
2365
|
+
"deploy-major",
|
|
2366
|
+
"Deploy - Deploy major",
|
|
2367
|
+
(yargs2) => {
|
|
2368
|
+
return yargs2;
|
|
2369
|
+
},
|
|
2370
|
+
(argv) => {
|
|
2371
|
+
if (argv.verbose) console.log("Deploy major");
|
|
2372
|
+
process.exitCode = deployMajor();
|
|
2373
|
+
}
|
|
2374
|
+
).command(
|
|
2375
|
+
"deploy-next",
|
|
2376
|
+
"Deploy - Deploy next",
|
|
2377
|
+
(yargs2) => {
|
|
2378
|
+
return yargs2;
|
|
2379
|
+
},
|
|
2380
|
+
(argv) => {
|
|
2381
|
+
if (argv.verbose) console.log("Deploy next");
|
|
2382
|
+
process.exitCode = deployNext();
|
|
2383
|
+
}
|
|
2384
|
+
);
|
|
2385
|
+
};
|
|
2692
2386
|
|
|
2693
2387
|
// src/xy/xyInstallCommands.ts
|
|
2694
|
-
var xyInstallCommands =
|
|
2695
|
-
return args.command(
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2388
|
+
var xyInstallCommands = (args) => {
|
|
2389
|
+
return args.command(
|
|
2390
|
+
"clean [package]",
|
|
2391
|
+
"Clean",
|
|
2392
|
+
(yargs2) => {
|
|
2393
|
+
return yargs2.positional("package", { describe: "Specific package to clean" });
|
|
2394
|
+
},
|
|
2395
|
+
async (argv) => {
|
|
2396
|
+
if (argv.verbose) {
|
|
2397
|
+
console.log(`Cleaning: ${argv.package ?? "all"}`);
|
|
2398
|
+
}
|
|
2399
|
+
process.exitCode = await clean({
|
|
2400
|
+
pkg: argv.package,
|
|
2401
|
+
verbose: !!argv.verbose
|
|
2402
|
+
});
|
|
2702
2403
|
}
|
|
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
|
-
|
|
2404
|
+
).command(
|
|
2405
|
+
"reinstall",
|
|
2406
|
+
"Reinstall - Clean & Install",
|
|
2407
|
+
(yargs2) => {
|
|
2408
|
+
return yargs2;
|
|
2409
|
+
},
|
|
2410
|
+
(argv) => {
|
|
2411
|
+
if (argv.verbose) console.log("Reinstalling");
|
|
2412
|
+
process.exitCode = reinstall();
|
|
2413
|
+
}
|
|
2414
|
+
).command(
|
|
2415
|
+
"up",
|
|
2416
|
+
"Up - Update dependencies",
|
|
2417
|
+
(yargs2) => {
|
|
2418
|
+
return yargs2;
|
|
2419
|
+
},
|
|
2420
|
+
(argv) => {
|
|
2421
|
+
if (argv.verbose) console.log("Up");
|
|
2422
|
+
process.exitCode = up();
|
|
2423
|
+
}
|
|
2424
|
+
).command(
|
|
2425
|
+
"updo",
|
|
2426
|
+
"Updo - Update dependencies [Interactive]",
|
|
2427
|
+
(yargs2) => {
|
|
2428
|
+
return yargs2;
|
|
2429
|
+
},
|
|
2430
|
+
(argv) => {
|
|
2431
|
+
if (argv.verbose) console.log("Updo");
|
|
2432
|
+
process.exitCode = updo();
|
|
2433
|
+
}
|
|
2434
|
+
).command(
|
|
2435
|
+
"statics",
|
|
2436
|
+
"Statics - Confirming Static Packages",
|
|
2437
|
+
(yargs2) => {
|
|
2438
|
+
return yargs2;
|
|
2439
|
+
},
|
|
2440
|
+
(argv) => {
|
|
2441
|
+
if (argv.verbose) console.log("Statics");
|
|
2442
|
+
process.exitCode = statics();
|
|
2443
|
+
}
|
|
2444
|
+
).command(
|
|
2445
|
+
"dupdeps",
|
|
2446
|
+
"Dupdeps - Duplicate Dependencies in package.json",
|
|
2447
|
+
(yargs2) => {
|
|
2448
|
+
return yargs2;
|
|
2449
|
+
},
|
|
2450
|
+
(argv) => {
|
|
2451
|
+
if (argv.verbose) console.log("Dupdeps");
|
|
2452
|
+
process.exitCode = dupdeps();
|
|
2453
|
+
}
|
|
2454
|
+
);
|
|
2455
|
+
};
|
|
2734
2456
|
|
|
2735
2457
|
// 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
|
-
}
|
|
2458
|
+
import chalk32 from "chalk";
|
|
2459
|
+
var xyLintCommands = (args) => {
|
|
2460
|
+
return args.command(
|
|
2461
|
+
"cycle [package]",
|
|
2462
|
+
"Cycle - Check for dependency cycles",
|
|
2463
|
+
(yargs2) => {
|
|
2464
|
+
return packagePositionalParam(yargs2);
|
|
2465
|
+
},
|
|
2466
|
+
async (argv) => {
|
|
2467
|
+
const start = Date.now();
|
|
2468
|
+
if (argv.verbose) console.log("Cycle");
|
|
2469
|
+
process.exitCode = await cycle({ pkg: argv.package });
|
|
2470
|
+
console.log(chalk32.blue(`Finished in ${Date.now() - start}ms`));
|
|
2471
|
+
}
|
|
2472
|
+
).command(
|
|
2473
|
+
"lint [package]",
|
|
2474
|
+
"Lint - Run Eslint",
|
|
2475
|
+
(yargs2) => {
|
|
2476
|
+
return packagePositionalParam(yargs2);
|
|
2477
|
+
},
|
|
2478
|
+
(argv) => {
|
|
2479
|
+
if (argv.verbose) console.log("Lint");
|
|
2480
|
+
const start = Date.now();
|
|
2481
|
+
process.exitCode = argv.fix ? fix({ pkg: argv.package }) : lint({ pkg: argv.package });
|
|
2482
|
+
console.log(chalk32.blue(`Finished in ${Date.now() - start}ms`));
|
|
2483
|
+
}
|
|
2484
|
+
).command(
|
|
2485
|
+
"deplint [package]",
|
|
2486
|
+
"Deplint - Run Deplint",
|
|
2487
|
+
(yargs2) => {
|
|
2488
|
+
return packagePositionalParam(yargs2);
|
|
2489
|
+
},
|
|
2490
|
+
(argv) => {
|
|
2491
|
+
if (argv.verbose) console.log("Deplint");
|
|
2492
|
+
const start = Date.now();
|
|
2493
|
+
process.exitCode = deplint({ pkg: argv.package });
|
|
2494
|
+
console.log(chalk32.blue(`Finished in ${Date.now() - start}ms`));
|
|
2495
|
+
}
|
|
2496
|
+
).command(
|
|
2497
|
+
"fix [package]",
|
|
2498
|
+
"Fix - Run Eslint w/fix",
|
|
2499
|
+
(yargs2) => {
|
|
2500
|
+
return packagePositionalParam(yargs2);
|
|
2501
|
+
},
|
|
2502
|
+
(argv) => {
|
|
2503
|
+
const start = Date.now();
|
|
2504
|
+
if (argv.verbose) console.log("Fix");
|
|
2505
|
+
process.exitCode = fix();
|
|
2506
|
+
console.log(chalk32.blue(`Finished in ${Date.now() - start}ms`));
|
|
2507
|
+
}
|
|
2508
|
+
).command(
|
|
2509
|
+
"relint [package]",
|
|
2510
|
+
"Relint - Clean & Lint",
|
|
2511
|
+
(yargs2) => {
|
|
2512
|
+
return packagePositionalParam(yargs2);
|
|
2513
|
+
},
|
|
2514
|
+
(argv) => {
|
|
2515
|
+
if (argv.verbose) console.log("Relinting");
|
|
2516
|
+
const start = Date.now();
|
|
2517
|
+
process.exitCode = relint();
|
|
2518
|
+
console.log(chalk32.blue(`Finished in ${Date.now() - start}ms`));
|
|
2519
|
+
}
|
|
2520
|
+
).command(
|
|
2521
|
+
"publint [package]",
|
|
2522
|
+
"Publint - Run Publint",
|
|
2523
|
+
(yargs2) => {
|
|
2524
|
+
return packagePositionalParam(yargs2);
|
|
2525
|
+
},
|
|
2526
|
+
async (argv) => {
|
|
2527
|
+
if (argv.verbose) console.log("Publint");
|
|
2528
|
+
const start = Date.now();
|
|
2529
|
+
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2530
|
+
console.log(chalk32.blue(`Finished in ${Date.now() - start}ms`));
|
|
2531
|
+
}
|
|
2532
|
+
).command(
|
|
2533
|
+
"knip",
|
|
2534
|
+
"Knip - Run Knip",
|
|
2535
|
+
(yargs2) => {
|
|
2536
|
+
return packagePositionalParam(yargs2);
|
|
2537
|
+
},
|
|
2538
|
+
(argv) => {
|
|
2539
|
+
if (argv.verbose) console.log("Knip");
|
|
2540
|
+
const start = Date.now();
|
|
2541
|
+
process.exitCode = knip();
|
|
2542
|
+
console.log(chalk32.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2543
|
+
}
|
|
2544
|
+
).command(
|
|
2545
|
+
"sonar",
|
|
2546
|
+
"Sonar - Run Sonar Check",
|
|
2547
|
+
(yargs2) => {
|
|
2548
|
+
return packagePositionalParam(yargs2);
|
|
2549
|
+
},
|
|
2550
|
+
(argv) => {
|
|
2551
|
+
const start = Date.now();
|
|
2552
|
+
if (argv.verbose) console.log("Sonar Check");
|
|
2553
|
+
process.exitCode = sonar();
|
|
2554
|
+
console.log(chalk32.blue(`Finished in ${Date.now() - start}ms`));
|
|
2555
|
+
}
|
|
2556
|
+
);
|
|
2557
|
+
};
|
|
2798
2558
|
|
|
2799
2559
|
// src/xy/xyParseOptions.ts
|
|
2800
2560
|
import yargs from "yargs";
|
|
2801
2561
|
import { hideBin } from "yargs/helpers";
|
|
2802
|
-
var xyParseOptions =
|
|
2562
|
+
var xyParseOptions = () => {
|
|
2803
2563
|
return yargs(hideBin(process.argv)).scriptName("yarn xy").option("jobs", {
|
|
2804
2564
|
alias: "j",
|
|
2805
2565
|
default: void 0,
|
|
@@ -2813,10 +2573,7 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2813
2573
|
}).option("target", {
|
|
2814
2574
|
alias: "t",
|
|
2815
2575
|
default: "esm",
|
|
2816
|
-
choices: [
|
|
2817
|
-
"esm",
|
|
2818
|
-
"cjs"
|
|
2819
|
-
],
|
|
2576
|
+
choices: ["esm", "cjs"],
|
|
2820
2577
|
description: "Limit output to specific target",
|
|
2821
2578
|
type: "string"
|
|
2822
2579
|
}).option("incremental", {
|
|
@@ -2841,23 +2598,20 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2841
2598
|
type: "boolean"
|
|
2842
2599
|
}).option("types", {
|
|
2843
2600
|
default: "tsc",
|
|
2844
|
-
choices: [
|
|
2845
|
-
"tsc",
|
|
2846
|
-
"tsup"
|
|
2847
|
-
],
|
|
2601
|
+
choices: ["tsc", "tsup"],
|
|
2848
2602
|
description: "Tool to generate Typescript types",
|
|
2849
2603
|
type: "string"
|
|
2850
2604
|
});
|
|
2851
|
-
}
|
|
2605
|
+
};
|
|
2852
2606
|
|
|
2853
2607
|
// src/xy/xy.ts
|
|
2854
|
-
var xy =
|
|
2608
|
+
var xy = async () => {
|
|
2855
2609
|
const options = xyParseOptions();
|
|
2856
2610
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2857
|
-
console.error(
|
|
2858
|
-
console.log(
|
|
2611
|
+
console.error(chalk33.yellow(`Command not found [${chalk33.magenta(process.argv[2])}]`));
|
|
2612
|
+
console.log(chalk33.gray("Try 'yarn xy --help' for list of commands"));
|
|
2859
2613
|
}).version().help().argv;
|
|
2860
|
-
}
|
|
2614
|
+
};
|
|
2861
2615
|
export {
|
|
2862
2616
|
CROSS_PLATFORM_NEWLINE,
|
|
2863
2617
|
DuplicateDetector,
|
|
@@ -2884,6 +2638,7 @@ export {
|
|
|
2884
2638
|
defaultBuildConfig,
|
|
2885
2639
|
defaultReadFileSyncOptions,
|
|
2886
2640
|
deleteGlob,
|
|
2641
|
+
deplint,
|
|
2887
2642
|
deploy,
|
|
2888
2643
|
deployMajor,
|
|
2889
2644
|
deployMinor,
|