@zendero/runctl 0.1.7 → 0.1.8
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/bin/runctl +29 -5
- package/package.json +1 -1
package/bin/runctl
CHANGED
|
@@ -330,22 +330,46 @@ cmd_update() {
|
|
|
330
330
|
pm="$(cmd_update_pick_pm "$PM")" || exit 1
|
|
331
331
|
git_target="${GIT_BASE}#${GIT_REF}"
|
|
332
332
|
|
|
333
|
+
_git_base_for_ls_remote() {
|
|
334
|
+
local base="$1"
|
|
335
|
+
printf '%s' "${base#git+}"
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
_resolve_git_ref_sha() {
|
|
339
|
+
local base_url="$1"
|
|
340
|
+
local ref="$2"
|
|
341
|
+
local remote sha
|
|
342
|
+
remote="$(_git_base_for_ls_remote "$base_url")"
|
|
343
|
+
command -v git >/dev/null 2>&1 || return 1
|
|
344
|
+
sha="$(git ls-remote "$remote" "$ref" 2>/dev/null | awk 'NR==1{print $1}')"
|
|
345
|
+
[[ "$sha" =~ ^[0-9a-fA-F]{40}$ ]] || return 1
|
|
346
|
+
printf '%s' "$sha"
|
|
347
|
+
}
|
|
348
|
+
|
|
333
349
|
_update_registry() {
|
|
334
350
|
local spec="${PKG}@latest"
|
|
335
351
|
echo "runctl update: installing latest from registry ($spec)..."
|
|
336
352
|
if [[ "$pm" == "pnpm" ]]; then
|
|
337
|
-
pnpm add -g "$spec"
|
|
353
|
+
pnpm add -g --force "$spec"
|
|
338
354
|
else
|
|
339
|
-
npm install -g "$spec"
|
|
355
|
+
npm install -g --force "$spec"
|
|
340
356
|
fi
|
|
341
357
|
}
|
|
342
358
|
|
|
343
359
|
_update_git() {
|
|
344
|
-
|
|
360
|
+
local sha spec
|
|
361
|
+
if sha="$(_resolve_git_ref_sha "$GIT_BASE" "$GIT_REF")"; then
|
|
362
|
+
spec="${GIT_BASE}#${sha}"
|
|
363
|
+
echo "runctl update: installing from Git ref $GIT_REF (resolved to ${sha:0:12})..."
|
|
364
|
+
else
|
|
365
|
+
spec="$git_target"
|
|
366
|
+
echo "runctl update: installing from Git ($git_target)..."
|
|
367
|
+
echo "runctl update: could not resolve ref to SHA; proceeding with ref directly." >&2
|
|
368
|
+
fi
|
|
345
369
|
if [[ "$pm" == "pnpm" ]]; then
|
|
346
|
-
pnpm add -g "$
|
|
370
|
+
pnpm add -g --force "$spec"
|
|
347
371
|
else
|
|
348
|
-
npm install -g "$
|
|
372
|
+
npm install -g --force "$spec"
|
|
349
373
|
fi
|
|
350
374
|
}
|
|
351
375
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendero/runctl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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",
|