@zendero/runctl 0.1.6 → 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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/bin/runctl +29 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -175,7 +175,7 @@ Add scripts to your `package.json`:
175
175
  | Step | Command |
176
176
  |------|--------|
177
177
  | Preflight | `./run.sh release-check` or `pnpm run release-check` |
178
- | Publish | `./run.sh release latest` or `pnpm run release` |
178
+ | Publish | `./run.sh release latest` or `pnpm run release` (publishes, then commits + pushes release changes if any) |
179
179
  | Promote dist-tag | After publishing under `next`, `./run.sh promote` sets **latest** for the version in `package.json` |
180
180
 
181
181
  Put `NPM_TOKEN` in `.env`. `release` / `npm-whoami` use a **temporary `NPM_CONFIG_USERCONFIG`** so a stale `~/.npmrc` token does not override `.env` (npm 10+ / pnpm). Token lines can use `NPM_TOKEN=` or `npm_token=`; quoted values are supported without `source`-ing secrets as shell code first.
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
- echo "runctl update: installing from Git ($git_target)..."
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 "$git_target"
370
+ pnpm add -g --force "$spec"
347
371
  else
348
- npm install -g "$git_target"
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.6",
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",