Skip to content

Latest commit

 

History

History
121 lines (82 loc) · 4.57 KB

File metadata and controls

121 lines (82 loc) · 4.57 KB

Dinero.js

Contributing to Dinero.js

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.

❓ Should I contribute?

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.

💻 Install

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 install

🖥️ Project organization

The 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 factory

📖 Conventions

The 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.

Commit messages

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): subject

Available types are:

  • build: changes affecting the build system or external dependencies
  • ci: changes to CI configuration files and scripts
  • docs: documentation changes
  • feat: a new feature
  • fix: a bug fix
  • perf: changes improving performance
  • refactor: changes that neither fixes a bug nor adds a feature
  • test: adding or fixing tests
  • style: a linting commit
  • revert: a revert of a previous commit

Pull requests

Pull requests must target main. As with commit messages, pull request titles must follow the conventional commits convention.

Branch organization

The project uses two sorts of long-lived branches:

  • main as the default branch, where the latest version of the project lives
  • vx (where x is 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.

Tests

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 test

Linting

The 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.

📚 Documentation

The documentation lives in the docs/ directory and is built with VitePress. You can run it locally:

npm run docs:dev

All documentation files are Markdown (.md) files organized by section.