@zendero/runctl 0.1.7 → 0.1.9
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 +8 -0
- package/bin/runctl +44 -5
- package/package.json +1 -1
- package/scripts/install-global.sh +12 -2
package/README.md
CHANGED
|
@@ -102,6 +102,14 @@ Use npm explicitly (e.g. no pnpm on the machine):
|
|
|
102
102
|
curl -fsSL "https://raw.githubusercontent.com/DoctorKhan/runctl/main/scripts/install-global.sh" | bash -s -- --pm npm --registry
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
If `runctl --help` still looks old after install/update, remove the legacy package that can shadow this CLI and reinstall:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pnpm remove -g runctl
|
|
109
|
+
pnpm add -g @zendero/runctl@latest
|
|
110
|
+
hash -r
|
|
111
|
+
```
|
|
112
|
+
|
|
105
113
|
`--help` on the script prints the same usage summary.
|
|
106
114
|
|
|
107
115
|
---
|
package/bin/runctl
CHANGED
|
@@ -330,22 +330,61 @@ cmd_update() {
|
|
|
330
330
|
pm="$(cmd_update_pick_pm "$PM")" || exit 1
|
|
331
331
|
git_target="${GIT_BASE}#${GIT_REF}"
|
|
332
332
|
|
|
333
|
+
_remove_conflicting_global_runctl() {
|
|
334
|
+
# A legacy package named "runctl" can own the same binary name and shadow @zendero/runctl.
|
|
335
|
+
# Best-effort remove before reinstalling the intended package.
|
|
336
|
+
if [[ "$PKG" != "@zendero/runctl" ]]; then
|
|
337
|
+
return 0
|
|
338
|
+
fi
|
|
339
|
+
if [[ "$pm" == "pnpm" ]]; then
|
|
340
|
+
pnpm remove -g runctl >/dev/null 2>&1 || true
|
|
341
|
+
else
|
|
342
|
+
npm uninstall -g runctl >/dev/null 2>&1 || true
|
|
343
|
+
fi
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
_git_base_for_ls_remote() {
|
|
347
|
+
local base="$1"
|
|
348
|
+
printf '%s' "${base#git+}"
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
_resolve_git_ref_sha() {
|
|
352
|
+
local base_url="$1"
|
|
353
|
+
local ref="$2"
|
|
354
|
+
local remote sha
|
|
355
|
+
remote="$(_git_base_for_ls_remote "$base_url")"
|
|
356
|
+
command -v git >/dev/null 2>&1 || return 1
|
|
357
|
+
sha="$(git ls-remote "$remote" "$ref" 2>/dev/null | awk 'NR==1{print $1}')"
|
|
358
|
+
[[ "$sha" =~ ^[0-9a-fA-F]{40}$ ]] || return 1
|
|
359
|
+
printf '%s' "$sha"
|
|
360
|
+
}
|
|
361
|
+
|
|
333
362
|
_update_registry() {
|
|
334
363
|
local spec="${PKG}@latest"
|
|
335
364
|
echo "runctl update: installing latest from registry ($spec)..."
|
|
365
|
+
_remove_conflicting_global_runctl
|
|
336
366
|
if [[ "$pm" == "pnpm" ]]; then
|
|
337
|
-
pnpm add -g "$spec"
|
|
367
|
+
pnpm add -g --force "$spec"
|
|
338
368
|
else
|
|
339
|
-
npm install -g "$spec"
|
|
369
|
+
npm install -g --force "$spec"
|
|
340
370
|
fi
|
|
341
371
|
}
|
|
342
372
|
|
|
343
373
|
_update_git() {
|
|
344
|
-
|
|
374
|
+
local sha spec
|
|
375
|
+
if sha="$(_resolve_git_ref_sha "$GIT_BASE" "$GIT_REF")"; then
|
|
376
|
+
spec="${GIT_BASE}#${sha}"
|
|
377
|
+
echo "runctl update: installing from Git ref $GIT_REF (resolved to ${sha:0:12})..."
|
|
378
|
+
else
|
|
379
|
+
spec="$git_target"
|
|
380
|
+
echo "runctl update: installing from Git ($git_target)..."
|
|
381
|
+
echo "runctl update: could not resolve ref to SHA; proceeding with ref directly." >&2
|
|
382
|
+
fi
|
|
383
|
+
_remove_conflicting_global_runctl
|
|
345
384
|
if [[ "$pm" == "pnpm" ]]; then
|
|
346
|
-
pnpm add -g "$
|
|
385
|
+
pnpm add -g --force "$spec"
|
|
347
386
|
else
|
|
348
|
-
npm install -g "$
|
|
387
|
+
npm install -g --force "$spec"
|
|
349
388
|
fi
|
|
350
389
|
}
|
|
351
390
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendero/runctl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
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",
|
|
@@ -132,10 +132,20 @@ run_install() {
|
|
|
132
132
|
local source_kind="$2"
|
|
133
133
|
local target="$3"
|
|
134
134
|
|
|
135
|
+
# A legacy package named "runctl" can shadow the same CLI binary.
|
|
136
|
+
# Remove it before installing @zendero/runctl.
|
|
137
|
+
if [[ "$PKG" == "@zendero/runctl" ]]; then
|
|
138
|
+
if [[ "$manager" == "pnpm" ]]; then
|
|
139
|
+
pnpm remove -g runctl >/dev/null 2>&1 || true
|
|
140
|
+
else
|
|
141
|
+
npm uninstall -g runctl >/dev/null 2>&1 || true
|
|
142
|
+
fi
|
|
143
|
+
fi
|
|
144
|
+
|
|
135
145
|
if [[ "$manager" == "pnpm" ]]; then
|
|
136
|
-
pnpm add -g "$target"
|
|
146
|
+
pnpm add -g --force "$target"
|
|
137
147
|
else
|
|
138
|
-
npm install -g "$target"
|
|
148
|
+
npm install -g --force "$target"
|
|
139
149
|
fi
|
|
140
150
|
|
|
141
151
|
say
|