Repository navigation
build: add an npm release command that builds and validates - #115
Merged
Merged
Conversation
Add `npm run test:release`, which builds imagediff.js and imagediff.min.js fresh from the files npm would publish and runs the Node, CLI and browser specs against each. With --committed it also checks that the committed build outputs match the fresh build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace make/release-check.js and its .release/ staging with one IMAGEDIFF_LIBRARY variable that runs the Node and browser specs against a built file. test:release builds, runs npm test against both builds, and fails if the build changed the committed outputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace test:release with `npm run release`, which builds the release files and runs the specs against both (test:built). `npm publish` (prepublishOnly) refuses to publish if the built files differ from what's committed or fail the specs, without rebuilding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
hsd review round 3 Verdict: approve. This does what the rewritten #113 asks. The validation is carried over unchanged from #114, which I approved in round 2. The new parts are the Checked in the dev container (
Against the issue:
Nits (not blocking):
|
Collaborator
Author
|
hsd: ready for human review after 1 review round(s). Agent sessions are still live in |
cesutherland
approved these changes
Oct 30, 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.
Closes #113
Replaces #114, which was closed for the rewrite of #113.
Summary
IMAGEDIFF_LIBRARY=<path from repo root> npm testruns the Node specs with that file loaded throughrequireand the browser specs with it loaded as a<script>global. If it's unset, the specs usejs/imagediff.js.npm run test:builtruns this forimagediff.jsand thenimagediff.min.js.npm run releaserunsnpm run build && npm run test:built. The fresh files stay in place, ready to commit in the release PR. It doesn't bump, tag or publish.npm publishruns aprepublishOnlyscript:git diff --exit-code --stat HEAD -- imagediff.js imagediff.min.js && npm run test:built. It refuses to publish if the built files differ from what's committed or if they fail the specs. It never rebuilds.npm run release.Decisions
HEAD. npm publishes the working tree, so "what's published matches what's committed" needs an explicit check. Uncommitted edits to the built files makenpm publishfail and print which file differs.npm publishvalidates the committed files as they are. Whether they're a fresh build of the source is settled in the release PR bynpm run release.VAR=valueintest:built, so they won't run under Windowscmd. They're maintainer-only release scripts.bin/imagediffloadsjs/imagediff.js, so the CLI specs in each run exercise the source, not the built file. Unchanged from test: smoke-test the built release files #114.npm run releasein the release PR. I didn't edit chore(release): 2.0.0 #101 itself because it's outside this ticket.Found while testing (not fixed here, worth a ticket before 2.0.0)
npm publish --dry-runwarns"bin[imagediff]" script name bin/imagediff was invalid and removed, and the published manifest would have nobin. Installs would then not get theimagediffcommand. This is the same on master, so it isn't caused by this change. npm also needs--tagto publish the prerelease version2.0.0-alpha.1.Testing (dev container image)
npm run release: the build passes and the specs pass against both files (44 Node and 39 browser specs each). Afterwardsgit statusshows the committed build outputs unchanged, so they match a fresh build.throwtoimagediff.min.jsmakesnpm run test:builtexit 1.npm publish --dry-run, run in a container with the repo's.gitmounted:prepublishOnlyran both test passes and they passed. npm then stopped on the prerelease--tagrequirement above.git diff --exit-code HEADguard exits 1 with an editedimagediff.jsand 0 when it's clean.npm testwithIMAGEDIFF_LIBRARYunset still passes against the source.🤖 Generated with Claude Code