This repository contains the public scripts for Simple Analytics. When making changes keep the following points in mind.
- Use Node.js 22.16 (see
.nvmrc). - Run
npm run buildto compile the scripts. This generates the files indist/which should be committed. - Format code with Prettier before committing. You can run
npx prettier -w .or validate withnpm run prettier.
- Execute
npm run test:unitto run the unit tests - When adding a new feature or fixing a bug, please add a test.
- For every change, run
npm run buildto ensure the test uses the latest compiled version. - Ignore most files in the
dist/directory when checking for diffs, just checkdist/latest/latest.dev.jsanddist/latest/auto-events.js(whichever is relevant). - Only tests in
test/unit/are relevant for the AI and agents (it can run without internet access).
Most work happens in src/ with compile.js creating the distributable versions. Read README.md for more details about contributing and running scripts locally.