Repository navigation
Publish @funky-dev/cli to npm on release - #4
Merged
Merged
Conversation
Each release now also publishes one npm package per platform holding that platform's binary, and @funky-dev/cli, which lists them as optional dependencies and runs the matching one from a small Node shim, the way esbuild and Biome ship. No postinstall download, so it works with --ignore-scripts. Publishing runs in its own job after the GitHub release, with provenance, and skips versions already out so a failed run can be re-run. CI packs the packages from the snapshot build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
npm install -g @funky-dev/cli(ornpx @funky-dev/cli login) installs thefunkycommand.npm/publish.mjsturns GoReleaser'sdist/into npm packages: one per platform (@funky-dev/cli-darwin-arm64,-darwin-x64,-linux-arm64,-linux-x64,-win32-arm64,-win32-x64), each holding only its binary and restricted withos/cpu, then@funky-dev/cli. The main package lists them all asoptionalDependencies, so npm installs only the matching one, andbin/funky.jsruns it, passing through arguments, exit code and signals. Same approach as esbuild and Biome. There is no postinstall download, so it works with--ignore-scriptsand behind proxies.v0.2.0-rc.1) publish under npm'snexttag, so they're not whatnpm iinstalls.npmjob runs after the GitHub release, using thedist/artifact. It publishes with provenance and skips versions that are already published, so a failed publish can be fixed with "Re-run failed jobs" without touching the GitHub release.--dry-run).Auth
The first publish uses the
NPM_TOKENrepo secret (already set; expires Nov 5). npm only allows trusted publishing (OIDC, no token) to be configured once a package exists, so after the first release: addfunkyhq/cli/release.ymlas a trusted publisher on each of the 7 packages, then delete the secret. The job already hasid-token: writefor that.Testing
goreleaser release --snapshot --cleanand thennode npm/publish.mjs --dry-run: 7 tarballs; the binary keeps its executable bit; versions andoptionalDependenciesare filled in.npm install -g --prefix <tmp>.funky --version,funky whoami(a real production login) and a failingfunky applywork through the shim, with exit codes passed through. With the platform package removed, it prints how to fix the install.🤖 Generated with Claude Code