Skip to content

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 ​

  • main is what is released. Nobody works on it.
  • dev is 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 pass

Node 20 or later.

Where things are ​

FolderHolds
src/coredrawing helpers, scales, animation, export, registry
src/charts/<family>one file for each chart
src/specsthe types of each family: they are the documentation of the API
src/geo, mapsprojections and map files
src/samples.tsmade-up data for each chart
testevery sample is drawn at three sizes
docsthe site

Add a chart ​

  1. Write its spec in src/specs/<family>.ts, with a comment on each field that is not obvious.
  2. Write src/charts/<family>/<name>.ts. It exports a ChartDefinition: draw, describe (read by screen readers) and table (the CSV).
  3. Register it in the index.ts of the family.
  4. Add a sample in src/samples.ts: the gallery, the editor and the tests use it.
  5. npm run check.

Rules ​

  • No runtime dependency.
  • Text from data goes through textContent, never innerHTML. 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 size is 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:

  1. Say it. The pull request names the agent and the model, for example Agent: Claude Opus 5.5 (Claude Code).
  2. Answer for it. The person who opens the pull request has read every line and can explain it.
  3. Prove it. The tests were run, and the chart was looked at on a screen.
  4. Keep it small. One theme, no sweeping rewrite.
  5. 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.