Skip to content

Latest commit

 

History

History
157 lines (96 loc) · 3.78 KB

CONTRIBUTING.md

File metadata and controls

157 lines (96 loc) · 3.78 KB

Rsbuild contribution guide

Thank you for your interest in contributing to Rsbuild! Before you start your contribution, please take a moment to read the following guidelines.


Setup the environment

Fork this repository to your own GitHub account and then clone it locally.

Branches

  • main -> Rsbuild v2.x
  • v1.x -> Rsbuild v1.x
  • v0.x -> Rsbuild v0.x

Install Node.js

Use the Node.js version specified in .node-version. For installation instructions, see Install Node.js.

Install dependencies

Use the pnpm version specified by packageManager in package.json. Enable pnpm with Corepack and install dependencies:

npm i corepack@latest -g
corepack enable
pnpm install

Keep shared dependency versions in the catalogs in pnpm-workspace.yaml.


Making changes and building

Checkout a new branch

Create a dedicated branch for your changes:

git checkout -b MY_BRANCH_NAME

Build the package

Build the package you want to change:

pnpm --filter core run build

Build everything:

pnpm run build

Testing

Run pnpm build once before running unit or end-to-end tests, including focused runs. The tests depend on built workspace packages.

Add new tests

Add focused tests for bug fixes and features. Prefer end-to-end tests for build and dev server behavior, and unit tests for individual functions. Update all affected snapshots when behavior changes.

Unit tests live in <PACKAGE_DIR>/tests and use Rstest.

Run unit tests

Run all unit tests:

pnpm test

Run a single package:

pnpm test core

Run E2E tests

Run end-to-end tests with Rstest as the test runner and Playwright for browser automation:

pnpm run e2e

If you need to run a specified test, you can add keywords to filter:

# Only run test cases which contains `css` keyword in file path
pnpm e2e css

Code checks

Run the unified Rstack checks to lint with Rslint, type-check TypeScript, and verify formatting:

pnpm run check

To fix formatting issues:

pnpm run format

Install the Rslint VS Code extension to see lints while typing.


Documentation

You can find the Rsbuild documentation in the website folder.


Submitting changes

Committing your changes

Commit your changes to your forked repo, and create a pull request.

Normally, the commits in a PR will be squashed into one commit, so you don't need to rebase locally.

Format of PR titles

The format of PR titles follow Conventional Commits.

An example:

feat(core): Add `myOption` config
^    ^    ^
|    |    |__ Subject
|    |_______ Scope
|____________ Type

Releasing

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

  1. Use the release-core skill for @rsbuild/core and create-rsbuild, or release-plugin-package for an official plugin, to prepare the version changes and release pull request.
  2. Run the release action to publish packages to npm.
  3. Merge the release pull request to main.
  4. Generate the release notes via create-draft-release-notes skill.