Files
airship/airship.cmd
T
Nayan 4c2d1c822d feat(cli): add ./airship, a dev wrapper that rebuilds the stale bundle
tsup inlines every @airship/* package into apps/cli/dist/index.js
(noExternal), so an edit anywhere under packages/ is invisible until the
CLI is rebuilt. The Makefile could not catch that: $(CLI) was a file
prerequisite with no source prerequisites, so `@pnpm build` ran only when
dist was absent. Once it existed, `make run` launched the stale bundle
silently.

./airship is a pure passthrough — argv untouched, cwd never changed, so
--cwd, the upward config search and the bare-invocation wizard behave
exactly as the published binary does — that mtime-scans apps/cli and
packages/* and shells out to turbo only when something moved.

Three things the obvious implementation gets wrong:

- Turbo hashes contents, so a cache hit leaves dist/ untouched and a
  plain mtime comparison never converges. A successful build stamps the
  entry, but only when turbo did not rewrite it, since stamping backwards
  reopens the window tsup's `clean` creates on apps/cli's own mtime.
- Scanning */src misses real build inputs. `turbo --dry=json` reaches
  package.json, tsconfig.json, scripts/ and editor-icons' 507 SVGs under
  assets/, so the scan covers package roots minus a skip set.
- SIGINT arrives from the tty at the whole process group, so forwarding
  it would trip the CLI's own second-Ctrl-C escape hatch; SIGTERM arrives
  at one pid, so swallowing it would hang. Swallow the first, forward the
  second.

The logic lives in scripts/airship-run.mjs so airship.cmd gives Windows
the same behaviour rather than a degraded passthrough. The Makefile's
run:* and doctor targets now go through the wrapper, so they inherit the
build check; a test reserves the wrapper's two flag names, since the CLI
generates --no-<name> for every boolean and would collide silently.
2026-08-16 13:05:37 +05:30

20 lines
899 B
Batchfile

@echo off
:: The workspace's own airship, in shorthand — the Windows half of ./airship.
::
:: `make` is not available here (see CONTRIBUTING.md § On Windows), so this is
:: the supported way to run the CLI built from this tree. It is a pure
:: passthrough, and it rebuilds when the inlined workspace packages change,
:: exactly like the bash script does.
::
:: airship --target 3000 --cwd ..\my-app
:: airship doctor
::
:: %* rather than %1 %2 ...: it forwards the command line with its original
:: quoting intact, which `airship --exec "pnpm dev"` depends on. %~dp0 is this
:: file's own directory, with a trailing backslash, so nothing here depends on
:: the working directory — which must reach the CLI untouched.
node "%~dp0scripts\airship-run.mjs" %*
:: Explicit, so the CLI's exit codes (2 usage, 127 unknown command) survive
:: being called from another script.
exit /b %errorlevel%