@xylabs/ts-scripts-yarn3 6.3.4 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/build.mjs +39 -87
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-docs.mjs +8 -22
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs +5 -11
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs +16 -29
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +32 -63
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile-types.mjs +45 -68
- package/dist/actions/compile-types.mjs.map +1 -1
- package/dist/actions/compile.mjs +50 -76
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs +23 -38
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.mjs +28 -57
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs +16 -31
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint.mjs +191 -0
- package/dist/actions/deplint.mjs.map +1 -0
- package/dist/actions/deploy-major.mjs +20 -41
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +20 -41
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +20 -41
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +20 -41
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +26 -37
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs +36 -50
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +25 -65
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +28 -44
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +5 -14
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +4 -7
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +860 -1237
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +16 -31
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +37 -51
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +33 -44
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +28 -44
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +6 -16
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +6 -16
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +12 -29
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +7 -17
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +133 -169
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +43 -59
- package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +20 -23
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/deepMerge.mjs +0 -5
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +11 -10
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +133 -169
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +3 -8
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +37 -52
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +127 -163
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +12 -21
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +5 -14
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs +11 -12
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs +191 -271
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +16 -39
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/publint.mjs +4 -7
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +147 -197
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +37 -71
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +17 -29
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +50 -67
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +25 -43
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +40 -63
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +17 -35
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +16 -32
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +27 -46
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs +16 -30
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +16 -27
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +18 -33
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +19 -53
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +16 -31
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +12 -23
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +134 -172
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +134 -172
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +6 -15
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +6 -15
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +12 -28
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +134 -172
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +128 -165
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +44 -61
- package/dist/bin/package/compile-types.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +134 -171
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +13 -23
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +13 -23
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +6 -16
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +16 -38
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs +11 -11
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +16 -38
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +4 -6
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +147 -196
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +16 -38
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +1082 -1233
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1334 -1579
- package/dist/index.mjs.map +1 -1
- package/dist/lib/checkResult.mjs +2 -5
- package/dist/lib/checkResult.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +9 -24
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/defaultBuildConfig.mjs +2 -6
- package/dist/lib/defaultBuildConfig.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs +3 -9
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +12 -23
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +22 -33
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +22 -33
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +1 -3
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/constants.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs +12 -13
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs +14 -15
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs +3 -8
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +27 -43
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +100 -154
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/jsonFormatters.mjs +2 -5
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +4 -8
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +2 -5
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/processEx.mjs +6 -9
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.mjs +13 -19
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +22 -22
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs +19 -31
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/runXyWithWarning.mjs +2 -5
- package/dist/lib/runXyWithWarning.mjs.map +1 -1
- package/dist/lib/safeExit.mjs +10 -13
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/string/empty.mjs +2 -5
- package/dist/lib/string/empty.mjs.map +1 -1
- package/dist/lib/string/index.mjs +3 -9
- package/dist/lib/string/index.mjs.map +1 -1
- package/dist/lib/string/union.mjs +1 -7
- package/dist/lib/string/union.mjs.map +1 -1
- package/dist/lib/withErrnoException.mjs +4 -7
- package/dist/lib/withErrnoException.mjs.map +1 -1
- package/dist/lib/withError.mjs +2 -5
- package/dist/lib/withError.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +11 -30
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +4 -15
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs +5 -16
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +5 -16
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +3 -14
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/lib/yarn/yarnInitCwd.mjs +2 -5
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
- package/dist/loadPackageConfig.mjs +3 -8
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/index.mjs +1082 -1234
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +3 -8
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +1082 -1234
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +276 -382
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +251 -335
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +84 -130
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +145 -193
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +409 -288
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +4 -13
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +5 -24
package/dist/actions/clean.mjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/lib/checkResult.ts
|
|
5
2
|
import chalk from "chalk";
|
|
6
|
-
var checkResult =
|
|
3
|
+
var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
7
4
|
if (result) {
|
|
8
5
|
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
9
6
|
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
@@ -12,23 +9,23 @@ var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnF
|
|
|
12
9
|
process.exit(result);
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
|
-
}
|
|
12
|
+
};
|
|
16
13
|
|
|
17
14
|
// src/lib/processEx.ts
|
|
18
15
|
import chalk2 from "chalk";
|
|
19
16
|
|
|
20
17
|
// src/lib/withError.ts
|
|
21
|
-
var withError =
|
|
18
|
+
var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
22
19
|
return predicate(ex) ? closure(ex) : void 0;
|
|
23
|
-
}
|
|
20
|
+
};
|
|
24
21
|
|
|
25
22
|
// src/lib/withErrnoException.ts
|
|
26
|
-
var withErrnoException =
|
|
23
|
+
var withErrnoException = (ex, closure) => {
|
|
27
24
|
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
28
|
-
}
|
|
25
|
+
};
|
|
29
26
|
|
|
30
27
|
// src/lib/processEx.ts
|
|
31
|
-
var processEx =
|
|
28
|
+
var processEx = (ex) => {
|
|
32
29
|
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
33
30
|
const exitCode = withErrnoException(error, (error2) => {
|
|
34
31
|
if (error2.code === "ENOENT") {
|
|
@@ -45,10 +42,10 @@ var processEx = /* @__PURE__ */ __name((ex) => {
|
|
|
45
42
|
return -1;
|
|
46
43
|
})();
|
|
47
44
|
process.exit(process.exitCode ?? exitCode);
|
|
48
|
-
}
|
|
45
|
+
};
|
|
49
46
|
|
|
50
47
|
// src/lib/safeExit.ts
|
|
51
|
-
var safeExitAsync =
|
|
48
|
+
var safeExitAsync = async (func, exitOnFail = true) => {
|
|
52
49
|
try {
|
|
53
50
|
const result = await func();
|
|
54
51
|
if (result && exitOnFail) {
|
|
@@ -58,13 +55,13 @@ var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
|
|
|
58
55
|
} catch (ex) {
|
|
59
56
|
return processEx(ex);
|
|
60
57
|
}
|
|
61
|
-
}
|
|
58
|
+
};
|
|
62
59
|
|
|
63
60
|
// src/lib/runStepsAsync.ts
|
|
64
61
|
import { spawn } from "node:child_process";
|
|
65
62
|
import { existsSync } from "node:fs";
|
|
66
63
|
import chalk3 from "chalk";
|
|
67
|
-
var runStepAsync =
|
|
64
|
+
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
68
65
|
return new Promise((resolve) => {
|
|
69
66
|
const [command, args, config] = step;
|
|
70
67
|
if (message) {
|
|
@@ -76,15 +73,18 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
|
|
|
76
73
|
}
|
|
77
74
|
spawn(command, Array.isArray(args) ? args : args.split(" "), {
|
|
78
75
|
...config,
|
|
79
|
-
env: {
|
|
80
|
-
FORCE_COLOR: "3",
|
|
81
|
-
...process.env
|
|
82
|
-
},
|
|
76
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
83
77
|
shell: true,
|
|
84
78
|
stdio: "inherit"
|
|
85
79
|
}).on("close", (code) => {
|
|
86
80
|
if (code) {
|
|
87
|
-
console.error(
|
|
81
|
+
console.error(
|
|
82
|
+
chalk3.red(
|
|
83
|
+
`Command Exited With Non-Zero Result [${chalk3.gray(code)}] | ${chalk3.yellow(command)} ${chalk3.white(
|
|
84
|
+
Array.isArray(args) ? args.join(" ") : args
|
|
85
|
+
)}`
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
88
|
checkResult(name, code, "error", exitOnFail);
|
|
89
89
|
resolve(code);
|
|
90
90
|
} else {
|
|
@@ -92,8 +92,8 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
|
-
}
|
|
96
|
-
var runStepsAsync =
|
|
95
|
+
};
|
|
96
|
+
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
97
97
|
return await safeExitAsync(async () => {
|
|
98
98
|
const pkgName = process.env.npm_package_name;
|
|
99
99
|
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
@@ -103,50 +103,19 @@ var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true
|
|
|
103
103
|
}
|
|
104
104
|
return result;
|
|
105
105
|
});
|
|
106
|
-
}
|
|
106
|
+
};
|
|
107
107
|
|
|
108
108
|
// src/actions/clean.ts
|
|
109
|
-
var clean =
|
|
110
|
-
return pkg ? await cleanPackage({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
[
|
|
120
|
-
"yarn",
|
|
121
|
-
[
|
|
122
|
-
"workspace",
|
|
123
|
-
pkg,
|
|
124
|
-
"run",
|
|
125
|
-
"package-clean"
|
|
126
|
-
]
|
|
127
|
-
]
|
|
128
|
-
]);
|
|
129
|
-
}, "cleanPackage");
|
|
130
|
-
var cleanAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
131
|
-
const verboseOptions = verbose ? [
|
|
132
|
-
"--verbose"
|
|
133
|
-
] : [
|
|
134
|
-
"--no-verbose"
|
|
135
|
-
];
|
|
136
|
-
return runStepsAsync("Clean", [
|
|
137
|
-
[
|
|
138
|
-
"yarn",
|
|
139
|
-
[
|
|
140
|
-
"workspaces foreach",
|
|
141
|
-
"-pA",
|
|
142
|
-
"--jobs 64",
|
|
143
|
-
...verboseOptions,
|
|
144
|
-
"run",
|
|
145
|
-
"package-clean"
|
|
146
|
-
]
|
|
147
|
-
]
|
|
148
|
-
]);
|
|
149
|
-
}, "cleanAll");
|
|
109
|
+
var clean = async ({ verbose, pkg }) => {
|
|
110
|
+
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
111
|
+
};
|
|
112
|
+
var cleanPackage = ({ pkg }) => {
|
|
113
|
+
return runStepsAsync(`Clean [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-clean"]]]);
|
|
114
|
+
};
|
|
115
|
+
var cleanAll = ({ verbose }) => {
|
|
116
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
117
|
+
return runStepsAsync("Clean", [["yarn", ["workspaces foreach", "-pA", "--jobs 64", ...verboseOptions, "run", "package-clean"]]]);
|
|
118
|
+
};
|
|
150
119
|
export {
|
|
151
120
|
clean,
|
|
152
121
|
cleanAll,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts","../../src/actions/clean.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n","import { runStepsAsync } from '../lib/index.ts'\n\nexport interface CleanParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface CleanPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const clean = async ({ verbose, pkg }: CleanParams) => {\n return pkg\n ? await cleanPackage({ pkg, verbose })\n : cleanAll({ verbose })\n}\n\nexport const cleanPackage = ({ pkg }: CleanPackageParams) => {\n return runStepsAsync(`Clean [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-clean']]])\n}\n\nexport const cleanAll = ({ verbose }: CleanParams) => {\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n return runStepsAsync('Clean', [['yarn', ['workspaces foreach', '-pA', '--jobs 64', ...verboseOptions, 'run', 'package-clean']]])\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts","../../src/actions/clean.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n","import { runStepsAsync } from '../lib/index.ts'\n\nexport interface CleanParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface CleanPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const clean = async ({ verbose, pkg }: CleanParams) => {\n return pkg\n ? await cleanPackage({ pkg, verbose })\n : cleanAll({ verbose })\n}\n\nexport const cleanPackage = ({ pkg }: CleanPackageParams) => {\n return runStepsAsync(`Clean [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-clean']]])\n}\n\nexport const cleanAll = ({ verbose }: CleanParams) => {\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n return runStepsAsync('Clean', [['yarn', ['workspaces foreach', '-pA', '--jobs 64', ...verboseOptions, 'run', 'package-clean']]])\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,OAAOA,YAAW;;;ACAX,IAAM,YAAY,CAEvB,IACA,SACA,YAAY,CAACC,QAAW,CAAC,CAACA,IAAG,QAAQ,CAAC,CAACA,IAAG,YACvC;AACH,SAAO,UAAU,EAAO,IAAI,QAAQ,EAAO,IAAI;AACjD;;;ACLO,IAAM,qBAAqB,CAChC,IAAa,YACV;AACH,SAA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AS,IAAI,MAAmB;AAC5D,SAAO,MACH,MAAM,aAAa,EAAE,KAAK,QAAQ,CAAC,IACnC,SAAS,EAAE,QAAQ,CAAC;AAC1B;AAEO,IAAM,eAAe,CAAC,EAAE,IAAI,MAA0B;AAC3D,SAAO,cAAc,UAAU,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,OAAO,eAAe,CAAC,CAAC,CAAC;AAC/F;AAEO,IAAM,WAAW,CAAC,EAAE,QAAQ,MAAmB;AACpD,QAAM,iBAAiB,UAAU,CAAC,WAAW,IAAI,CAAC,cAAc;AAChE,SAAO,cAAc,SAAS,CAAC,CAAC,QAAQ,CAAC,sBAAsB,OAAO,aAAa,GAAG,gBAAgB,OAAO,eAAe,CAAC,CAAC,CAAC;AACjI;","names":["chalk","ex","ex","error","chalk","chalk","chalk"]}
|
|
@@ -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/compile-types.ts
|
|
5
2
|
import chalk4 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,13 +58,13 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
|
61
58
|
} catch (ex) {
|
|
62
59
|
return processEx(ex);
|
|
63
60
|
}
|
|
64
|
-
}
|
|
61
|
+
};
|
|
65
62
|
|
|
66
63
|
// src/lib/runSteps.ts
|
|
67
64
|
import { spawnSync } from "node:child_process";
|
|
68
65
|
import { existsSync } from "node:fs";
|
|
69
66
|
import chalk3 from "chalk";
|
|
70
|
-
var runSteps =
|
|
67
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
71
68
|
return safeExit(() => {
|
|
72
69
|
const pkgName = process.env.npm_package_name;
|
|
73
70
|
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
@@ -83,10 +80,7 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
83
80
|
const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
|
|
84
81
|
...config,
|
|
85
82
|
encoding: "utf8",
|
|
86
|
-
env: {
|
|
87
|
-
FORCE_COLOR: "3",
|
|
88
|
-
...process.env
|
|
89
|
-
},
|
|
83
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
90
84
|
shell: true,
|
|
91
85
|
stdio: "inherit"
|
|
92
86
|
}).status ?? 0;
|
|
@@ -95,79 +89,62 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
95
89
|
}
|
|
96
90
|
return totalStatus;
|
|
97
91
|
}, !!exitOnFail);
|
|
98
|
-
}
|
|
92
|
+
};
|
|
99
93
|
|
|
100
94
|
// src/actions/compile-types.ts
|
|
101
|
-
var compileTypes =
|
|
95
|
+
var compileTypes = ({
|
|
96
|
+
verbose,
|
|
97
|
+
pkg,
|
|
98
|
+
incremental,
|
|
99
|
+
jobs
|
|
100
|
+
}) => {
|
|
102
101
|
if (verbose) {
|
|
103
102
|
console.log(chalk4.gray("Compiling Types"));
|
|
104
103
|
}
|
|
105
|
-
return pkg ? compileTypesPackage({
|
|
106
|
-
pkg,
|
|
107
|
-
verbose
|
|
108
|
-
}) : compileTypesAll({
|
|
104
|
+
return pkg ? compileTypesPackage({ pkg, verbose }) : compileTypesAll({
|
|
109
105
|
incremental,
|
|
110
106
|
verbose,
|
|
111
107
|
jobs
|
|
112
108
|
});
|
|
113
|
-
}
|
|
114
|
-
var compileTypesPackage =
|
|
109
|
+
};
|
|
110
|
+
var compileTypesPackage = ({ verbose, pkg }) => {
|
|
115
111
|
if (verbose) {
|
|
116
112
|
console.log(chalk4.gray("Compiling Types [Package]"));
|
|
117
113
|
}
|
|
118
|
-
return runSteps(
|
|
119
|
-
[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
]);
|
|
129
|
-
}, "compileTypesPackage");
|
|
130
|
-
var compileTypesAll = /* @__PURE__ */ __name(({ jobs, verbose, incremental }) => {
|
|
114
|
+
return runSteps(
|
|
115
|
+
`Compile [${pkg}]`,
|
|
116
|
+
[["yarn", ["workspace", pkg, "run", "package-compile-types"]]]
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
var compileTypesAll = ({
|
|
120
|
+
jobs,
|
|
121
|
+
verbose,
|
|
122
|
+
incremental
|
|
123
|
+
}) => {
|
|
131
124
|
if (verbose) {
|
|
132
125
|
console.log(chalk4.gray("Compiling Types [All]"));
|
|
133
126
|
}
|
|
134
127
|
const start = Date.now();
|
|
135
|
-
const verboseOptions = verbose ? [
|
|
136
|
-
|
|
137
|
-
] : [
|
|
138
|
-
"--no-verbose"
|
|
139
|
-
];
|
|
140
|
-
const incrementalOptions = incremental ? [
|
|
141
|
-
"--since",
|
|
142
|
-
"-Apt"
|
|
143
|
-
] : [
|
|
144
|
-
"--parallel",
|
|
145
|
-
"-Apt"
|
|
146
|
-
];
|
|
147
|
-
const jobsOptions = jobs ? [
|
|
148
|
-
"-j",
|
|
149
|
-
`${jobs}`
|
|
150
|
-
] : [];
|
|
128
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
129
|
+
const incrementalOptions = incremental ? ["--since", "-Apt"] : ["--parallel", "-Apt"];
|
|
130
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
151
131
|
if (jobs) {
|
|
152
132
|
console.log(chalk4.blue(`Jobs set to [${jobs}]`));
|
|
153
133
|
}
|
|
154
134
|
const result = runSteps(`Compile Types ${incremental ? "[Incremental]" : ""} [All]`, [
|
|
155
|
-
[
|
|
156
|
-
"
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"package-compile-types"
|
|
165
|
-
]
|
|
166
|
-
]
|
|
135
|
+
["yarn", [
|
|
136
|
+
"workspaces",
|
|
137
|
+
"foreach",
|
|
138
|
+
...incrementalOptions,
|
|
139
|
+
...jobsOptions,
|
|
140
|
+
...verboseOptions,
|
|
141
|
+
"run",
|
|
142
|
+
"package-compile-types"
|
|
143
|
+
]]
|
|
167
144
|
]);
|
|
168
145
|
console.log(`${chalk4.gray("Types Compiled in")} [${chalk4.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk4.gray("seconds")}`);
|
|
169
146
|
return result;
|
|
170
|
-
}
|
|
147
|
+
};
|
|
171
148
|
export {
|
|
172
149
|
compileTypes,
|
|
173
150
|
compileTypesAll,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/compile-types.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileTypesParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n verbose?: boolean\n}\n\ninterface CompileTypesPackageParams {\n pkg: string\n publint?: boolean\n verbose?: boolean\n}\n\nexport const compileTypes = ({\n verbose, pkg, incremental, jobs,\n}: CompileTypesParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types'))\n }\n return pkg\n ? compileTypesPackage({ pkg, verbose })\n : compileTypesAll({\n incremental, verbose, jobs,\n })\n}\n\nexport const compileTypesPackage = ({ verbose, pkg }: CompileTypesPackageParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types [Package]'))\n }\n return runSteps(\n `Compile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', 'package-compile-types']]],\n )\n}\n\nexport const compileTypesAll = ({\n jobs, verbose, incremental,\n}: CompileTypesParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types [All]'))\n }\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const incrementalOptions = incremental ? ['--since', '-Apt'] : ['--parallel', '-Apt']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile Types ${incremental ? '[Incremental]' : ''} [All]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile-types',\n ]],\n ])\n console.log(`${chalk.gray('Types Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep =\n | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC,OAAAA;AACxB,QAAMC,QAAQ,OAAOD,OAAO,WAAW,IAAIE,MAAMF,EAAAA,IAAMA;AACvD,QAAMG,WACFC,mBAAmBH,OAAO,CAACA,WAAAA;AAC3B,QAAIA,OAAMI,SAAS,UAAU;AAC3BC,cAAQL,MAAMM,OAAMC,IAAI,IAAIP,OAAMQ,IAAI,cAAc,CAAA;IACtD,OAAO;AACLH,cAAQL,MAAMM,OAAMC,IAAI,UAAUP,OAAMI,IAAI,EAAE,CAAA;IAChD;AACA,WAAOJ,OAA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AAQC,IAAIC,OAAMW,KAAK,gBAAgBd,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMe,SAASR,SAAS,iBAAiBR,cAAc,kBAAkB,EAAA,UAAY;IACnF;MAAC;MAAQ;QAAC;QACR;WACGa;WACAC;WACAF;QACH;QACA;;;GAEH;AACDV,UAAQC,IAAI,GAAGC,OAAMC,KAAK,mBAAA,CAAA,KAAyBD,OAAMa,UAAUP,KAAKC,IAAG,IAAKF,SAAS,KAAMS,QAAQ,CAAA,CAAA,CAAA,KAAQd,OAAMC,KAAK,SAAA,CAAA,EAAY;AACtI,SAAOW;AACT,GA1B+B;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","compileTypes","verbose","pkg","incremental","jobs","console","log","chalk","gray","compileTypesPackage","compileTypesAll","runSteps","start","Date","now","verboseOptions","incrementalOptions","jobsOptions","blue","result","magenta","toFixed"]}
|
|
1
|
+
{"version":3,"sources":["../../src/actions/compile-types.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileTypesParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n verbose?: boolean\n}\n\ninterface CompileTypesPackageParams {\n pkg: string\n publint?: boolean\n verbose?: boolean\n}\n\nexport const compileTypes = ({\n verbose, pkg, incremental, jobs,\n}: CompileTypesParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types'))\n }\n return pkg\n ? compileTypesPackage({ pkg, verbose })\n : compileTypesAll({\n incremental, verbose, jobs,\n })\n}\n\nexport const compileTypesPackage = ({ verbose, pkg }: CompileTypesPackageParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types [Package]'))\n }\n return runSteps(\n `Compile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', 'package-compile-types']]],\n )\n}\n\nexport const compileTypesAll = ({\n jobs, verbose, incremental,\n}: CompileTypesParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types [All]'))\n }\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const incrementalOptions = incremental ? ['--since', '-Apt'] : ['--parallel', '-Apt']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile Types ${incremental ? '[Incremental]' : ''} [All]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile-types',\n ]],\n ])\n console.log(`${chalk.gray('Types Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep =\n | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,OAAOC,YAAW;;;ACAX,IAAM,YAAY,CAEvB,IACA,SACA,YAAY,CAACC,QAAW,CAAC,CAACA,IAAG,QAAQ,CAAC,CAACA,IAAG,YACvC;AACH,SAAO,UAAU,EAAO,IAAI,QAAQ,EAAO,IAAI;AACjD;;;ACLO,IAAM,qBAAqB,CAChC,IAAa,YACV;AACH,SAAO,UAAa,IAAI,SAAS,CAACC,QAAiBA,IAA6B,UAAU,MAAS;AACrG;;;AFDO,IAAM,YAAY,CAAC,OAAg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