Contributing
Thank you for helping. Bug reports, ideas, documentation and code are all welcome. For a new chart type or a change to a spec, open an issue first.
Branches
mainis what is released. Nobody works on it.devis the next version. Start from it and open your pull request against it.- Name a branch by its theme:
feat/kagi,fix/legend-wrap,docs/maps. - One theme for each pull request, small commits with a clear sentence.
When a version is ready, dev is merged into main and tagged; the tag publishes it.
Start
bash
git clone https://github.com/BenMacha/nervure.git
cd nervure
git checkout dev
npm install
npm run dev # demo page
npm run check # what the pull request must passNode 20 or later.
Where things are
| Folder | Holds |
|---|---|
src/core | drawing helpers, scales, animation, export, registry |
src/charts/<family> | one file for each chart |
src/specs | the types of each family: they are the documentation of the API |
src/geo, maps | projections and map files |
src/samples.ts | made-up data for each chart |
test | every sample is drawn at three sizes |
docs | the site |
Add a chart
- Write its spec in
src/specs/<family>.ts, with a comment on each field that is not obvious. - Write
src/charts/<family>/<name>.ts. It exports aChartDefinition:draw,describe(read by screen readers) andtable(the CSV). - Register it in the
index.tsof the family. - Add a sample in
src/samples.ts: the gallery, the editor and the tests use it. npm run check.
Rules
- No runtime dependency.
- Text from data goes through
textContent, neverinnerHTML. The linter checks it. - No
any, no unused code. Prettier decides the layout:npm run format. - A chart draws nothing false: no negative size, no
NaN, at any size, with empty data. - It reads well at 300 px wide and in a dark theme.
- The size budget of
npm run sizeis a promise. - Write your own code. Do not copy code or examples from another chart library.
- Map files keep one country named Palestine (
PS); a test checks it.
Code written with an AI agent
It is welcome, under the same rules as any other code, and with these:
- Say it. The pull request names the agent and the model, for example
Agent: Claude Opus 5.5 (Claude Code). - Answer for it. The person who opens the pull request has read every line and can explain it.
- Prove it. The tests were run, and the chart was looked at on a screen.
- Keep it small. One theme, no sweeping rewrite.
- Nothing private, nothing copied. No data from a company, no code from another library.
Agents read AGENTS.md first. A pull request that hides its agent is closed.
Conduct and license
Be kind: code of conduct. By contributing you agree that your work is released under the MIT license. Questions: contact@benmacha.tn.