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 specified in the project's .nvmrc file.
# with fnm
fnm use
# with nvm
nvm useEnable pnpm with corepack:
corepack enableInstall dependencies:
pnpm installWhat this will do:
- Install all dependencies.
- Create symlinks between packages in the monorepo
- Run the prepare script to set up Git hooks.
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_NAMEUse pnpm to build a specific package:
pnpm --filter @rslib/core run buildBuild all packages:
pnpm run buildYou can also use the watch mode to automatically rebuild the package when you make changes:
pnpm --filter @rslib/core run build --watchIf 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.
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:unitYou can also run the unit tests of single package:
pnpm run test:unit packages/coreUpdate snapshots:
pnpm run test:unit -uRslib will also verify the correctness of generated artifacts. You can run the integration tests by executing the following command:
pnpm run test:integrationIf 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 dtsTo help maintain consistency and readability of the codebase, we use Rstack CLI to lint and format the code.
You can run the linter by executing the following command:
pnpm run lintYou can format files by executing the following command:
pnpm run formatFor VS Code users, you can install the Rstack VS Code extension to see lints while typing and format files.
Repository maintainers can publish a new version of changed packages to npm.
- Trigger the
releaseskill in repo with the target version to prepare the release branch and create the release pull request. - Ensure the release pull request CI check passes.
- Run the release action to publish packages to npm.
- Merge the release pull request to
main. - Use the
create-draft-release-notesskill to create a draft GitHub release note. Review the draft release note, optionally add release highlights, and publish it.