@workit-dev/pi 2.20.4 → 2.20.6
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/workit.js +31 -4
- package/package.json +1 -1
package/dist/workit.js
CHANGED
|
@@ -14322,6 +14322,8 @@ function repoHeavyCommands(root) {
|
|
|
14322
14322
|
return [];
|
|
14323
14323
|
}
|
|
14324
14324
|
}
|
|
14325
|
+
var CHECK_HEAVY = [true, "io"];
|
|
14326
|
+
var CHECK_KEYS = ["command", "heavy"];
|
|
14325
14327
|
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14326
14328
|
var SHELL_META = /[|&;<>()$`\\*?[\]{}~!#]/u;
|
|
14327
14329
|
function splitCommand(command) {
|
|
@@ -14518,10 +14520,10 @@ function loadCheckConfig(cwd) {
|
|
|
14518
14520
|
for (const [name, value] of Object.entries(parsed.checks)) {
|
|
14519
14521
|
if (!CHECK_NAME.test(name))
|
|
14520
14522
|
return none(`${label}: check name "${name}" must match ${CHECK_NAME.source}`);
|
|
14521
|
-
const
|
|
14522
|
-
if (
|
|
14523
|
-
return none(`${label}: check "${name}": ${
|
|
14524
|
-
checks.push({ name, argv, accepts: [argv] });
|
|
14523
|
+
const check = checkEntry(value);
|
|
14524
|
+
if (check instanceof Error)
|
|
14525
|
+
return none(`${label}: check "${name}": ${check.message}`);
|
|
14526
|
+
checks.push({ name, argv: check.argv, accepts: [check.argv], ...check.heavy });
|
|
14525
14527
|
}
|
|
14526
14528
|
const gates = {};
|
|
14527
14529
|
if (parsed.gates !== undefined) {
|
|
@@ -14565,6 +14567,31 @@ function loadCheckConfig(cwd) {
|
|
|
14565
14567
|
regenerable
|
|
14566
14568
|
};
|
|
14567
14569
|
}
|
|
14570
|
+
function commandArgv(value) {
|
|
14571
|
+
if (typeof value === "string")
|
|
14572
|
+
return splitCommand(value);
|
|
14573
|
+
return Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string" && item.length > 0) ? value : new Error("expected a command string or a non-empty argv array");
|
|
14574
|
+
}
|
|
14575
|
+
function checkEntry(value) {
|
|
14576
|
+
if (!isRecord2(value)) {
|
|
14577
|
+
const argv = commandArgv(value);
|
|
14578
|
+
return argv instanceof Error ? argv : { argv, heavy: {} };
|
|
14579
|
+
}
|
|
14580
|
+
const unknown = Object.keys(value).find((key) => !CHECK_KEYS.includes(key));
|
|
14581
|
+
if (unknown)
|
|
14582
|
+
return new Error(`"${unknown}" is not a check setting (use ${CHECK_KEYS.join(" or ")})`);
|
|
14583
|
+
if (value.command === undefined)
|
|
14584
|
+
return new Error('needs "command": a command string or a non-empty argv array');
|
|
14585
|
+
const argv = commandArgv(value.command);
|
|
14586
|
+
if (argv instanceof Error)
|
|
14587
|
+
return new Error(`command: ${argv.message}`);
|
|
14588
|
+
if (value.heavy === undefined)
|
|
14589
|
+
return { argv, heavy: {} };
|
|
14590
|
+
const heavy = CHECK_HEAVY.find((allowed) => allowed === value.heavy);
|
|
14591
|
+
if (heavy === undefined)
|
|
14592
|
+
return new Error(`heavy must be ${CHECK_HEAVY.map((allowed) => JSON.stringify(allowed)).join(" or ")}, not ${JSON.stringify(value.heavy)}`);
|
|
14593
|
+
return { argv, heavy: { heavy } };
|
|
14594
|
+
}
|
|
14568
14595
|
var sameArgv = (left, right) => left.length === right.length && left.every((item, index) => item === right[index]);
|
|
14569
14596
|
function matchesNamedCheck(config, name, argv, cwd) {
|
|
14570
14597
|
if (config.error || name === null || cwd !== ".")
|