How mapbox/pixelmatch works
Project type and purpose
• From the README and file tree, this is an open-source JavaScript library and command-line tool (“pixelmatch”) for pixel-level image comparison. It exposes a compact core API for image diffing, a CLI frontend, benchmark script, test suite, and supports both Node.js and browser environments.
File structure
• Top-level files:
• index.js – the core pixelmatch function implementation (≈150 lines, zero dependencies)
• bin/pixelmatch – CLI wrapper that parses args, reads PNGs, invokes index.js, writes output
• bench.js – benchmarking harness to measure performance
• test/ – test suite with fixtures and test runner (test/test.js + test/fixtures)
• tsconfig.json, eslint.config.js – configuration for TypeScript checks (if any) and linting
• .github/workflows/node.yml – CI pipeline for Node tests
• package.json + package-lock.json – npm packaging and metadata
• No frontend/backend split or microservices—this is a single-module library + CLI tool.
README for additional insights
• Mentions zero dependencies, bench.js for speed, and pngjs as an example consumer in Node.