Rslib contributing guide

May 7, 2026 ยท View on GitHub

Thanks for that you are interested in contributing to Rslib. Before starting your contribution, please take a moment to read the following guidelines.

Install Node.js

Use fnm or nvm to run the command below. This will switch to the Node.js version specified in the project's .nvmrc file.

# with fnm
fnm use

# with nvm
nvm use

Install dependencies

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.

Making changes and building

Once you have set up the local development environment in your forked repo, we can start development.

Checkout a new branch

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

Build the package

Use pnpm to build a specific package:

pnpm --filter @rslib/core run build

Build all packages:

pnpm run build

You can also use the watch mode to automatically rebuild the package when you make changes:

pnpm --filter @rslib/core run build --watch

Testing

Add new tests

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

Run unit tests

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

Update snapshots:

pnpm run test:unit -u

Run integration tests

Rslib will also verify the correctness of generated artifacts. You can run the integration tests by executing the following command:

pnpm run test:integration

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:integration dts
# Only run test cases which contains `dts` keyword in test name
pnpm test:integration -t dts

Linting and formatting

To help maintain consistency and readability of the codebase, we use Rslint to lint the code and Prettier to format it.

You can run the linter by executing the following command:

pnpm run lint

You can format files by executing the following command:

pnpm run format

For VS Code users, you can install the Rslint VS Code extension to see lints while typing and the Prettier VS Code extension to format files.

Releasing

Repository maintainers can publish a new version of changed packages to npm.

  1. Trigger the release skill in repo with the target version to prepare the release branch and create the release pull request.
  2. Ensure the release pull request CI check passes.
  3. Run the release action to publish packages to npm.
  4. Merge the release pull request to main.
  5. Generate the release notes via GitHub, see Automatically generated release notes