You want to contribute to Dinero.js, and that's awesome 🎉👍 Thanks for that!
Before you dive in head first, there are a couple of guidelines to follow. Please make sure you read and understand them before you contribute. Note that this isn't set in stone. Polite debate and suggestions are welcome, as long as it's compliant with the code of conduct, and it's done with the best interest of the library and the end-users in mind.
Pushing your first contribution can be intimidating. A great way to start is by fixing issues. Find an open and confirmed issue, and open a pull request that fixes it.
✅ Please do:
- Fix bugs.
- Improve performance.
- Refactor with better design patterns.
- Improve the build process (speed, error handling, deprecations, etc.)
- Improve the docs (typos, lack of clarity, etc.)
🚫 Please don't:
- Go against the library's philosophy (immutability, modularity, etc.)
- Make changes based on personal preferences rather than problem-solving.
- Develop features that aren't in the scope of the library (if not sure, ask before you code).
- Introduce breaking changes.
The project relies on Node.js. It's also recommended to use Node Version Manager to ensure you're using the right Node.js version.
To get started, clone the project and install the dependencies from your terminal:
git clone https://github.com/dinerojs/dinero.js.git
cd dinero.js
nvm use
npm installThe project source lives in the packages/dinero.js/ directory.
packages/
└── dinero.js/
└── src/
├── api/ # All API functions
├── bigint/ # BigInt entry point
├── calculator/ # Calculator implementations
├── core/ # Types and utilities
├── currencies/ # ISO 4217 currencies
└── dinero/ # Dinero factoryThe project observes a few rules and conventions when it comes to code. Most of them are automated, but make sure you understand them before submitting changes.
The project follows the conventional commits approach to standardize commit messages, generate the changelog and resolve the next version. It means that all commit messages should be formatted using the following scheme:
type(optional scope): subjectAvailable types are:
build: changes affecting the build system or external dependenciesci: changes to CI configuration files and scriptsdocs: documentation changesfeat: a new featurefix: a bug fixperf: changes improving performancerefactor: changes that neither fixes a bug nor adds a featuretest: adding or fixing testsstyle: a linting commitrevert: a revert of a previous commit
Pull requests must target main. As with commit messages, pull request titles must follow the conventional commits convention.
The project uses two sorts of long-lived branches:
mainas the default branch, where the latest version of the project livesvx(wherexis a number, for example,v1) to version previous major versions
Pull requests should target the main branch unless fixing critical issues in previous major versions.
The project uses Vitest for testing. Every public API should be tested. You should run tests before you commit, or at least before you open a pull request. Pull requests need to pass all checks to be reviewed, so doing it beforehand will save you time.
npm testThe project uses Prettier for code formatting and Oxlint for linting. Both run automatically when you commit, so you can go ahead and format as you like while writing code; it will be overridden anyway.
If Oxlint finds issues, you can fix them manually and try committing again.
The documentation lives in the docs/ directory and is built with VitePress. You can run it locally:
npm run docs:devAll documentation files are Markdown (.md) files organized by section.