Thanks for your interest in contributing! This guide will help you get set up.
- Node.js 18+ (LTS recommended)
- npm 9+ (comes with Node.js)
git clone https://github.com/Benji377/data2image.git
cd data2image
npm install
npm run build
npm testThis is an npm workspaces monorepo with three packages:
packages/
core/ @data2image/core - encoder/decoder library (ESM + CJS)
cli/ data2image - CLI tool
web/ @data2image/web - website (Vite, deployed to GitHub Pages)
# Build everything
npm run build
# Build a single package
npm run build --workspace=packages/core# Run all tests
npm test
# Watch mode
npm run test:watch --workspace=packages/corenpm run dev:webOpens a local Vite dev server at http://localhost:5173/data2image/.
- Create a branch from
main - Make your changes - keep commits focused and descriptive
- Add tests for new functionality in
packages/core/tests/ - Run tests -
npm testmust pass - Build -
npm run buildmust succeed - Open a PR against
main
@data2image/web → @data2image/core
data2image (CLI) → @data2image/core
When modifying @data2image/core, rebuild it before testing dependent packages.
- TypeScript with strict mode
- ESM-first (
"type": "module") - No default exports - use named exports
- Target ES2022
The core library uses a custom binary format (documented in the README). Changes to the format must:
- Maintain backward compatibility with existing
.d2i.pngfiles, or - Bump the magic version byte and handle both versions in the decoder
Releases are handled via GitHub Actions with workflow_dispatch. Maintainers only:
-
Bump versions in
package.jsonfiles:packages/core/package.json→ update"version"packages/cli/package.json→ update"version"
-
Update CHANGELOG.md with:
- New version number and date
- Added/Changed/Fixed entries
-
Commit and push changes to
main -
Run GitHub Actions workflow:
- Go to Actions → Publish to npm → Run workflow
- Select package:
core,cli, orboth - GitHub will publish using Trusted Publishing (OIDC)
- Patch (
1.0.0→1.0.1) - bug fixes only, no API changes - Minor (
1.0.0→1.1.0) - new features, backward compatible - Major (
1.0.0→2.0.0) - breaking changes
npm does not allow overwriting published versions. Once a version is published, you must bump the version to publish again.
By contributing, you agree that:
- Contributions to @data2image/core will be licensed under the MIT License (permissive)
- Contributions to data2image (CLI) will be licensed under the GPLv3 License (copyleft)
- Contributions to the website will be licensed under the GPLv3 License (copyleft)