Skip to content

Release 1.0.0: TypeScript, CI, interface picker, --path & --host#1

Merged
botre merged 1 commit into
masterfrom
release/1.0.0
May 8, 2026
Merged

Release 1.0.0: TypeScript, CI, interface picker, --path & --host#1
botre merged 1 commit into
masterfrom
release/1.0.0

Conversation

@botre
Copy link
Copy Markdown
Contributor

@botre botre commented May 8, 2026

Summary

Modernizes the toolchain and ships v1.0.0. Single PR per agreed strategy — solo repo, coherent release story.

Toolchain

  • Migrate to TypeScript + tsup (source moves to src/cli.ts, built to dist/cli.js with the shebang preserved). Lint via tsc --noEmit.
  • Upgrade yargs 17 → 18, prettier 2 → 3, husky 7 → 9. Drop unused pretty-quick dev dep.
  • Add Node engines: ^20.19.0 || ^22.12.0 || >=23 (yargs 18 requirement).

CI

  • .github/workflows/check.yml — runs on PRs and via workflow_call (Node 22.x, lint + build).
  • .github/workflows/release.yml — runs on push to master (Node 24.x, build, version bump via phips28/gh-action-bump-version, publish to npm with provenance via trusted publishingid-token: write, no NPM_TOKEN needed).
  • Mirrored from formspark/use-formspark.

CLI fixes

  • Replace dns.lookup(os.hostname()) (returns loopback on Debian/Ubuntu, .local on macOS) with iteration over os.networkInterfaces().
  • When multiple non-internal IPv4 interfaces are detected, classify them (wifi / ethernet / vpn / virtual / other), sort by priority, and prompt with a numbered list (Enter accepts default).
  • Validate --port is an integer in [1, 65535].
  • Wire up the -P short alias (was referenced but never bound).
  • Drop dead async keywords.

New flags

  • --path — append a route, e.g. --path /admin.
  • --host — override the auto-detected LAN IP (Docker, multi-NIC, demos).

Docs / assets

  • Rewrite README with an Options table and Examples section.
  • Replace static screenshot with a vhs-generated demo gif (static/demo.tape checked in for regeneration; --host 192.168.1.42 keeps real IPs out of the recording).

Versioning

Version is 1.0.0-rc.0 in this branch. The release workflow's autobumper does a patch bump on merge, which (per semver) drops the prerelease tag and lands at 1.0.0.

⚠️ Avoid feat: / BREAKING keywords on the merge commit message — those would trigger minor/major bumps. The merge commit defaults to a patch bump, which is what we want.

Pre-merge prerequisite

Before merging, configure npm Trusted Publishing on npmjs.com for localview:

  • npmjs.com → package settings → Trusted Publishing → add publisher
  • Repo: formspark/localview, workflow: release.yml

Without this, the publish step in release.yml will fail (no token, no trusted publisher).

Test plan

  • npm run lint clean
  • npm run build produces dist/cli.js ~6 KB with shebang preserved
  • node dist/cli.js --port 8080 renders QR with correct LAN IP
  • -P 9090 short flag works
  • --port abc / --port 99999 / no port → exit 1 with usage hint
  • --path /admin and --path admin both produce /admin in URL
  • --host 192.168.1.42 skips picker entirely
  • Multi-interface picker on a 4-interface machine sorts wifi → vpn → docker correctly
  • Trusted publishing configured on npmjs.com (see prerequisite above)
  • Merge to master and confirm release workflow lands 1.0.0 on npm

Modernize toolchain and add new flags:

- Migrate to TypeScript + tsup build (src/cli.ts → dist/cli.js)
- Upgrade yargs 17 → 18, prettier 2 → 3, husky 7 → 9
- Drop unused pretty-quick dev dep
- Add GitHub Actions workflows (check, release via npm trusted publishing)
- Replace dns.lookup with os.networkInterfaces(); prompt with classified
  numbered list when multiple non-internal IPv4 interfaces are detected
- Validate --port is an integer in [1, 65535]
- Wire up -P short alias
- Add --path flag for deep-linking
- Add --host flag to override auto-detected LAN IP
- Set Node engines to ^20.19.0 || ^22.12.0 || >=23
- Replace static screenshot with vhs-generated demo gif
- Rewrite README with Options table and examples
@botre botre merged commit 70adeb5 into master May 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant