Skip to content

Latest commit

 

History

History
149 lines (92 loc) · 3.34 KB

File metadata and controls

149 lines (92 loc) · 3.34 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 Node.js LTS or newer. For installation instructions, see Install Node.js.

Install dependencies

Enable pnpm with Corepack and install dependencies:

npm i corepack@latest -g
corepack enable
pnpm install

This installs dependencies, links packages inside the monorepo, and runs the Nx-powered prepare script.


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

Add new tests

Add tests for every bug fix or feature. 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 powered by Playwright:

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

Linting

Run Rslint to keep code style consistent:

pnpm run lint

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. Checkout a new release branch, for example release_v1.2.0
  2. Run pnpm bump in the package directory to update the version of each package.
  3. Create a pull request, the title should be release: v1.2.0.
  4. Run the release action to publish packages to npm.
  5. Merge the release pull request to main.
  6. Generate the release notes via GitHub, see Automatically generated release notes