@xylabs/ts-scripts-yarn3 6.3.4 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/build.mjs +39 -87
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-docs.mjs +8 -22
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs +5 -11
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs +16 -29
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +32 -63
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile-types.mjs +45 -68
- package/dist/actions/compile-types.mjs.map +1 -1
- package/dist/actions/compile.mjs +50 -76
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs +23 -38
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.mjs +28 -57
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs +16 -31
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint.mjs +191 -0
- package/dist/actions/deplint.mjs.map +1 -0
- package/dist/actions/deploy-major.mjs +20 -41
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +20 -41
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +20 -41
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +20 -41
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +26 -37
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs +36 -50
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +25 -65
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +28 -44
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +5 -14
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +4 -7
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +860 -1237
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +16 -31
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +37 -51
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +33 -44
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +28 -44
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +6 -16
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +6 -16
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +12 -29
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +7 -17
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +133 -169
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +43 -59
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +20 -23
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/deepMerge.mjs +0 -5
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +11 -10
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +133 -169
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +3 -8
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +127 -163
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +12 -21
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +5 -14
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs +11 -12
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs +191 -271
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +16 -39
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/publint.mjs +4 -7
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +147 -197
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +37 -71
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +17 -29
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +50 -67
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +25 -43
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +40 -63
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +17 -35
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +16 -32
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +27 -46
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs +16 -30
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +16 -27
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +18 -33
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +19 -53
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +16 -31
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +12 -23
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +134 -172
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +134 -172
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +6 -15
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +6 -15
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +12 -28
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +134 -172
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +128 -165
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +44 -61
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +134 -171
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +13 -23
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +13 -23
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +6 -16
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +16 -38
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs +11 -11
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +16 -38
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +4 -6
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +147 -196
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +16 -38
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +1082 -1233
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1334 -1579
- package/dist/index.mjs.map +1 -1
- package/dist/lib/checkResult.mjs +2 -5
- package/dist/lib/checkResult.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +9 -24
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/defaultBuildConfig.mjs +2 -6
- package/dist/lib/defaultBuildConfig.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs +3 -9
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +12 -23
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +22 -33
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +22 -33
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +1 -3
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/constants.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs +12 -13
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs +14 -15
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs +3 -8
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +27 -43
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +100 -154
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/jsonFormatters.mjs +2 -5
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +4 -8
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +2 -5
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/processEx.mjs +6 -9
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.mjs +13 -19
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +22 -22
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs +19 -31
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/runXyWithWarning.mjs +2 -5
- package/dist/lib/runXyWithWarning.mjs.map +1 -1
- package/dist/lib/safeExit.mjs +10 -13
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/string/empty.mjs +2 -5
- package/dist/lib/string/empty.mjs.map +1 -1
- package/dist/lib/string/index.mjs +3 -9
- package/dist/lib/string/index.mjs.map +1 -1
- package/dist/lib/string/union.mjs +1 -7
- package/dist/lib/string/union.mjs.map +1 -1
- package/dist/lib/withErrnoException.mjs +4 -7
- package/dist/lib/withErrnoException.mjs.map +1 -1
- package/dist/lib/withError.mjs +2 -5
- package/dist/lib/withError.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +11 -30
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +4 -15
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs +5 -16
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +5 -16
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +3 -14
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/lib/yarn/yarnInitCwd.mjs +2 -5
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
- package/dist/loadPackageConfig.mjs +3 -8
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/index.mjs +1082 -1234
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +3 -8
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +1082 -1234
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +276 -382
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +251 -335
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +84 -130
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +145 -193
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +409 -288
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +4 -13
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +5 -24
|
@@ -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,260 +214,388 @@ 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
|
+
}) {
|
|
309
|
+
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
310
|
+
const {
|
|
311
|
+
prodImportPaths,
|
|
312
|
+
devImportPaths,
|
|
313
|
+
externalProdImports,
|
|
314
|
+
externalDevImports
|
|
315
|
+
} = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
316
|
+
const {
|
|
317
|
+
dependencies,
|
|
318
|
+
devDependencies,
|
|
319
|
+
peerDependencies
|
|
320
|
+
} = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
321
|
+
let unlistedDependencies = 0;
|
|
322
|
+
let unlistedDevDependencies = 0;
|
|
323
|
+
for (const imp of externalProdImports) {
|
|
324
|
+
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
325
|
+
unlistedDependencies++;
|
|
326
|
+
console.log(`[${chalk5.blue(name)}] Missing dependency in package.json: ${chalk5.red(imp)}`);
|
|
327
|
+
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
328
|
+
console.log("");
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
for (const dep of dependencies) {
|
|
332
|
+
if (!externalProdImports.includes(dep)) {
|
|
333
|
+
unlistedDependencies++;
|
|
334
|
+
console.log(`[${chalk5.blue(name)}] Unused dependency in package.json: ${chalk5.red(dep)}`);
|
|
335
|
+
console.log(` ${location}/package.json
|
|
336
|
+
`);
|
|
337
|
+
console.log("");
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
for (const dep of peerDependencies) {
|
|
341
|
+
if (!externalProdImports.includes(dep)) {
|
|
342
|
+
unlistedDependencies++;
|
|
343
|
+
console.log(`[${chalk5.blue(name)}] Unused peerDependency in package.json: ${chalk5.red(dep)}`);
|
|
344
|
+
console.log(` ${location}/package.json
|
|
345
|
+
`);
|
|
346
|
+
console.log("");
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (devDeps) {
|
|
350
|
+
for (const imp of externalDevImports) {
|
|
351
|
+
if (!devDependencies.includes(imp)) {
|
|
352
|
+
unlistedDevDependencies++;
|
|
353
|
+
console.log(`[${chalk5.blue(name)}] Missing devDependency in package.json: ${chalk5.red(imp)}`);
|
|
354
|
+
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies;
|
|
359
|
+
return totalErrors;
|
|
360
|
+
}
|
|
361
|
+
var deplint = ({ pkg }) => {
|
|
362
|
+
if (pkg) {
|
|
363
|
+
const { location, name } = yarnWorkspace(pkg);
|
|
364
|
+
console.log(`Running Deplint for ${name}`);
|
|
365
|
+
check({
|
|
366
|
+
name,
|
|
367
|
+
location,
|
|
368
|
+
devDeps: true
|
|
369
|
+
});
|
|
370
|
+
} else {
|
|
371
|
+
const workspaces = yarnWorkspaces();
|
|
372
|
+
console.log("Deplint Started...");
|
|
373
|
+
let totalErrors = 0;
|
|
374
|
+
for (const workspace of workspaces) {
|
|
375
|
+
totalErrors += check(workspace);
|
|
376
|
+
}
|
|
377
|
+
if (totalErrors > 0) {
|
|
378
|
+
console.log(`Found ${chalk5.red(totalErrors)} unlisted imports.`);
|
|
379
|
+
} else {
|
|
380
|
+
console.log(`No unlisted imports found. ${chalk5.green("\u2714")}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return 0;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
// src/actions/lint.ts
|
|
387
|
+
import chalk6 from "chalk";
|
|
388
|
+
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
389
|
+
console.log(chalk6.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
230
390
|
const start = Date.now();
|
|
231
391
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
232
|
-
[
|
|
233
|
-
"
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
fix2 ? "package-fix" : "package-lint"
|
|
239
|
-
]
|
|
240
|
-
]
|
|
392
|
+
["yarn", [
|
|
393
|
+
"workspace",
|
|
394
|
+
pkg,
|
|
395
|
+
"run",
|
|
396
|
+
fix2 ? "package-fix" : "package-lint"
|
|
397
|
+
]]
|
|
241
398
|
]);
|
|
242
|
-
console.log(
|
|
399
|
+
console.log(chalk6.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
|
|
243
400
|
return result;
|
|
244
|
-
}
|
|
245
|
-
var lint =
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
401
|
+
};
|
|
402
|
+
var lint = ({
|
|
403
|
+
pkg,
|
|
404
|
+
verbose,
|
|
405
|
+
incremental,
|
|
406
|
+
fix: fix2
|
|
407
|
+
} = {}) => {
|
|
408
|
+
return pkg ? lintPackage({ pkg, fix: fix2 }) : lintAllPackages({
|
|
250
409
|
verbose,
|
|
251
410
|
incremental,
|
|
252
411
|
fix: fix2
|
|
253
412
|
});
|
|
254
|
-
}
|
|
255
|
-
var lintAllPackages =
|
|
256
|
-
console.log(
|
|
413
|
+
};
|
|
414
|
+
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
415
|
+
console.log(chalk6.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
257
416
|
const start = Date.now();
|
|
417
|
+
const fixOptions = fix2 ? ["--fix"] : [];
|
|
258
418
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
259
|
-
[
|
|
260
|
-
"yarn",
|
|
261
|
-
[
|
|
262
|
-
"eslint"
|
|
263
|
-
]
|
|
264
|
-
]
|
|
419
|
+
["yarn", ["eslint", ...fixOptions]]
|
|
265
420
|
]);
|
|
266
|
-
console.log(
|
|
421
|
+
console.log(chalk6.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
|
|
267
422
|
return result;
|
|
268
|
-
}
|
|
423
|
+
};
|
|
269
424
|
|
|
270
425
|
// src/actions/fix.ts
|
|
271
|
-
var fix =
|
|
272
|
-
return lint({
|
|
273
|
-
|
|
274
|
-
fix: true
|
|
275
|
-
});
|
|
276
|
-
}, "fix");
|
|
426
|
+
var fix = (params) => {
|
|
427
|
+
return lint({ ...params, fix: true });
|
|
428
|
+
};
|
|
277
429
|
|
|
278
430
|
// src/actions/knip.ts
|
|
279
|
-
var knip =
|
|
280
|
-
return runSteps("Knip", [
|
|
281
|
-
|
|
282
|
-
"yarn",
|
|
283
|
-
[
|
|
284
|
-
"knip",
|
|
285
|
-
"--dependencies",
|
|
286
|
-
"--no-exit-code"
|
|
287
|
-
]
|
|
288
|
-
]
|
|
289
|
-
]);
|
|
290
|
-
}, "knip");
|
|
431
|
+
var knip = () => {
|
|
432
|
+
return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
|
|
433
|
+
};
|
|
291
434
|
|
|
292
435
|
// src/actions/publint.ts
|
|
293
|
-
var publint =
|
|
294
|
-
return pkg ? await publintPackage({
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
[
|
|
304
|
-
"yarn",
|
|
305
|
-
[
|
|
306
|
-
"workspace",
|
|
307
|
-
pkg,
|
|
308
|
-
"run",
|
|
309
|
-
"package-publint"
|
|
310
|
-
]
|
|
311
|
-
]
|
|
312
|
-
]);
|
|
313
|
-
}, "publintPackage");
|
|
314
|
-
var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
315
|
-
const verboseOptions = verbose ? [
|
|
316
|
-
"--verbose"
|
|
317
|
-
] : [
|
|
318
|
-
"--no-verbose"
|
|
319
|
-
];
|
|
320
|
-
return runSteps("Publint", [
|
|
321
|
-
[
|
|
322
|
-
"yarn",
|
|
323
|
-
[
|
|
324
|
-
"workspaces",
|
|
325
|
-
"foreach",
|
|
326
|
-
"-pA",
|
|
327
|
-
...verboseOptions,
|
|
328
|
-
"run",
|
|
329
|
-
"package-publint"
|
|
330
|
-
]
|
|
331
|
-
]
|
|
332
|
-
]);
|
|
333
|
-
}, "publintAll");
|
|
436
|
+
var publint = async ({ verbose, pkg }) => {
|
|
437
|
+
return pkg ? await publintPackage({ pkg, verbose }) : publintAll({ verbose });
|
|
438
|
+
};
|
|
439
|
+
var publintPackage = ({ pkg }) => {
|
|
440
|
+
return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
|
|
441
|
+
};
|
|
442
|
+
var publintAll = ({ verbose }) => {
|
|
443
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
444
|
+
return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
|
|
445
|
+
};
|
|
334
446
|
|
|
335
447
|
// src/actions/relint.ts
|
|
336
|
-
import
|
|
337
|
-
var relintPackage =
|
|
338
|
-
console.log(
|
|
448
|
+
import chalk7 from "chalk";
|
|
449
|
+
var relintPackage = ({ pkg }) => {
|
|
450
|
+
console.log(chalk7.gray(`${"Relint"} [All-Packages]`));
|
|
339
451
|
const start = Date.now();
|
|
340
452
|
const result = runSteps("Relint [All-Packages]", [
|
|
341
|
-
[
|
|
342
|
-
"
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
"package-relint"
|
|
348
|
-
]
|
|
349
|
-
]
|
|
453
|
+
["yarn", [
|
|
454
|
+
"workspace",
|
|
455
|
+
pkg,
|
|
456
|
+
"run",
|
|
457
|
+
"package-relint"
|
|
458
|
+
]]
|
|
350
459
|
]);
|
|
351
|
-
console.log(
|
|
460
|
+
console.log(chalk7.gray(`${"Relinted in"} [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`));
|
|
352
461
|
return result;
|
|
353
|
-
}
|
|
354
|
-
var relint =
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
console.log(chalk6.gray(`${"Relint"} [All-Packages]`));
|
|
462
|
+
};
|
|
463
|
+
var relint = ({
|
|
464
|
+
pkg,
|
|
465
|
+
verbose,
|
|
466
|
+
incremental
|
|
467
|
+
} = {}) => {
|
|
468
|
+
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
469
|
+
};
|
|
470
|
+
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
471
|
+
console.log(chalk7.gray(`${"Relint"} [All-Packages]`));
|
|
364
472
|
const start = Date.now();
|
|
365
|
-
const verboseOptions = verbose ? [
|
|
366
|
-
|
|
367
|
-
] : [
|
|
368
|
-
"--no-verbose"
|
|
369
|
-
];
|
|
370
|
-
const incrementalOptions = incremental ? [
|
|
371
|
-
"--since",
|
|
372
|
-
"-Ap"
|
|
373
|
-
] : [
|
|
374
|
-
"--parallel",
|
|
375
|
-
"-Ap"
|
|
376
|
-
];
|
|
473
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
474
|
+
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
377
475
|
const result = runSteps(`${"Relint"} [All-Packages]`, [
|
|
378
|
-
[
|
|
379
|
-
"
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
"package-relint"
|
|
387
|
-
]
|
|
388
|
-
]
|
|
476
|
+
["yarn", [
|
|
477
|
+
"workspaces",
|
|
478
|
+
"foreach",
|
|
479
|
+
...verboseOptions,
|
|
480
|
+
...incrementalOptions,
|
|
481
|
+
"run",
|
|
482
|
+
"package-relint"
|
|
483
|
+
]]
|
|
389
484
|
]);
|
|
390
|
-
console.log(
|
|
485
|
+
console.log(chalk7.gray(`Relinted in [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`));
|
|
391
486
|
return result;
|
|
392
|
-
}
|
|
487
|
+
};
|
|
393
488
|
|
|
394
489
|
// src/actions/sonar.ts
|
|
395
|
-
var sonar =
|
|
396
|
-
return runSteps("Sonar", [
|
|
397
|
-
|
|
398
|
-
"yarn",
|
|
399
|
-
[
|
|
400
|
-
"eslint",
|
|
401
|
-
"-c",
|
|
402
|
-
"sonar.eslintrc",
|
|
403
|
-
"."
|
|
404
|
-
]
|
|
405
|
-
]
|
|
406
|
-
]);
|
|
407
|
-
}, "sonar");
|
|
490
|
+
var sonar = () => {
|
|
491
|
+
return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
|
|
492
|
+
};
|
|
408
493
|
|
|
409
494
|
// src/xy/param.ts
|
|
410
|
-
var packagePositionalParam =
|
|
411
|
-
return yargs.positional("package", {
|
|
412
|
-
|
|
413
|
-
});
|
|
414
|
-
}, "packagePositionalParam");
|
|
495
|
+
var packagePositionalParam = (yargs) => {
|
|
496
|
+
return yargs.positional("package", { describe: "Specific package to target" });
|
|
497
|
+
};
|
|
415
498
|
|
|
416
499
|
// src/xy/xyLintCommands.ts
|
|
417
|
-
var xyLintCommands =
|
|
418
|
-
return args.command(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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
|
-
}
|
|
500
|
+
var xyLintCommands = (args) => {
|
|
501
|
+
return args.command(
|
|
502
|
+
"cycle [package]",
|
|
503
|
+
"Cycle - Check for dependency cycles",
|
|
504
|
+
(yargs) => {
|
|
505
|
+
return packagePositionalParam(yargs);
|
|
506
|
+
},
|
|
507
|
+
async (argv) => {
|
|
508
|
+
const start = Date.now();
|
|
509
|
+
if (argv.verbose) console.log("Cycle");
|
|
510
|
+
process.exitCode = await cycle({ pkg: argv.package });
|
|
511
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
512
|
+
}
|
|
513
|
+
).command(
|
|
514
|
+
"lint [package]",
|
|
515
|
+
"Lint - Run Eslint",
|
|
516
|
+
(yargs) => {
|
|
517
|
+
return packagePositionalParam(yargs);
|
|
518
|
+
},
|
|
519
|
+
(argv) => {
|
|
520
|
+
if (argv.verbose) console.log("Lint");
|
|
521
|
+
const start = Date.now();
|
|
522
|
+
process.exitCode = argv.fix ? fix({ pkg: argv.package }) : lint({ pkg: argv.package });
|
|
523
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
524
|
+
}
|
|
525
|
+
).command(
|
|
526
|
+
"deplint [package]",
|
|
527
|
+
"Deplint - Run Deplint",
|
|
528
|
+
(yargs) => {
|
|
529
|
+
return packagePositionalParam(yargs);
|
|
530
|
+
},
|
|
531
|
+
(argv) => {
|
|
532
|
+
if (argv.verbose) console.log("Deplint");
|
|
533
|
+
const start = Date.now();
|
|
534
|
+
process.exitCode = deplint({ pkg: argv.package });
|
|
535
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
536
|
+
}
|
|
537
|
+
).command(
|
|
538
|
+
"fix [package]",
|
|
539
|
+
"Fix - Run Eslint w/fix",
|
|
540
|
+
(yargs) => {
|
|
541
|
+
return packagePositionalParam(yargs);
|
|
542
|
+
},
|
|
543
|
+
(argv) => {
|
|
544
|
+
const start = Date.now();
|
|
545
|
+
if (argv.verbose) console.log("Fix");
|
|
546
|
+
process.exitCode = fix();
|
|
547
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
548
|
+
}
|
|
549
|
+
).command(
|
|
550
|
+
"relint [package]",
|
|
551
|
+
"Relint - Clean & Lint",
|
|
552
|
+
(yargs) => {
|
|
553
|
+
return packagePositionalParam(yargs);
|
|
554
|
+
},
|
|
555
|
+
(argv) => {
|
|
556
|
+
if (argv.verbose) console.log("Relinting");
|
|
557
|
+
const start = Date.now();
|
|
558
|
+
process.exitCode = relint();
|
|
559
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
560
|
+
}
|
|
561
|
+
).command(
|
|
562
|
+
"publint [package]",
|
|
563
|
+
"Publint - Run Publint",
|
|
564
|
+
(yargs) => {
|
|
565
|
+
return packagePositionalParam(yargs);
|
|
566
|
+
},
|
|
567
|
+
async (argv) => {
|
|
568
|
+
if (argv.verbose) console.log("Publint");
|
|
569
|
+
const start = Date.now();
|
|
570
|
+
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
571
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
572
|
+
}
|
|
573
|
+
).command(
|
|
574
|
+
"knip",
|
|
575
|
+
"Knip - Run Knip",
|
|
576
|
+
(yargs) => {
|
|
577
|
+
return packagePositionalParam(yargs);
|
|
578
|
+
},
|
|
579
|
+
(argv) => {
|
|
580
|
+
if (argv.verbose) console.log("Knip");
|
|
581
|
+
const start = Date.now();
|
|
582
|
+
process.exitCode = knip();
|
|
583
|
+
console.log(chalk8.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
584
|
+
}
|
|
585
|
+
).command(
|
|
586
|
+
"sonar",
|
|
587
|
+
"Sonar - Run Sonar Check",
|
|
588
|
+
(yargs) => {
|
|
589
|
+
return packagePositionalParam(yargs);
|
|
590
|
+
},
|
|
591
|
+
(argv) => {
|
|
592
|
+
const start = Date.now();
|
|
593
|
+
if (argv.verbose) console.log("Sonar Check");
|
|
594
|
+
process.exitCode = sonar();
|
|
595
|
+
console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
};
|
|
478
599
|
export {
|
|
479
600
|
xyLintCommands
|
|
480
601
|
};
|