@kaynooo/cli-workspace 0.14.2 → 0.14.3
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/cli.js +18 -7
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/
|
|
2
|
-
// @bun
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
// @bun 2>/dev/null; exec bun --no-env-file --config=/dev/null "$0" "$@"
|
|
3
3
|
var __esm = (fn, res, err) => () => {
|
|
4
4
|
if (fn)
|
|
5
5
|
try {
|
|
@@ -707,20 +707,31 @@ function closest(name, names) {
|
|
|
707
707
|
var init_text2 = () => {};
|
|
708
708
|
|
|
709
709
|
// ../kit/src/input.ts
|
|
710
|
+
function durationMs(text, unit) {
|
|
711
|
+
if (BARE_DURATION.test(text))
|
|
712
|
+
return Number(text) * UNIT_MS[unit];
|
|
713
|
+
if (!DURATION.test(text))
|
|
714
|
+
return 0;
|
|
715
|
+
let ms = 0;
|
|
716
|
+
for (const [, amount, part] of text.matchAll(DURATION_PART))
|
|
717
|
+
ms += Number(amount) * UNIT_MS[part];
|
|
718
|
+
return ms;
|
|
719
|
+
}
|
|
710
720
|
function duration(value, name, fallback, unit = "s") {
|
|
711
721
|
if (value === undefined)
|
|
712
722
|
return fallback;
|
|
713
|
-
const
|
|
714
|
-
const ms = match === null ? 0 : Number(match[1]) * UNIT_MS[match[2] ?? unit];
|
|
723
|
+
const ms = durationMs(value.trim(), unit);
|
|
715
724
|
if (ms < 1)
|
|
716
725
|
badUsage(`--${name} takes a duration such as 30s, 5m, 1h or 7d, not ${value}`);
|
|
717
726
|
return ms;
|
|
718
727
|
}
|
|
719
|
-
var DURATION, UNIT_MS;
|
|
728
|
+
var BARE_DURATION, DURATION, DURATION_PART, UNIT_MS;
|
|
720
729
|
var init_input = __esm(() => {
|
|
721
730
|
init_args();
|
|
722
|
-
|
|
723
|
-
|
|
731
|
+
BARE_DURATION = /^\d+(?:\.\d+)?$/;
|
|
732
|
+
DURATION = /^(?:\d+(?:\.\d+)?(?:ms|min|[smhd]))+$/;
|
|
733
|
+
DURATION_PART = /(\d+(?:\.\d+)?)(ms|min|[smhd])/g;
|
|
734
|
+
UNIT_MS = { ms: 1, s: 1000, m: 60000, min: 60000, h: 3600000, d: 86400000 };
|
|
724
735
|
});
|
|
725
736
|
|
|
726
737
|
// ../kit/src/args.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-workspace",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.3",
|
|
5
5
|
"description": "ws: the repositories of the workspace that need attention, the folders worth reclaiming and their known vulnerabilities.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"registry": "https://git.kaynooo.fr/api/packages/kaynooo/npm/"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "$npm_execpath build src/cli.ts --target bun --outdir dist",
|
|
27
|
+
"build": "$npm_execpath build src/cli.ts --target bun --outdir dist && $npm_execpath ../../scripts/shell-shebang.ts",
|
|
28
28
|
"ws": "$npm_execpath src/cli.ts"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@kaynooo/cli-kit": "0.46.
|
|
31
|
+
"@kaynooo/cli-kit": "0.46.4"
|
|
32
32
|
}
|
|
33
33
|
}
|