@xylabs/ts-scripts-yarn3 7.0.2 → 7.1.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.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/checkPackage/checkPackage.mjs +48 -71
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +5 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +9 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +5 -5
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +0 -4
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +48 -71
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +61 -86
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +4 -20
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/findFilesByGlob.mjs +1 -8
- package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -1
- package/dist/actions/deplint/getBasePackageName.mjs +0 -4
- package/dist/actions/deplint/getBasePackageName.mjs.map +1 -1
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +0 -4
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +12 -24
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +9 -16
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +61 -86
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs +26 -57
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +26 -57
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +26 -57
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +26 -57
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +26 -37
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs +36 -54
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +25 -65
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +28 -44
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +5 -14
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +4 -7
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +705 -1251
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +16 -31
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +37 -51
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +33 -48
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +28 -44
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +6 -16
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +6 -16
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +12 -29
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +19 -34
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +165 -195
- package/dist/actions/package/compile/compile.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 +2 -5
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +165 -195
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +15 -25
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +25 -17
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +19 -36
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +160 -185
- 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 +236 -308
- 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 +13 -14
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +179 -223
- 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 +165 -194
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +166 -197
- 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 +165 -194
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +160 -184
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +165 -194
- 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 +5 -13
- 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 +13 -13
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +179 -222
- 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 +932 -1266
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +1191 -1612
- 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 +99 -157
- 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 +3 -11
- 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 +932 -1267
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +3 -9
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +932 -1267
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +228 -320
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +251 -336
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +99 -161
- 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 +302 -403
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +2 -5
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +8 -9
package/dist/actions/test.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 safeExit =
|
|
48
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
52
49
|
try {
|
|
53
50
|
const result = func();
|
|
54
51
|
if (result && exitOnFail) {
|
|
@@ -58,13 +55,13 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
|
58
55
|
} catch (ex) {
|
|
59
56
|
return processEx(ex);
|
|
60
57
|
}
|
|
61
|
-
}
|
|
58
|
+
};
|
|
62
59
|
|
|
63
60
|
// src/lib/runSteps.ts
|
|
64
61
|
import { spawnSync } from "child_process";
|
|
65
62
|
import { existsSync } from "fs";
|
|
66
63
|
import chalk3 from "chalk";
|
|
67
|
-
var runSteps =
|
|
64
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
68
65
|
return safeExit(() => {
|
|
69
66
|
const pkgName = process.env.npm_package_name;
|
|
70
67
|
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
@@ -80,10 +77,7 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
80
77
|
const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
|
|
81
78
|
...config,
|
|
82
79
|
encoding: "utf8",
|
|
83
|
-
env: {
|
|
84
|
-
FORCE_COLOR: "3",
|
|
85
|
-
...process.env
|
|
86
|
-
},
|
|
80
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
87
81
|
shell: true,
|
|
88
82
|
stdio: "inherit"
|
|
89
83
|
}).status ?? 0;
|
|
@@ -92,20 +86,12 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
92
86
|
}
|
|
93
87
|
return totalStatus;
|
|
94
88
|
}, !!exitOnFail);
|
|
95
|
-
}
|
|
89
|
+
};
|
|
96
90
|
|
|
97
91
|
// src/actions/test.ts
|
|
98
|
-
var test =
|
|
99
|
-
return runSteps("Test", [
|
|
100
|
-
|
|
101
|
-
"yarn",
|
|
102
|
-
[
|
|
103
|
-
"vitest",
|
|
104
|
-
"."
|
|
105
|
-
]
|
|
106
|
-
]
|
|
107
|
-
]);
|
|
108
|
-
}, "test");
|
|
92
|
+
var test = () => {
|
|
93
|
+
return runSteps("Test", [["yarn", ["vitest", "."]]]);
|
|
94
|
+
};
|
|
109
95
|
export {
|
|
110
96
|
test
|
|
111
97
|
};
|
|
@@ -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/runSteps.ts","../../src/actions/test.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 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","import { runSteps } from '../lib/index.ts'\n\nexport const test = () => {\n return runSteps('Test', [['yarn', ['vitest', '.']]])\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/runSteps.ts","../../src/actions/test.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 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","import { runSteps } from '../lib/index.ts'\n\nexport const test = () => {\n return runSteps('Test', [['yarn', ['vitest', '.']]])\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,SAAO,UAAa,IAAI,SAAS,CAACC,QAAiBA,IAA6B,UAAU,MAAS;AACrG;;;AFDO,IAAM,YAAY,CAAC,OAAgB;AACxC,QAAM,QAAQ,OAAO,OAAO,WAAW,IAAI,MAAM,EAAE,IAAI;AACvD,QAAM,WACF,mBAAmB,OAAO,CAACC,WAAU;AACrC,QAAIA,OAAM,SAAS,UAAU;AAC3B,cAAQ,MAAMC,OAAM,IAAI,IAAID,OAAM,IAAI,cAAc,CAAC;AAAA,IACvD,OAAO;AACL,cAAQ,MAAMC,OAAM,IAAI,UAAUD,OAAM,IAAI,E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G;AAAA,MAClD;AACA,YAAM,SACF,UAAU,SAAS,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,MAAM,GAAG,GAAG;AAAA,QACjE,GAAG;AAAA,QACH,UAAU;AAAA,QACV,KAAK,EAAE,aAAa,KAAK,GAAG,QAAQ,IAAI;AAAA,QACxC,OAAO;AAAA,QACP,OAAO;AAAA,MACT,CAAC,EAAE,UAAU;AACf,kBAAY,MAAM,QAAQ,SAAS,UAAU;AAC7C,qBAAe,UAAU;AAAA,IAC3B;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC,UAAU;AACjB;;;ACrCO,IAAM,OAAO,MAAM;AACxB,SAAO,SAAS,QAAQ,CAAC,CAAC,QAAQ,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;AACrD;","names":["chalk","ex","ex","error","chalk","chalk","chalk"]}
|
package/dist/actions/up.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 safeExit =
|
|
48
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
52
49
|
try {
|
|
53
50
|
const result = func();
|
|
54
51
|
if (result && exitOnFail) {
|
|
@@ -58,13 +55,13 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
|
58
55
|
} catch (ex) {
|
|
59
56
|
return processEx(ex);
|
|
60
57
|
}
|
|
61
|
-
}
|
|
58
|
+
};
|
|
62
59
|
|
|
63
60
|
// src/lib/runSteps.ts
|
|
64
61
|
import { spawnSync } from "child_process";
|
|
65
62
|
import { existsSync } from "fs";
|
|
66
63
|
import chalk3 from "chalk";
|
|
67
|
-
var runSteps =
|
|
64
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
68
65
|
return safeExit(() => {
|
|
69
66
|
const pkgName = process.env.npm_package_name;
|
|
70
67
|
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
@@ -80,10 +77,7 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
80
77
|
const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
|
|
81
78
|
...config,
|
|
82
79
|
encoding: "utf8",
|
|
83
|
-
env: {
|
|
84
|
-
FORCE_COLOR: "3",
|
|
85
|
-
...process.env
|
|
86
|
-
},
|
|
80
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
87
81
|
shell: true,
|
|
88
82
|
stdio: "inherit"
|
|
89
83
|
}).status ?? 0;
|
|
@@ -92,17 +86,12 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
92
86
|
}
|
|
93
87
|
return totalStatus;
|
|
94
88
|
}, !!exitOnFail);
|
|
95
|
-
}
|
|
89
|
+
};
|
|
96
90
|
|
|
97
91
|
// src/actions/up.ts
|
|
98
|
-
var up =
|
|
99
|
-
return runSteps("Up", [
|
|
100
|
-
|
|
101
|
-
"yarn",
|
|
102
|
-
"outdated"
|
|
103
|
-
]
|
|
104
|
-
]);
|
|
105
|
-
}, "up");
|
|
92
|
+
var up = () => {
|
|
93
|
+
return runSteps("Up", [["yarn", "outdated"]]);
|
|
94
|
+
};
|
|
106
95
|
export {
|
|
107
96
|
up
|
|
108
97
|
};
|
package/dist/actions/up.mjs.map
CHANGED
|
@@ -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/runSteps.ts","../../src/actions/up.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 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","import { runSteps } from '../lib/index.ts'\n\nexport const up = () => {\n return runSteps('Up', [['yarn', 'outdated']])\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/runSteps.ts","../../src/actions/up.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 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","import { runSteps } from '../lib/index.ts'\n\nexport const up = () => {\n return runSteps('Up', [['yarn', 'outdated']])\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,SAAO,UAAa,IAAI,S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,GAAG,CAAC,SAAS,MAAM,MAAM,CAAC,KAAK,MAAM,QAAQ,GAAG;AAC1D,UAAI,WAAW,CAAC,GAAG;AACjB,gBAAQ,IAAIA,OAAM,KAAK,WAAW,CAAC,CAAC,CAAC;AAAA,MACvC;AACA,YAAM,UAAU,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,MAAM,GAAG;AAC3D,UAAI,YAAY,UAAU,CAAC,WAAW,QAAQ,CAAC,CAAC,GAAG;AACjD,cAAM,IAAI,MAAM,mBAAmB,QAAQ,CAAC,CAAC,GAAG;AAAA,MAClD;AACA,YAAM,SACF,UAAU,SAAS,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,MAAM,GAAG,GAAG;AAAA,QACjE,GAAG;AAAA,QACH,UAAU;AAAA,QACV,KAAK,EAAE,aAAa,KAAK,GAAG,QAAQ,IAAI;AAAA,QACxC,OAAO;AAAA,QACP,OAAO;AAAA,MACT,CAAC,EAAE,UAAU;AACf,kBAAY,MAAM,QAAQ,SAAS,UAAU;AAC7C,qBAAe,UAAU;AAAA,IAC3B;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC,UAAU;AACjB;;;ACrCO,IAAM,KAAK,MAAM;AACtB,SAAO,SAAS,MAAM,CAAC,CAAC,QAAQ,UAAU,CAAC,CAAC;AAC9C;","names":["chalk","ex","ex","error","chalk","chalk","chalk"]}
|
package/dist/actions/updo.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 safeExit =
|
|
48
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
52
49
|
try {
|
|
53
50
|
const result = func();
|
|
54
51
|
if (result && exitOnFail) {
|
|
@@ -58,13 +55,13 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
|
58
55
|
} catch (ex) {
|
|
59
56
|
return processEx(ex);
|
|
60
57
|
}
|
|
61
|
-
}
|
|
58
|
+
};
|
|
62
59
|
|
|
63
60
|
// src/lib/runSteps.ts
|
|
64
61
|
import { spawnSync } from "child_process";
|
|
65
62
|
import { existsSync } from "fs";
|
|
66
63
|
import chalk3 from "chalk";
|
|
67
|
-
var runSteps =
|
|
64
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
68
65
|
return safeExit(() => {
|
|
69
66
|
const pkgName = process.env.npm_package_name;
|
|
70
67
|
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
@@ -80,10 +77,7 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
80
77
|
const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
|
|
81
78
|
...config,
|
|
82
79
|
encoding: "utf8",
|
|
83
|
-
env: {
|
|
84
|
-
FORCE_COLOR: "3",
|
|
85
|
-
...process.env
|
|
86
|
-
},
|
|
80
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
87
81
|
shell: true,
|
|
88
82
|
stdio: "inherit"
|
|
89
83
|
}).status ?? 0;
|
|
@@ -92,25 +86,16 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
92
86
|
}
|
|
93
87
|
return totalStatus;
|
|
94
88
|
}, !!exitOnFail);
|
|
95
|
-
}
|
|
89
|
+
};
|
|
96
90
|
|
|
97
91
|
// src/actions/updo.ts
|
|
98
|
-
var updo =
|
|
92
|
+
var updo = () => {
|
|
99
93
|
return runSteps("Updo", [
|
|
100
|
-
[
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
],
|
|
104
|
-
[
|
|
105
|
-
"yarn",
|
|
106
|
-
"upgrade-interactive"
|
|
107
|
-
],
|
|
108
|
-
[
|
|
109
|
-
"yarn",
|
|
110
|
-
"dedupe"
|
|
111
|
-
]
|
|
94
|
+
["yarn", "install"],
|
|
95
|
+
["yarn", "upgrade-interactive"],
|
|
96
|
+
["yarn", "dedupe"]
|
|
112
97
|
]);
|
|
113
|
-
}
|
|
98
|
+
};
|
|
114
99
|
export {
|
|
115
100
|
updo
|
|
116
101
|
};
|
|
@@ -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/runSteps.ts","../../src/actions/updo.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 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","import { runSteps } from '../lib/index.ts'\n\nexport const updo = () => {\n return runSteps('Updo', [\n ['yarn', 'install'],\n ['yarn', 'upgrade-interactive'],\n ['yarn', 'dedupe'],\n ])\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/runSteps.ts","../../src/actions/updo.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 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","import { runSteps } from '../lib/index.ts'\n\nexport const updo = () => {\n return runSteps('Updo', [\n ['yarn', 'install'],\n ['yarn', 'upgrade-interactive'],\n ['yarn', 'dedupe'],\n ])\n}\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e,UAAU;AAAA,IAC3B;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC,UAAU;AACjB;;;ACrCO,IAAM,OAAO,MAAM;AACxB,SAAO,SAAS,QAAQ;AAAA,IACtB,CAAC,QAAQ,SAAS;AAAA,IAClB,CAAC,QAAQ,qBAAqB;AAAA,IAC9B,CAAC,QAAQ,QAAQ;AAAA,EACnB,CAAC;AACH;","names":["chalk","ex","ex","error","chalk","chalk","chalk"]}
|
package/dist/actions/upplug.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 safeExit =
|
|
48
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
52
49
|
try {
|
|
53
50
|
const result = func();
|
|
54
51
|
if (result && exitOnFail) {
|
|
@@ -58,13 +55,13 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
|
58
55
|
} catch (ex) {
|
|
59
56
|
return processEx(ex);
|
|
60
57
|
}
|
|
61
|
-
}
|
|
58
|
+
};
|
|
62
59
|
|
|
63
60
|
// src/lib/runSteps.ts
|
|
64
61
|
import { spawnSync } from "child_process";
|
|
65
62
|
import { existsSync } from "fs";
|
|
66
63
|
import chalk3 from "chalk";
|
|
67
|
-
var runSteps =
|
|
64
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
68
65
|
return safeExit(() => {
|
|
69
66
|
const pkgName = process.env.npm_package_name;
|
|
70
67
|
console.log(chalk3.green(`${name} [${pkgName}]`));
|
|
@@ -80,10 +77,7 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
80
77
|
const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
|
|
81
78
|
...config,
|
|
82
79
|
encoding: "utf8",
|
|
83
|
-
env: {
|
|
84
|
-
FORCE_COLOR: "3",
|
|
85
|
-
...process.env
|
|
86
|
-
},
|
|
80
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
87
81
|
shell: true,
|
|
88
82
|
stdio: "inherit"
|
|
89
83
|
}).status ?? 0;
|
|
@@ -92,45 +86,17 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
92
86
|
}
|
|
93
87
|
return totalStatus;
|
|
94
88
|
}, !!exitOnFail);
|
|
95
|
-
}
|
|
89
|
+
};
|
|
96
90
|
|
|
97
91
|
// src/actions/upplug.ts
|
|
98
|
-
var updateYarnPlugins =
|
|
92
|
+
var updateYarnPlugins = () => {
|
|
99
93
|
return runSteps("Update Yarn Plugins", [
|
|
100
|
-
[
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"import",
|
|
105
|
-
"https://mskelton.dev/yarn-outdated/v3"
|
|
106
|
-
]
|
|
107
|
-
],
|
|
108
|
-
[
|
|
109
|
-
"yarn",
|
|
110
|
-
[
|
|
111
|
-
"plugin",
|
|
112
|
-
"import",
|
|
113
|
-
"version"
|
|
114
|
-
]
|
|
115
|
-
],
|
|
116
|
-
[
|
|
117
|
-
"yarn",
|
|
118
|
-
[
|
|
119
|
-
"plugin",
|
|
120
|
-
"import",
|
|
121
|
-
"interactive-tools"
|
|
122
|
-
]
|
|
123
|
-
],
|
|
124
|
-
[
|
|
125
|
-
"yarn",
|
|
126
|
-
[
|
|
127
|
-
"plugin",
|
|
128
|
-
"import",
|
|
129
|
-
"workspace-tools"
|
|
130
|
-
]
|
|
131
|
-
]
|
|
94
|
+
["yarn", ["plugin", "import", "https://mskelton.dev/yarn-outdated/v3"]],
|
|
95
|
+
["yarn", ["plugin", "import", "version"]],
|
|
96
|
+
["yarn", ["plugin", "import", "interactive-tools"]],
|
|
97
|
+
["yarn", ["plugin", "import", "workspace-tools"]]
|
|
132
98
|
]);
|
|
133
|
-
}
|
|
99
|
+
};
|
|
134
100
|
export {
|
|
135
101
|
updateYarnPlugins
|
|
136
102
|
};
|