Contribution to Core
Arclix is an open source React component generation CLI made to make the work of React developers easier. If you're interested in contributing to Arclix, hopefully, this document makes the process for contributing clear.
Prerequisites
- Make sure you have Node.js which includes
npm
greater than v16.
Repo Setup
To develop and test the core Arclix
package:
- Run
npm i
in Arclix root folder. - Do the changes you want in the Arclix.
- Make sure you run
npm run test
and check whether all the tests are passed before raising the PR. - Also make sure you run
npm run build
before raising the PR. - You can also do both step 3 & 4 using
npm run verify
.
Testing
We do unit testing for all the module including core, utility, etc.
Unit Tests
Unit tests are powered by vitest. The detailed configuration of vitest is inside vitest.config.cjs
file.
- Run unit tests under each module using:
npm run test
- Run unit tests with coverage using:
npm run test:coverage
Do maintain the branches
and functions
greater than 70%
in the coverage.
Pull Request Guidelines
Checkout a topic branch from a base branch (e.g.
master
), and merge back against that branch.If adding a new feature:
- Add accompanying test case.
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first, and have it approved before working on it.
If fixing a bug:
- If you are resolving a special issue, add
fix: remove something (#issue id) #PR id
in your PR title for a better release log (e.g.fix: remove something (#1) #2
). - Provide a detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable.
- If you are resolving a special issue, add
It's OK to have multiple small commits as you work on the PR. GitHub can automatically squash them before merging.
Make sure to run the following commands before raising the PR:
npm run format
npm run verify:pr
No need to worry about code style as long as you have installed the dev dependencies. Modified files are automatically formatted with Prettier on commit (by invoking Git Hooks via husky).
PR title must follow the commit message convention so that changelogs can be automatically generated.
Dependencies Guidelines
Arclix aims to be lightweight, and this includes being aware of the number of npm dependencies and their size.
Think Before Adding a Dependency
Most deps should be added to devDependencies
even if they are needed at runtime. Some exceptions are:
- Type packages. Example:
@types/*
. - Deps that cannot be properly bundled due to binary files. Example:
esbuild
.
Avoid deps with large transitive dependencies that result in bloated size compared to the functionality it provides. For example, http-proxy
itself plus @types/http-proxy
is a little over 1MB in size, but http-proxy-middleware
pulls in a ton of dependencies that make it 7MB(!) when a minimal custom middleware on top of http-proxy
only requires a couple of lines of code.