Ship the diffr binary as per-platform npm packages - #88
Merged
Merged
Conversation
@dev.fast/diffr now lists @dev.fast/diffr-{darwin-arm64,darwin-x64,
linux-x64,linux-arm64,win32-x64} as optional dependencies, so npm and
pnpm install the binary for the machine with the package.
diffrBinaryPath() resolves it. This replaces diffr-fetch and pins.json:
installs no longer reach GitHub, and package integrity replaces the
pinned checksums.
The release workflow stages each platform package from the diffr-cli
archive and publishes them, then this package. diffr-ts/package.json
now moves with Cargo.toml in the version bump, so there is no pin PR.
AI assistance: written with Claude Code.
6 of 9 tasks
sidkmenon
approved these changes
Oct 5, 2026
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.
@dev.fast/diffronly fetched the binary from GitHub releases at run time (diffr-fetch). Whiteboard's headless server on a remote host has to fetch it on attach, which fails on hosts that can reach npm but not github.com. This ships the binary through npm instead, the way esbuild and biome do.@dev.fast/diffr-{darwin-arm64,darwin-x64,linux-x64,linux-arm64,win32-x64}, each holding onlydiffr(ordiffr.exe) withos/cpuset, andlibc: glibcon Linux.@dev.fast/diffrlists them asoptionalDependenciesat its own version. npm and pnpm install only the one that matches the machine.diffrBinaryPath()returns that binary, orundefined(musl, Windows arm64,--omit=optional). It resolves from the package's own directory, so it still works when a bundler inlines the package (Whiteboard's tsdown build does) and under pnpm's isolated layout.bin/fetch.mjs,pins.jsonandscripts/pin.mjs. Registry integrity replaces the pinned checksums.scripts/release.py npmstages the platform packages from thediffr-cliarchives and addsoptionalDependenciestodiffr-ts/package.jsonat publish time. The source keeps none, sobun install --frozen-lockfiledoes not need versions that are not published yet.release.ymlgets annpmjob afterpublish(platform packages first, skipping versions already published so a rerun is safe) and annpm-smokematrix that installs from the registry on all five runners and checksdiffr --version. It publishes with provenance and anNPM_TOKENsecret until trusted publishing is set up;npm trustneeds the packages to exist first.diffr-ts/package.jsonnow moves withCargo.tomlin the release bump, enforced by a test, so the separate pin PR goes away.Testing
release.py npmagainst the real 0.1.10 archives; packed all six tarballs (~16–18 MB each).diffr-darwin-arm64, anddiffrBinaryPath()runsdiffr 0.1.10. Same through an esbuild bundle under pnpm.undefined.bun test(against a localcargo build --locked) andbun run typecheckpass.actionlintis clean.AI assistance: written with Claude Code.