You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build: add an npm release command that builds and validates #113
Preparing a release takes two steps, building the files and then validating them (#113), and it's easy to skip the second. Publishing should also refuse to ship built files that don't pass.
What
npm run release builds the release files and validates them in place, leaving them ready to commit in the release PR. It doesn't tag or publish.
npm publish validates the committed built files first and refuses to publish if they fail. It doesn't rebuild, so what's published matches what's committed.
Add npm run test:release (script in make/release-check.js). It:
Copies the files npm pack would publish into a gitignored .release/ directory and runs make/build.js there, so the repo's committed imagediff.js/imagediff.min.js are left untouched.
Runs the existing Node specs (library, load and CLI specs) once against the fresh imagediff.js via require of the staged package (its main), and once against imagediff.min.js. The CLI spec runs the staged bin/imagediff.
Runs the existing browser specs in Chromium with the page loading each built file as a plain <script> global.
With --committed (for release PRs), also fails unless the repo's imagediff.js and imagediff.min.js match the fresh build byte for byte.
The specs pick their target from env vars (IMAGEDIFF_LIBRARY, IMAGEDIFF_BIN) and the spec page from a ?lib= query param, defaulting to the source, so npm test is unchanged.
Document it in the README and CONTRIBUTING (run before publishing), and point chore(release): 2.0.0 #101 at it.
PR #114 was closed unmerged, so the validation it added (pointing npm test at a built file with IMAGEDIFF_LIBRARY) isn't on master. I'll carry that forward unchanged and build the release commands on it:
npm run test:built runs npm test against imagediff.js and then imagediff.min.js, through require in Node and as a <script> global in the browser.
npm run release runs npm run build and then npm run test:built. It leaves the fresh files in place to commit, and doesn't tag or publish.
A prepublishOnly script refuses npm publish if the built files differ from what's committed (git diff against HEAD) and then runs npm run test:built. It doesn't rebuild.
Update the README and CONTRIBUTING release instructions to say to use npm run release. I can't edit chore(release): 2.0.0 #101 from here, so the PR will note the line it needs.
This goes on a fresh branch from master, in a new PR, since #114 was closed.
Activity
hsd-bot commentedon Oct 30, 2026
hsd: Implementation plan
npm run test:release(script inmake/release-check.js). It:npm packwould publish into a gitignored.release/directory and runsmake/build.jsthere, so the repo's committedimagediff.js/imagediff.min.jsare left untouched.imagediff.jsviarequireof the staged package (itsmain), and once againstimagediff.min.js. The CLI spec runs the stagedbin/imagediff.<script>global.--committed(for release PRs), also fails unless the repo'simagediff.jsandimagediff.min.jsmatch the fresh build byte for byte.IMAGEDIFF_LIBRARY,IMAGEDIFF_BIN) and the spec page from a?lib=query param, defaulting to the source, sonpm testis unchanged.[-]test: smoke-test the built release files[/-][+]build: add an npm release command that builds and validates[/+]hsd-bot commentedon Oct 30, 2026
hsd: Implementation plan (rewritten ticket)
PR #114 was closed unmerged, so the validation it added (pointing
npm testat a built file withIMAGEDIFF_LIBRARY) isn't on master. I'll carry that forward unchanged and build the release commands on it:npm run test:builtrunsnpm testagainstimagediff.jsand thenimagediff.min.js, throughrequirein Node and as a<script>global in the browser.npm run releaserunsnpm run buildand thennpm run test:built. It leaves the fresh files in place to commit, and doesn't tag or publish.prepublishOnlyscript refusesnpm publishif the built files differ from what's committed (git diffagainstHEAD) and then runsnpm run test:built. It doesn't rebuild.npm run release. I can't edit chore(release): 2.0.0 #101 from here, so the PR will note the line it needs.This goes on a fresh branch from master, in a new PR, since #114 was closed.