Skip to content

Publish the CLI to npm so npx major works - #198

Merged
josegironn merged 2 commits into
mainfrom
npm-publishing
Oct 9, 2026
Merged

josegironn merged 2 commits into
mainfrom
npm-publishing

Conversation

@josegironn

@josegironn josegironn commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • npm/major/ is the major package: a small Node launcher that runs the binary for the user's platform. The binaries come from @major-tech/major-<os>-<arch> packages listed as optionalDependencies, so npm installs only the matching one. No install scripts, which npm 12 no longer runs by default.
  • npm/publish.sh packages GoReleaser's dist/ binaries, stamps the tag version, and publishes the four platform packages and then major. Versions already on npm are skipped, so make rerelease is safe.
  • release.yml publishes through npm trusted publishing (GitHub OIDC): it adds id-token: write, uses Node 24 with the latest npm, and stores no npm token. This avoids the 2FA-bypass token deprecation.
  • README gets an npm install section.
  • major update detects npm installs (binary under node_modules): global installs run npm install -g major@latest, npx runs just get a note, instead of re-running install.sh.

Setup already done

  • major (owned by jmgironn) and the four @major-tech/major-* packages exist on npm as 0.0.0.
  • All five are linked to major-technology/cli and release.yml for trusted publishing.

Test plan

  • Built all four binaries locally, ran publish.sh with npm pack in place of npm publish, installed the tarballs, and npx major --version printed the stamped version
  • go test ./... passes, including a new npmInstallMethod path test; major update from a simulated _npx path reports npx
  • First tagged release after merge publishes all five packages, then npx major --version works

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoJ5NB4XUb8U8zKQyrAeH8

Made with Orca 🐋

Each release publishes the GoReleaser binaries as @major-tech/major-<os>-<arch>
packages, plus a `major` launcher package that picks the right one through
optionalDependencies (no install scripts). Publishing uses npm trusted
publishing (GitHub OIDC), so no npm token is stored.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoJ5NB4XUb8U8zKQyrAeH8
A binary inside node_modules came from the npm package, so update via
`npm install -g major@latest` (or tell npx users it already runs latest)
instead of re-running install.sh.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoJ5NB4XUb8U8zKQyrAeH8
@josegironn
josegironn merged commit 340c928 into main Oct 9, 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