@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
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/xy/xyLintCommands.ts
|
|
5
|
-
import
|
|
2
|
+
import chalk8 from "chalk";
|
|
6
3
|
|
|
7
4
|
// src/lib/checkResult.ts
|
|
8
5
|
import chalk from "chalk";
|
|
9
|
-
var checkResult =
|
|
6
|
+
var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
10
7
|
if (result) {
|
|
11
8
|
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
12
9
|
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
@@ -15,23 +12,23 @@ 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/processEx.ts
|
|
21
18
|
import chalk2 from "chalk";
|
|
22
19
|
|
|
23
20
|
// src/lib/withError.ts
|
|
24
|
-
var withError =
|
|
21
|
+
var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
25
22
|
return predicate(ex) ? closure(ex) : void 0;
|
|
26
|
-
}
|
|
23
|
+
};
|
|
27
24
|
|
|
28
25
|
// src/lib/withErrnoException.ts
|
|
29
|
-
var withErrnoException =
|
|
26
|
+
var withErrnoException = (ex, closure) => {
|
|
30
27
|
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
31
|
-
}
|
|
28
|
+
};
|
|
32
29
|
|
|
33
30
|
// src/lib/processEx.ts
|
|
34
|
-
var processEx =
|
|
31
|
+
var processEx = (ex) => {
|
|
35
32
|
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
36
33
|
const exitCode = withErrnoException(error, (error2) => {
|
|
37
34
|
if (error2.code === "ENOENT") {
|
|
@@ -48,10 +45,10 @@ var processEx = /* @__PURE__ */ __name((ex) => {
|
|
|
48
45
|
return -1;
|
|
49
46
|
})();
|
|
50
47
|
process.exit(process.exitCode ?? exitCode);
|
|
51
|
-
}
|
|
48
|
+
};
|
|
52
49
|
|
|
53
50
|
// src/lib/safeExit.ts
|
|
54
|
-
var safeExit =
|
|
51
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
55
52
|
try {
|
|
56
53
|
const result = func();
|
|
57
54
|
if (result && exitOnFail) {
|
|
@@ -61,8 +58,8 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
|
61
58
|
} catch (ex) {
|
|
62
59
|
return processEx(ex);
|
|
63
60
|
}
|
|
64
|
-
}
|
|
65
|
-
var safeExitAsync =
|
|
61
|
+
};
|
|
62
|
+
var safeExitAsync = async (func, exitOnFail = true) => {
|
|
66
63
|
try {
|
|
67
64
|
const result = await func();
|
|
68
65
|
if (result && exitOnFail) {
|
|
@@ -72,13 +69,32 @@ var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
|
|
|
72
69
|
} catch (ex) {
|
|
73
70
|
return processEx(ex);
|
|
74
71
|
}
|
|
75
|
-
}
|
|
72
|
+
};
|
|
76
73
|
|
|
77
|
-
// src/lib/
|
|
74
|
+
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
78
75
|
import { spawnSync } from "node:child_process";
|
|
76
|
+
var yarnWorkspaces = () => {
|
|
77
|
+
const result = spawnSync("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
78
|
+
if (result.error) {
|
|
79
|
+
throw result.error;
|
|
80
|
+
}
|
|
81
|
+
return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
|
|
82
|
+
return JSON.parse(item);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// src/lib/yarn/workspace/yarnWorkspace.ts
|
|
87
|
+
var yarnWorkspace = (pkg) => {
|
|
88
|
+
const workspace = yarnWorkspaces().find(({ name }) => name === pkg);
|
|
89
|
+
if (!workspace) throw new Error(`Workspace ${pkg} not found`);
|
|
90
|
+
return workspace;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/lib/runSteps.ts
|
|
94
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
79
95
|
import { existsSync } from "node:fs";
|
|
80
96
|
import chalk3 from "chalk";
|
|
81
|
-
var runSteps =
|
|
97
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
82
98
|
return safeExit(() => {
|
|
83
99
|
const pkgName = process.env.npm_package_name;
|
|
84
100
|
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
@@ -91,13 +107,10 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
91
107
|
if (command === "node" && !existsSync(argList[0])) {
|
|
92
108
|
throw new Error(`File not found [${argList[0]}]`);
|
|
93
109
|
}
|
|
94
|
-
const status =
|
|
110
|
+
const status = spawnSync2(command, Array.isArray(args) ? args : args.split(" "), {
|
|
95
111
|
...config,
|
|
96
112
|
encoding: "utf8",
|
|
97
|
-
env: {
|
|
98
|
-
FORCE_COLOR: "3",
|
|
99
|
-
...process.env
|
|
100
|
-
},
|
|
113
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
101
114
|
shell: true,
|
|
102
115
|
stdio: "inherit"
|
|
103
116
|
}).status ?? 0;
|
|
@@ -106,13 +119,13 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
106
119
|
}
|
|
107
120
|
return totalStatus;
|
|
108
121
|
}, !!exitOnFail);
|
|
109
|
-
}
|
|
122
|
+
};
|
|
110
123
|
|
|
111
124
|
// src/lib/runStepsAsync.ts
|
|
112
125
|
import { spawn } from "node:child_process";
|
|
113
126
|
import { existsSync as existsSync2 } from "node:fs";
|
|
114
127
|
import chalk4 from "chalk";
|
|
115
|
-
var runStepAsync =
|
|
128
|
+
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
116
129
|
return new Promise((resolve) => {
|
|
117
130
|
const [command, args, config] = step;
|
|
118
131
|
if (message) {
|
|
@@ -124,15 +137,18 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
|
|
|
124
137
|
}
|
|
125
138
|
spawn(command, Array.isArray(args) ? args : args.split(" "), {
|
|
126
139
|
...config,
|
|
127
|
-
env: {
|
|
128
|
-
FORCE_COLOR: "3",
|
|
129
|
-
...process.env
|
|
130
|
-
},
|
|
140
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
131
141
|
shell: true,
|
|
132
142
|
stdio: "inherit"
|
|
133
143
|
}).on("close", (code) => {
|
|
134
144
|
if (code) {
|
|
135
|
-
console.error(
|
|
145
|
+
console.error(
|
|
146
|
+
chalk4.red(
|
|
147
|
+
`Command Exited With Non-Zero Result [${chalk4.gray(code)}] | ${chalk4.yellow(command)} ${chalk4.white(
|
|
148
|
+
Array.isArray(args) ? args.join(" ") : args
|
|
149
|
+
)}`
|
|
150
|
+
)
|
|
151
|
+
);
|
|
136
152
|
checkResult(name, code, "error", exitOnFail);
|
|
137
153
|
resolve(code);
|
|
138
154
|
} else {
|
|
@@ -140,8 +156,8 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
|
|
|
140
156
|
}
|
|
141
157
|
});
|
|
142
158
|
});
|
|
143
|
-
}
|
|
144
|
-
var runStepsAsync =
|
|
159
|
+
};
|
|
160
|
+
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
145
161
|
return await safeExitAsync(async () => {
|
|
146
162
|
const pkgName = process.env.npm_package_name;
|
|
147
163
|
console.log(chalk4.green(`${name} [${pkgName}]`));
|
|
@@ -151,38 +167,21 @@ var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true
|
|
|
151
167
|
}
|
|
152
168
|
return result;
|
|
153
169
|
});
|
|
154
|
-
}
|
|
170
|
+
};
|
|
155
171
|
|
|
156
172
|
// src/actions/cycle.ts
|
|
157
173
|
import { cruise } from "dependency-cruiser";
|
|
158
|
-
var cycle =
|
|
159
|
-
return pkg ? cyclePackage({
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
] : [
|
|
170
|
-
"--no-verbose"
|
|
171
|
-
];
|
|
172
|
-
return runSteps(`Cycle [${pkg}]`, [
|
|
173
|
-
[
|
|
174
|
-
"yarn",
|
|
175
|
-
[
|
|
176
|
-
"workspace",
|
|
177
|
-
pkg,
|
|
178
|
-
"run",
|
|
179
|
-
"package-cycle",
|
|
180
|
-
...verboseOptions
|
|
181
|
-
]
|
|
182
|
-
]
|
|
183
|
-
]);
|
|
184
|
-
}, "cyclePackage");
|
|
185
|
-
var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
174
|
+
var cycle = async ({ verbose, pkg } = {}) => {
|
|
175
|
+
return pkg ? cyclePackage({ pkg, verbose }) : await cycleAll({ verbose });
|
|
176
|
+
};
|
|
177
|
+
var cyclePackage = ({ pkg, verbose }) => {
|
|
178
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
179
|
+
return runSteps(
|
|
180
|
+
`Cycle [${pkg}]`,
|
|
181
|
+
[["yarn", ["workspace", pkg, "run", "package-cycle", ...verboseOptions]]]
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
var cycleAll = async ({ verbose = false }) => {
|
|
186
185
|
const pkgName = process.env.npm_package_name;
|
|
187
186
|
const cruiseOptions = {
|
|
188
187
|
ruleSet: {
|
|
@@ -192,26 +191,20 @@ var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
192
191
|
severity: "error",
|
|
193
192
|
comment: "This dependency creates a circular reference",
|
|
194
193
|
from: {},
|
|
195
|
-
to: {
|
|
196
|
-
circular: true
|
|
197
|
-
}
|
|
194
|
+
to: { circular: true }
|
|
198
195
|
}
|
|
199
196
|
]
|
|
200
197
|
},
|
|
201
198
|
exclude: "node_modules|packages/.*/packages",
|
|
202
199
|
validate: true,
|
|
203
|
-
doNotFollow: {
|
|
204
|
-
path: "node_modules|packages/.*/packages"
|
|
205
|
-
},
|
|
200
|
+
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
206
201
|
tsPreCompilationDeps: false,
|
|
207
202
|
combinedDependencies: true,
|
|
208
203
|
outputType: verbose ? "text" : "err"
|
|
209
204
|
};
|
|
210
205
|
const target = "**/src";
|
|
211
206
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
212
|
-
const result = await cruise([
|
|
213
|
-
target
|
|
214
|
-
], cruiseOptions);
|
|
207
|
+
const result = await cruise([target], cruiseOptions);
|
|
215
208
|
if (result.output) {
|
|
216
209
|
console.log(result.output);
|
|
217
210
|
}
|
|
@@ -221,264 +214,392 @@ var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
221
214
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
222
215
|
}
|
|
223
216
|
return result.exitCode;
|
|
224
|
-
}
|
|
217
|
+
};
|
|
225
218
|
|
|
226
|
-
// src/actions/
|
|
219
|
+
// src/actions/deplint.ts
|
|
220
|
+
import fs from "node:fs";
|
|
221
|
+
import path from "node:path";
|
|
227
222
|
import chalk5 from "chalk";
|
|
228
|
-
|
|
229
|
-
|
|
223
|
+
import { globSync } from "glob";
|
|
224
|
+
import ts from "typescript";
|
|
225
|
+
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
226
|
+
const packageJsonFullPath = path.resolve(packageJsonPath);
|
|
227
|
+
const rawContent = fs.readFileSync(packageJsonFullPath, "utf8");
|
|
228
|
+
const packageJson = JSON.parse(rawContent);
|
|
229
|
+
const dependencies = packageJson.dependencies ? Object.keys(packageJson.dependencies) : [];
|
|
230
|
+
const devDependencies = packageJson.devDependencies ? Object.keys(packageJson.devDependencies) : [];
|
|
231
|
+
const peerDependencies = packageJson.peerDependencies ? Object.keys(packageJson.peerDependencies) : [];
|
|
232
|
+
return {
|
|
233
|
+
dependencies,
|
|
234
|
+
devDependencies,
|
|
235
|
+
peerDependencies
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function getBasePackageName(importName) {
|
|
239
|
+
if (importName.startsWith("@")) {
|
|
240
|
+
const parts = importName.split("/");
|
|
241
|
+
return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importName;
|
|
242
|
+
}
|
|
243
|
+
return importName.split("/")[0];
|
|
244
|
+
}
|
|
245
|
+
function getImportsFromFile(filePath, importPaths) {
|
|
246
|
+
const sourceCode = fs.readFileSync(filePath, "utf8");
|
|
247
|
+
const sourceFile = ts.createSourceFile(
|
|
248
|
+
path.basename(filePath),
|
|
249
|
+
sourceCode,
|
|
250
|
+
ts.ScriptTarget.Latest,
|
|
251
|
+
true
|
|
252
|
+
);
|
|
253
|
+
const imports = [];
|
|
254
|
+
function visit(node) {
|
|
255
|
+
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
256
|
+
const moduleSpecifier = node.moduleSpecifier?.getFullText();
|
|
257
|
+
if (moduleSpecifier) {
|
|
258
|
+
const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
|
|
259
|
+
imports.push(trimmed);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
ts.forEachChild(node, visit);
|
|
263
|
+
}
|
|
264
|
+
visit(sourceFile);
|
|
265
|
+
const cleanedImports = imports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:")).map(getBasePackageName);
|
|
266
|
+
for (const imp of cleanedImports) {
|
|
267
|
+
importPaths[imp] = importPaths[imp] || [];
|
|
268
|
+
importPaths[imp].push(filePath);
|
|
269
|
+
}
|
|
270
|
+
return cleanedImports;
|
|
271
|
+
}
|
|
272
|
+
function findFilesByGlob(cwd, pattern) {
|
|
273
|
+
return globSync(pattern, { cwd, absolute: true });
|
|
274
|
+
}
|
|
275
|
+
function findFiles(path2) {
|
|
276
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
277
|
+
const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
|
|
278
|
+
const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
|
|
279
|
+
const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path2, pattern));
|
|
280
|
+
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
281
|
+
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
282
|
+
return {
|
|
283
|
+
allSourceFiles,
|
|
284
|
+
prodSourceFiles,
|
|
285
|
+
devSourceFiles
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
|
|
289
|
+
const prodImportPaths = {};
|
|
290
|
+
const prodImports = prodSourceFiles.flatMap((path2) => getImportsFromFile(path2, prodImportPaths));
|
|
291
|
+
const devImportPaths = {};
|
|
292
|
+
const devImports = devSourceFiles.flatMap((path2) => getImportsFromFile(path2, devImportPaths));
|
|
293
|
+
const externalProdImports = prodImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
|
|
294
|
+
const externalDevImports = devImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
|
|
295
|
+
return {
|
|
296
|
+
prodImports,
|
|
297
|
+
devImports,
|
|
298
|
+
prodImportPaths,
|
|
299
|
+
devImportPaths,
|
|
300
|
+
externalProdImports,
|
|
301
|
+
externalDevImports
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function check({
|
|
305
|
+
name,
|
|
306
|
+
location,
|
|
307
|
+
devDeps = false,
|
|
308
|
+
peerDeps = false
|
|
309
|
+
}) {
|
|
310
|
+
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
311
|
+
const {
|
|
312
|
+
prodImportPaths,
|
|
313
|
+
devImportPaths,
|
|
314
|
+
externalProdImports,
|
|
315
|
+
externalDevImports
|
|
316
|
+
} = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
317
|
+
const {
|
|
318
|
+
dependencies,
|
|
319
|
+
devDependencies,
|
|
320
|
+
peerDependencies
|
|
321
|
+
} = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
322
|
+
let unlistedDependencies = 0;
|
|
323
|
+
let unlistedDevDependencies = 0;
|
|
324
|
+
let unusedDependencies = 0;
|
|
325
|
+
for (const imp of externalProdImports) {
|
|
326
|
+
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
327
|
+
unlistedDependencies++;
|
|
328
|
+
console.log(`[${chalk5.blue(name)}] Missing dependency in package.json: ${chalk5.red(imp)}`);
|
|
329
|
+
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
330
|
+
console.log("");
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
for (const dep of dependencies) {
|
|
334
|
+
if (!externalProdImports.includes(dep)) {
|
|
335
|
+
unusedDependencies++;
|
|
336
|
+
console.log(`[${chalk5.blue(name)}] Unused dependency in package.json: ${chalk5.red(dep)}`);
|
|
337
|
+
console.log(` ${location}/package.json
|
|
338
|
+
`);
|
|
339
|
+
console.log("");
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (peerDeps) {
|
|
343
|
+
for (const dep of peerDependencies) {
|
|
344
|
+
if (!externalProdImports.includes(dep)) {
|
|
345
|
+
unusedDependencies++;
|
|
346
|
+
console.log(`[${chalk5.blue(name)}] Unused peerDependency in package.json: ${chalk5.red(dep)}`);
|
|
347
|
+
console.log(` ${location}/package.json
|
|
348
|
+
`);
|
|
349
|
+
console.log("");
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (devDeps) {
|
|
354
|
+
for (const imp of externalDevImports) {
|
|
355
|
+
if (!devDependencies.includes(imp)) {
|
|
356
|
+
unlistedDevDependencies++;
|
|
357
|
+
console.log(`[${chalk5.blue(name)}] Missing devDependency in package.json: ${chalk5.red(imp)}`);
|
|
358
|
+
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies;
|
|
363
|
+
return totalErrors;
|
|
364
|
+
}
|
|
365
|
+
var deplint = ({ pkg }) => {
|
|
366
|
+
if (pkg) {
|
|
367
|
+
const { location, name } = yarnWorkspace(pkg);
|
|
368
|
+
console.log(`Running Deplint for ${name}`);
|
|
369
|
+
check({
|
|
370
|
+
name,
|
|
371
|
+
location,
|
|
372
|
+
devDeps: true
|
|
373
|
+
});
|
|
374
|
+
} else {
|
|
375
|
+
const workspaces = yarnWorkspaces();
|
|
376
|
+
console.log("Deplint Started...");
|
|
377
|
+
let totalErrors = 0;
|
|
378
|
+
for (const workspace of workspaces) {
|
|
379
|
+
totalErrors += check(workspace);
|
|
380
|
+
}
|
|
381
|
+
if (totalErrors > 0) {
|
|
382
|
+
console.log(`Found ${chalk5.red(totalErrors)} unlisted imports.`);
|
|
383
|
+
} else {
|
|
384
|
+
console.log(`No unlisted imports found. ${chalk5.green("\u2714")}`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return 0;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// src/actions/lint.ts
|
|
391
|
+
import chalk6 from "chalk";
|
|
392
|
+
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
393
|
+
console.log(chalk6.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
230
394
|
const start = Date.now();
|
|
231
395
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
232
|
-
[
|
|
233
|
-
"
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
fix2 ? "package-fix" : "package-lint"
|
|
239
|
-
]
|
|
240
|
-
]
|
|
396
|
+
["yarn", [
|
|
397
|
+
"workspace",
|
|
398
|
+
pkg,
|
|
399
|
+
"run",
|
|
400
|
+
fix2 ? "package-fix" : "package-lint"
|
|
401
|
+
]]
|
|
241
402
|
]);
|
|
242
|
-
console.log(
|
|
403
|
+
console.log(chalk6.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
|
|
243
404
|
return result;
|
|
244
|
-
}
|
|
245
|
-
var lint =
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
405
|
+
};
|
|
406
|
+
var lint = ({
|
|
407
|
+
pkg,
|
|
408
|
+
verbose,
|
|
409
|
+
incremental,
|
|
410
|
+
fix: fix2
|
|
411
|
+
} = {}) => {
|
|
412
|
+
return pkg ? lintPackage({ pkg, fix: fix2 }) : lintAllPackages({
|
|
250
413
|
verbose,
|
|
251
414
|
incremental,
|
|
252
415
|
fix: fix2
|
|
253
416
|
});
|
|
254
|
-
}
|
|
255
|
-
var lintAllPackages =
|
|
256
|
-
console.log(
|
|
417
|
+
};
|
|
418
|
+
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
419
|
+
console.log(chalk6.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
257
420
|
const start = Date.now();
|
|
258
|
-
const fixOptions = fix2 ? [
|
|
259
|
-
"--fix"
|
|
260
|
-
] : [];
|
|
421
|
+
const fixOptions = fix2 ? ["--fix"] : [];
|
|
261
422
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
262
|
-
[
|
|
263
|
-
"yarn",
|
|
264
|
-
[
|
|
265
|
-
"eslint",
|
|
266
|
-
...fixOptions
|
|
267
|
-
]
|
|
268
|
-
]
|
|
423
|
+
["yarn", ["eslint", ...fixOptions]]
|
|
269
424
|
]);
|
|
270
|
-
console.log(
|
|
425
|
+
console.log(chalk6.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
|
|
271
426
|
return result;
|
|
272
|
-
}
|
|
427
|
+
};
|
|
273
428
|
|
|
274
429
|
// src/actions/fix.ts
|
|
275
|
-
var fix =
|
|
276
|
-
return lint({
|
|
277
|
-
|
|
278
|
-
fix: true
|
|
279
|
-
});
|
|
280
|
-
}, "fix");
|
|
430
|
+
var fix = (params) => {
|
|
431
|
+
return lint({ ...params, fix: true });
|
|
432
|
+
};
|
|
281
433
|
|
|
282
434
|
// src/actions/knip.ts
|
|
283
|
-
var knip =
|
|
284
|
-
return runSteps("Knip", [
|
|
285
|
-
|
|
286
|
-
"yarn",
|
|
287
|
-
[
|
|
288
|
-
"knip",
|
|
289
|
-
"--dependencies",
|
|
290
|
-
"--no-exit-code"
|
|
291
|
-
]
|
|
292
|
-
]
|
|
293
|
-
]);
|
|
294
|
-
}, "knip");
|
|
435
|
+
var knip = () => {
|
|
436
|
+
return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
|
|
437
|
+
};
|
|
295
438
|
|
|
296
439
|
// src/actions/publint.ts
|
|
297
|
-
var publint =
|
|
298
|
-
return pkg ? await publintPackage({
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
[
|
|
308
|
-
"yarn",
|
|
309
|
-
[
|
|
310
|
-
"workspace",
|
|
311
|
-
pkg,
|
|
312
|
-
"run",
|
|
313
|
-
"package-publint"
|
|
314
|
-
]
|
|
315
|
-
]
|
|
316
|
-
]);
|
|
317
|
-
}, "publintPackage");
|
|
318
|
-
var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
319
|
-
const verboseOptions = verbose ? [
|
|
320
|
-
"--verbose"
|
|
321
|
-
] : [
|
|
322
|
-
"--no-verbose"
|
|
323
|
-
];
|
|
324
|
-
return runSteps("Publint", [
|
|
325
|
-
[
|
|
326
|
-
"yarn",
|
|
327
|
-
[
|
|
328
|
-
"workspaces",
|
|
329
|
-
"foreach",
|
|
330
|
-
"-pA",
|
|
331
|
-
...verboseOptions,
|
|
332
|
-
"run",
|
|
333
|
-
"package-publint"
|
|
334
|
-
]
|
|
335
|
-
]
|
|
336
|
-
]);
|
|
337
|
-
}, "publintAll");
|
|
440
|
+
var publint = async ({ verbose, pkg }) => {
|
|
441
|
+
return pkg ? await publintPackage({ pkg, verbose }) : publintAll({ verbose });
|
|
442
|
+
};
|
|
443
|
+
var publintPackage = ({ pkg }) => {
|
|
444
|
+
return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
|
|
445
|
+
};
|
|
446
|
+
var publintAll = ({ verbose }) => {
|
|
447
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
448
|
+
return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
|
|
449
|
+
};
|
|
338
450
|
|
|
339
451
|
// src/actions/relint.ts
|
|
340
|
-
import
|
|
341
|
-
var relintPackage =
|
|
342
|
-
console.log(
|
|
452
|
+
import chalk7 from "chalk";
|
|
453
|
+
var relintPackage = ({ pkg }) => {
|
|
454
|
+
console.log(chalk7.gray(`${"Relint"} [All-Packages]`));
|
|
343
455
|
const start = Date.now();
|
|
344
456
|
const result = runSteps("Relint [All-Packages]", [
|
|
345
|
-
[
|
|
346
|
-
"
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
"package-relint"
|
|
352
|
-
]
|
|
353
|
-
]
|
|
457
|
+
["yarn", [
|
|
458
|
+
"workspace",
|
|
459
|
+
pkg,
|
|
460
|
+
"run",
|
|
461
|
+
"package-relint"
|
|
462
|
+
]]
|
|
354
463
|
]);
|
|
355
|
-
console.log(
|
|
464
|
+
console.log(chalk7.gray(`${"Relinted in"} [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`));
|
|
356
465
|
return result;
|
|
357
|
-
}
|
|
358
|
-
var relint =
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
console.log(chalk6.gray(`${"Relint"} [All-Packages]`));
|
|
466
|
+
};
|
|
467
|
+
var relint = ({
|
|
468
|
+
pkg,
|
|
469
|
+
verbose,
|
|
470
|
+
incremental
|
|
471
|
+
} = {}) => {
|
|
472
|
+
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
473
|
+
};
|
|
474
|
+
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
475
|
+
console.log(chalk7.gray(`${"Relint"} [All-Packages]`));
|
|
368
476
|
const start = Date.now();
|
|
369
|
-
const verboseOptions = verbose ? [
|
|
370
|
-
|
|
371
|
-
] : [
|
|
372
|
-
"--no-verbose"
|
|
373
|
-
];
|
|
374
|
-
const incrementalOptions = incremental ? [
|
|
375
|
-
"--since",
|
|
376
|
-
"-Ap"
|
|
377
|
-
] : [
|
|
378
|
-
"--parallel",
|
|
379
|
-
"-Ap"
|
|
380
|
-
];
|
|
477
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
478
|
+
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
381
479
|
const result = runSteps(`${"Relint"} [All-Packages]`, [
|
|
382
|
-
[
|
|
383
|
-
"
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
"package-relint"
|
|
391
|
-
]
|
|
392
|
-
]
|
|
480
|
+
["yarn", [
|
|
481
|
+
"workspaces",
|
|
482
|
+
"foreach",
|
|
483
|
+
...verboseOptions,
|
|
484
|
+
...incrementalOptions,
|
|
485
|
+
"run",
|
|
486
|
+
"package-relint"
|
|
487
|
+
]]
|
|
393
488
|
]);
|
|
394
|
-
console.log(
|
|
489
|
+
console.log(chalk7.gray(`Relinted in [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`));
|
|
395
490
|
return result;
|
|
396
|
-
}
|
|
491
|
+
};
|
|
397
492
|
|
|
398
493
|
// src/actions/sonar.ts
|
|
399
|
-
var sonar =
|
|
400
|
-
return runSteps("Sonar", [
|
|
401
|
-
|
|
402
|
-
"yarn",
|
|
403
|
-
[
|
|
404
|
-
"eslint",
|
|
405
|
-
"-c",
|
|
406
|
-
"sonar.eslintrc",
|
|
407
|
-
"."
|
|
408
|
-
]
|
|
409
|
-
]
|
|
410
|
-
]);
|
|
411
|
-
}, "sonar");
|
|
494
|
+
var sonar = () => {
|
|
495
|
+
return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
|
|
496
|
+
};
|
|
412
497
|
|
|
413
498
|
// src/xy/param.ts
|
|
414
|
-
var packagePositionalParam =
|
|
415
|
-
return yargs.positional("package", {
|
|
416
|
-
|
|
417
|
-
});
|
|
418
|
-
}, "packagePositionalParam");
|
|
499
|
+
var packagePositionalParam = (yargs) => {
|
|
500
|
+
return yargs.positional("package", { describe: "Specific package to target" });
|
|
501
|
+
};
|
|
419
502
|
|
|
420
503
|
// src/xy/xyLintCommands.ts
|
|
421
|
-
var xyLintCommands =
|
|
422
|
-
return args.command(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
504
|
+
var xyLintCommands = (args) => {
|
|
505
|
+
return args.command(
|
|
506
|
+
"cycle [package]",
|
|
507
|
+
"Cycle - Check for dependency cycles",
|
|
508
|
+
(yargs) => {
|
|
509
|
+
return packagePositionalParam(yargs);
|
|
510
|
+
},
|
|
511
|
+
async (argv) => {
|
|
512
|
+
const start = Date.now();
|
|
513
|
+
if (argv.verbose) console.log("Cycle");
|
|
514
|
+
process.exitCode = await cycle({ pkg: argv.package });
|
|
515
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
516
|
+
}
|
|
517
|
+
).command(
|
|
518
|
+
"lint [package]",
|
|
519
|
+
"Lint - Run Eslint",
|
|
520
|
+
(yargs) => {
|
|
521
|
+
return packagePositionalParam(yargs);
|
|
522
|
+
},
|
|
523
|
+
(argv) => {
|
|
524
|
+
if (argv.verbose) console.log("Lint");
|
|
525
|
+
const start = Date.now();
|
|
526
|
+
process.exitCode = argv.fix ? fix({ pkg: argv.package }) : lint({ pkg: argv.package });
|
|
527
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
528
|
+
}
|
|
529
|
+
).command(
|
|
530
|
+
"deplint [package]",
|
|
531
|
+
"Deplint - Run Deplint",
|
|
532
|
+
(yargs) => {
|
|
533
|
+
return packagePositionalParam(yargs);
|
|
534
|
+
},
|
|
535
|
+
(argv) => {
|
|
536
|
+
if (argv.verbose) console.log("Deplint");
|
|
537
|
+
const start = Date.now();
|
|
538
|
+
process.exitCode = deplint({ pkg: argv.package });
|
|
539
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
540
|
+
}
|
|
541
|
+
).command(
|
|
542
|
+
"fix [package]",
|
|
543
|
+
"Fix - Run Eslint w/fix",
|
|
544
|
+
(yargs) => {
|
|
545
|
+
return packagePositionalParam(yargs);
|
|
546
|
+
},
|
|
547
|
+
(argv) => {
|
|
548
|
+
const start = Date.now();
|
|
549
|
+
if (argv.verbose) console.log("Fix");
|
|
550
|
+
process.exitCode = fix();
|
|
551
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
552
|
+
}
|
|
553
|
+
).command(
|
|
554
|
+
"relint [package]",
|
|
555
|
+
"Relint - Clean & Lint",
|
|
556
|
+
(yargs) => {
|
|
557
|
+
return packagePositionalParam(yargs);
|
|
558
|
+
},
|
|
559
|
+
(argv) => {
|
|
560
|
+
if (argv.verbose) console.log("Relinting");
|
|
561
|
+
const start = Date.now();
|
|
562
|
+
process.exitCode = relint();
|
|
563
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
564
|
+
}
|
|
565
|
+
).command(
|
|
566
|
+
"publint [package]",
|
|
567
|
+
"Publint - Run Publint",
|
|
568
|
+
(yargs) => {
|
|
569
|
+
return packagePositionalParam(yargs);
|
|
570
|
+
},
|
|
571
|
+
async (argv) => {
|
|
572
|
+
if (argv.verbose) console.log("Publint");
|
|
573
|
+
const start = Date.now();
|
|
574
|
+
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
575
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
576
|
+
}
|
|
577
|
+
).command(
|
|
578
|
+
"knip",
|
|
579
|
+
"Knip - Run Knip",
|
|
580
|
+
(yargs) => {
|
|
581
|
+
return packagePositionalParam(yargs);
|
|
582
|
+
},
|
|
583
|
+
(argv) => {
|
|
584
|
+
if (argv.verbose) console.log("Knip");
|
|
585
|
+
const start = Date.now();
|
|
586
|
+
process.exitCode = knip();
|
|
587
|
+
console.log(chalk8.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
588
|
+
}
|
|
589
|
+
).command(
|
|
590
|
+
"sonar",
|
|
591
|
+
"Sonar - Run Sonar Check",
|
|
592
|
+
(yargs) => {
|
|
593
|
+
return packagePositionalParam(yargs);
|
|
594
|
+
},
|
|
595
|
+
(argv) => {
|
|
596
|
+
const start = Date.now();
|
|
597
|
+
if (argv.verbose) console.log("Sonar Check");
|
|
598
|
+
process.exitCode = sonar();
|
|
599
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
};
|
|
482
603
|
export {
|
|
483
604
|
xyLintCommands
|
|
484
605
|
};
|