@zendero/runctl 0.1.10 → 0.1.11
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/README.md +5 -1
- package/bin/runctl +89 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,7 +110,11 @@ pnpm add -g @zendero/runctl@latest
|
|
|
110
110
|
hash -r
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
### `runctl update` and pnpm version messages
|
|
114
|
+
|
|
115
|
+
If pnpm nags about versions or **`pnpm self-update`** does nothing useful, **`runctl update --help`** explains why and lists concrete fixes (same text is summarized after a successful pnpm-based update unless **`CI`** or **`RUNCTL_UPDATE_SKIP_PNPM_HINT=1`**).
|
|
116
|
+
|
|
117
|
+
`--help` on the install script prints the same usage summary.
|
|
114
118
|
|
|
115
119
|
---
|
|
116
120
|
|
package/bin/runctl
CHANGED
|
@@ -3,6 +3,71 @@
|
|
|
3
3
|
set -euo pipefail
|
|
4
4
|
RUNCTL_PKG_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)"
|
|
5
5
|
|
|
6
|
+
# Volta resolves pnpm from the *current* project's packageManager for `pnpm -v`, but
|
|
7
|
+
# `pnpm add -g` uses the default global pnpm (often older). Run pnpm as this package
|
|
8
|
+
# defines it: Corepack reads packageManager from $RUNCTL_PKG_ROOT/package.json (no
|
|
9
|
+
# duplicated version in shell). If Corepack is missing, fall back to npm exec with
|
|
10
|
+
# the same field, then plain pnpm on PATH.
|
|
11
|
+
_runctl_read_pnpm_version_from_package_json() {
|
|
12
|
+
node -e '
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const p = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
15
|
+
const pm = p.packageManager || "";
|
|
16
|
+
const m = /^pnpm@([0-9]+(?:\.[0-9]+){0,2})/.exec(pm);
|
|
17
|
+
process.stdout.write(m ? m[1] : "");
|
|
18
|
+
' "$RUNCTL_PKG_ROOT/package.json" 2>/dev/null || true
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Shown after runctl update (pnpm) and in --help. pnpm often suggests "pnpm self-update" but that
|
|
22
|
+
# updates a different notion of "current" than the pnpm used for global -g installs (Volta/Corepack).
|
|
23
|
+
_runctl_print_pnpm_version_fixup_hint() {
|
|
24
|
+
local ver
|
|
25
|
+
ver="$(_runctl_read_pnpm_version_from_package_json)"
|
|
26
|
+
[[ -n "$ver" ]] || ver="X.Y.Z"
|
|
27
|
+
cat >&2 <<EOF
|
|
28
|
+
|
|
29
|
+
runctl update: pnpm may show "Update available" or tell you to run pnpm self-update; self-update
|
|
30
|
+
often does nothing useful here: it follows your project packageManager, while global installs use a
|
|
31
|
+
separate default pnpm. If the footer still shows an older pnpm than you expect, fix that default — do
|
|
32
|
+
not rely on pnpm self-update alone. Replace ${ver} with the version you want (match package.json).
|
|
33
|
+
|
|
34
|
+
volta install pnpm@${ver}
|
|
35
|
+
corepack enable && corepack prepare pnpm@${ver} --activate
|
|
36
|
+
RUNCTL_PNPM_VERSION=${ver} runctl update git
|
|
37
|
+
runctl update --pm npm
|
|
38
|
+
|
|
39
|
+
Hide this hint: RUNCTL_UPDATE_SKIP_PNPM_HINT=1 (also suppressed when CI is set.)
|
|
40
|
+
EOF
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
_runctl_maybe_print_pnpm_update_hint() {
|
|
44
|
+
local pm="$1"
|
|
45
|
+
[[ "$pm" == "pnpm" ]] || return 0
|
|
46
|
+
[[ -z "${RUNCTL_UPDATE_SKIP_PNPM_HINT:-}" ]] || return 0
|
|
47
|
+
[[ -z "${CI:-}" ]] || return 0
|
|
48
|
+
_runctl_print_pnpm_version_fixup_hint
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_runctl_pnpm_exec() {
|
|
52
|
+
if command -v corepack >/dev/null 2>&1; then
|
|
53
|
+
if (cd "$RUNCTL_PKG_ROOT" && corepack pnpm "$@"); then
|
|
54
|
+
return 0
|
|
55
|
+
fi
|
|
56
|
+
echo "runctl update: warning: corepack pnpm failed; trying npm exec / PATH pnpm" >&2
|
|
57
|
+
fi
|
|
58
|
+
local ver="${RUNCTL_PNPM_VERSION:-}"
|
|
59
|
+
if [[ -z "$ver" ]]; then
|
|
60
|
+
ver="$(_runctl_read_pnpm_version_from_package_json)"
|
|
61
|
+
fi
|
|
62
|
+
if [[ -n "$ver" ]] && command -v npm >/dev/null 2>&1; then
|
|
63
|
+
if npm exec -y "pnpm@${ver}" -- "$@"; then
|
|
64
|
+
return 0
|
|
65
|
+
fi
|
|
66
|
+
echo "runctl update: warning: npm exec pnpm@${ver} failed; falling back to pnpm on PATH" >&2
|
|
67
|
+
fi
|
|
68
|
+
command pnpm "$@"
|
|
69
|
+
}
|
|
70
|
+
|
|
6
71
|
_b="" _d="" _r="" _c="" _y="" _g=""
|
|
7
72
|
if [[ -t 1 ]]; then
|
|
8
73
|
_b=$'\033[1m' _d=$'\033[2m' _r=$'\033[0m'
|
|
@@ -220,6 +285,22 @@ ${_y}Environment${_r} ${_d}(optional; same as install-global.sh)${_r}
|
|
|
220
285
|
RUNCTL_PACKAGE npm name ${_d}(default: @zendero/runctl)${_r}
|
|
221
286
|
RUNCTL_GIT_BASE Git URL without fragment ${_d}(default: git+https://github.com/DoctorKhan/runctl.git)${_r}
|
|
222
287
|
RUNCTL_GIT_REF default Git ref ${_d}(default: main)${_r}
|
|
288
|
+
RUNCTL_PNPM_VERSION Force pnpm version for npm-exec fallback ${_d}(e.g. 10.33.0)${_r}
|
|
289
|
+
RUNCTL_UPDATE_SKIP_PNPM_HINT Set to ${_c}1${_r} to hide the post-update pnpm version hint ${_d}(CI also hides)${_r}
|
|
290
|
+
|
|
291
|
+
${_y}pnpm version / “pnpm self-update” does nothing${_r}
|
|
292
|
+
pnpm often prints an upgrade banner or suggests ${_c}pnpm self-update${_r}. That advice targets the
|
|
293
|
+
project ${_c}packageManager${_r} pin; ${_c}pnpm add -g${_r} uses a ${_b}different${_r} default pnpm
|
|
294
|
+
(e.g. Volta’s global toolchain). So self-update may say you are already on 10.33.0 while the footer
|
|
295
|
+
still shows 10.27.0 — both can be “true.” Fix the ${_b}global${_r} default, not self-update alone:
|
|
296
|
+
|
|
297
|
+
${_c}volta install pnpm@<version>${_r} ${_d}match your repo / Volta default${_r}
|
|
298
|
+
${_c}corepack enable && corepack prepare pnpm@<version> --activate${_r}
|
|
299
|
+
${_c}RUNCTL_PNPM_VERSION=<version> runctl update git${_r}
|
|
300
|
+
${_c}runctl update --pm npm${_r} ${_d}use npm for this install instead${_r}
|
|
301
|
+
|
|
302
|
+
A short hint is printed after a successful ${_c}runctl update${_r} with pnpm unless ${_c}CI${_r} is set
|
|
303
|
+
or ${_c}RUNCTL_UPDATE_SKIP_PNPM_HINT=1${_r}.
|
|
223
304
|
EOF
|
|
224
305
|
}
|
|
225
306
|
|
|
@@ -345,7 +426,7 @@ cmd_update() {
|
|
|
345
426
|
return 0
|
|
346
427
|
fi
|
|
347
428
|
if [[ "$pm" == "pnpm" ]]; then
|
|
348
|
-
|
|
429
|
+
_runctl_pnpm_exec remove -g runctl >/dev/null 2>&1 || true
|
|
349
430
|
else
|
|
350
431
|
npm uninstall -g runctl >/dev/null 2>&1 || true
|
|
351
432
|
fi
|
|
@@ -372,7 +453,7 @@ cmd_update() {
|
|
|
372
453
|
echo "runctl update: installing latest from registry ($spec)..."
|
|
373
454
|
_remove_conflicting_global_runctl
|
|
374
455
|
if [[ "$pm" == "pnpm" ]]; then
|
|
375
|
-
|
|
456
|
+
_runctl_pnpm_exec add -g --force "$spec"
|
|
376
457
|
else
|
|
377
458
|
npm install -g --force "$spec"
|
|
378
459
|
fi
|
|
@@ -390,7 +471,7 @@ cmd_update() {
|
|
|
390
471
|
fi
|
|
391
472
|
_remove_conflicting_global_runctl
|
|
392
473
|
if [[ "$pm" == "pnpm" ]]; then
|
|
393
|
-
|
|
474
|
+
_runctl_pnpm_exec add -g --force "$spec"
|
|
394
475
|
else
|
|
395
476
|
npm install -g --force "$spec"
|
|
396
477
|
fi
|
|
@@ -404,17 +485,18 @@ cmd_update() {
|
|
|
404
485
|
_update_git
|
|
405
486
|
;;
|
|
406
487
|
auto)
|
|
407
|
-
if _update_registry; then
|
|
408
|
-
|
|
488
|
+
if ! _update_registry; then
|
|
489
|
+
echo "runctl update: registry install failed; trying Git..." >&2
|
|
490
|
+
_update_git
|
|
409
491
|
fi
|
|
410
|
-
echo "runctl update: registry install failed; trying Git..." >&2
|
|
411
|
-
_update_git
|
|
412
492
|
;;
|
|
413
493
|
*)
|
|
414
494
|
echo "runctl update: internal error: unknown mode $MODE" >&2
|
|
415
495
|
exit 1
|
|
416
496
|
;;
|
|
417
497
|
esac
|
|
498
|
+
|
|
499
|
+
_runctl_maybe_print_pnpm_update_hint "$pm"
|
|
418
500
|
}
|
|
419
501
|
|
|
420
502
|
cmd_doctor() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendero/runctl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Picks a free port, runs your dev server in the background, and keeps PID + port state in .run/ so projects don't collide.",
|
|
5
5
|
"author": "DoctorKhan",
|
|
6
6
|
"homepage": "https://github.com/DoctorKhan/runctl#readme",
|