Thanks for that you are interested in contributing to Rslib. Before starting your contribution, please take a moment to read the following guidelines.
Use fnm or nvm to run the command below. This will switch to the Node.js version (currently 18) specified in the project's .nvmrc
file.
# with fnm
fnm use
# with nvm
nvm use
Enable pnpm with corepack:
corepack enable
Install dependencies:
pnpm install
What this will do:
- Install all dependencies.
- Create symlinks between packages in the monorepo
- Run the prepare script to build all packages, powered by nx.
Once you have set up the local development environment in your forked repo, we can start development.
It is recommended to develop on a new branch, as it will make things easier later when you submit a pull request:
git checkout -b MY_BRANCH_NAME
Use nx build to build the package you want to change:
npx nx build @rslib/core
Build all packages:
pnpm run build
You can also use the watch mode to automatically rebuild the package when you make changes:
npx nx build @rslib/core --watch
If you've fixed a bug or added code that should be tested, then add some tests.
You can add unit test cases in the <PACKAGE_DIR>/tests
folder. The test runner is based on Vitest.
Before submitting a pull request, it's important to make sure that the changes haven't introduced any regressions or bugs. You can run the unit tests for the project by executing the following command:
pnpm run test:unit
You can also run the unit tests of single package:
pnpm run test:unit packages/core
Rslib will also verify the correctness of generated artifacts. You can run the artifact tests by executing the following command:
pnpm run test:artifact
If you need to run a specified test, you can add keywords to filter:
# Only run test cases which contains `dts` keyword in file path
pnpm test:artifact dts
# Only run test cases which contains `dts` keyword in test name
pnpm test:artifact -t dts
To help maintain consistency and readability of the codebase, we use Biome to lint the codes.
You can run the linters by executing the following command:
pnpm run lint
For VS Code users, you can install the Biome VS Code extension to see lints while typing.
We use changesets to manage version. Currently, all rslib packages will use a fixed unified version.
The release notes are automatically generated by GitHub releases.
Repository maintainers can publish a new version of all packages to npm.
Here are the steps to publish (we generally use CI for releases and avoid publishing npm packages locally):
- Create release pull request.
- Run the release action.
- Generate the release notes.
- Merge the release pull request.
The project is still in its early stages and under active development, so it possible dependents on Rsbuild or Rspack canary versions to test the latest features. The current canary versions are:
Package | Link |
---|---|
@rspack/core | PR |