From 2b4c34eb4e2547fe8cec1d6728c77d821b92fdfd Mon Sep 17 00:00:00 2001 From: hgt-bot Date: Fri, 30 Oct 2026 11:06:30 -0400 Subject: [PATCH 1/2] test: run the cli and load specs against the source Co-Authored-By: Claude Opus 5.5 --- bin/imagediff | 2 +- spec/LoadSpec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/imagediff b/bin/imagediff index cf60e03..3ac0c1d 100755 --- a/bin/imagediff +++ b/bin/imagediff @@ -1,7 +1,7 @@ #!/usr/bin/env node var fs = require('fs'), - imagediff = require('../imagediff.js'), + imagediff = require('../js/imagediff.js'), Canvas = require('canvas'); commandLine(process.argv.slice(2)); diff --git a/spec/LoadSpec.js b/spec/LoadSpec.js index 087ae43..913102e 100644 --- a/spec/LoadSpec.js +++ b/spec/LoadSpec.js @@ -1,4 +1,4 @@ -// Loads the built library in a fresh Node process, the way bundlers and +// Loads the library source in a fresh Node process, the way bundlers and // installs without the optional `canvas` dependency see it. var childProcess = require('child_process'), @@ -6,7 +6,7 @@ var describe('loading imagediff', function () { - var LIBRARY = path.join(__dirname, '..', 'imagediff.js'); + var LIBRARY = path.join(__dirname, '..', 'js', 'imagediff.js'); // Runs `body` in a child process with `canvas` unresolvable and calls back // with the JSON it prints. From f3d853b111cde1ddece61aab7411502ce745fff1 Mon Sep 17 00:00:00 2001 From: hgt-bot Date: Fri, 30 Oct 2026 11:06:30 -0400 Subject: [PATCH 2/2] docs: rebuild the committed build outputs only at release Co-Authored-By: Claude Opus 5.5 --- CONTRIBUTING.md | 4 ++++ README.md | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8f44b2b..4913bd1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,3 +16,7 @@ ci: add a dev container chore: declare the Node version for local development docs: trim local setup to the essentials ``` + +## Build outputs + +`imagediff.js` and `imagediff.min.js` are generated by `npm run build` and committed for releases. Rebuild and commit them only when preparing a release; ordinary PRs change `js/imagediff.js` and leave the built files alone. `npm test` runs against the source, including the CLI, so nothing needs rebuilding to test a change. diff --git a/README.md b/README.md index c0b12c3..b8eb422 100644 --- a/README.md +++ b/README.md @@ -88,11 +88,11 @@ npm test ### Scripts -* `npm test` runs the specs in Node.js and then in headless Chromium, and fails if either fails. +* `npm test` runs the specs in Node.js and then in headless Chromium, and fails if either fails. The specs and the CLI use the source in `js/`, so no build is needed first. * `npm run test:node` runs the specs, including a smoke test of the `imagediff` CLI, in Node.js against [node-canvas](https://github.com/Automattic/node-canvas) (the optional `canvas` dependency, which `npm ci` installs from prebuilt binaries on common platforms). * `npm run test:browser` runs the specs in headless Chromium with Playwright. * `npm run test:serve` serves the specs at http://localhost:8085/spec/ to watch them run in a browser. -* `npm run build` (or `make imagediff`) writes `imagediff.js` (license header + `js/imagediff.js`) and `imagediff.min.js`, minified with [terser](https://terser.org/) to ES5 output. +* `npm run build` (or `make imagediff`) writes `imagediff.js` (license header + `js/imagediff.js`) and `imagediff.min.js`, minified with [terser](https://terser.org/) to ES5 output. Run it only when preparing a release; see [CONTRIBUTING.md](CONTRIBUTING.md#build-outputs). ### Dev container