Before submitting your contribution, please make sure to take a moment and read through the following guide:
To set the repository up:
| Step | Command |
|---|---|
| 1. Install Node.js, using the latest LTS | - |
| 2. Install Bun | - |
| 3. Install dependencies under the project root | bun install |
Start the development environment.
Build the project for production. The result is usually under dist/.
This project uses ESLint or Biome for both linting and formatting. They also lint JSON, YAML, and Markdown files if they exist.
You can run bun run lint --fix to let ESLint format and lint the code.
Learn more about the ESLint Setup and the Biome Setup.
Run the tests. This project uses Vitest - a replacement for Jest.
You can filter the tests to be run by bun test [match], for example, bun test foo will only run test files that contain foo.
Config options are under the test field of vitest.config.ts.
Vitest runs in watch mode by default, so you can modify the code and see the test result automatically, which is great for test-driven development. To run the test only once, you can do bun test --run.
There are multiple types of tests set up. Run bun test:unit for unit tests, bun test:e2e for end-to-end tests. bun test runs them together, but you can run them separately as needed.
Vitest also has a UI mode which you can run with bun test --ui or bun test:ui in most projects.
If the project contains documentation, you can run bun run docs to start the documentation dev server. Use bun run docs:build to build the docs for production.
For more, you can run bare bun run, which will prompt a list of all available scripts.
Before you start to work on a feature pull request, it's always better to open a feature request issue first to discuss with the maintainers whether the feature is desired and the design of those features. This would help save time for both the maintainers and the contributors and help features to be shipped faster.
For typo fixes, it's recommended to batch multiple typo fixes into one pull request to maintain a cleaner commit history.
This project uses Conventional Commits for commit messages, which allows the changelog to be auto-generated based on the commits. Please read the guide through if you aren't familiar with it already.
Only fix: and feat: will be presented in the changelog.
Note that fix: and feat: are for actual code changes (that might affect logic).
For typo or document changes, use docs: or chore: instead:
->fix: typodocs: fix typo
If you don't know how to send a Pull Request, the GitHub guide is recommended reading.
When sending a pull request, make sure your PR's title also follows the Commit Convention.
If your PR fixes or resolves an existing issue, please add the following line in your PR description (replace 123 with a real issue number):
fix #123This will let GitHub know the issues are linked, and automatically close them once the PR gets merged. Learn more at the guide.
It's ok to have multiple commits in a single PR, you don't need to rebase or force push for your changes as Squash and Merge will be used to squash the commits into one commit when merging.
To enable it, run
corepack enableYou only need to do it once after Node.js is installed.
|
Corepack makes sure you are using the correct version for package manager when you run corresponding commands. Projects might have Under projects with configuration as shown on the right, corepack will install |
|
This project uses ESLint for both linting and formatting with @antfu/eslint-config.
This project uses Biome for both linting and formatting with a custom configuration.
VS Code is recommended along with the ESLint extension or the Biome extension.
With the appropriate settings, you can have auto fix and formatting when you save the code you are editing.
A minimal .vscode/settings.json file is usually included that configures the correct extension for the specific project.
Since ESLint is already configured to format the code, there is no need to duplicate the functionality with Prettier. To format the code, you can run bun run lint --fix or refer to the ESLint section for IDE Setup.
If you have Prettier installed in your editor, it's recommended to disable it when working on the project to avoid conflicts.
This project uses Turborepo for monorepo management. It's a great tool for managing multiple packages in a single repository. You can read more about it here.
This guide is heavily inspired by Anthony Fu's contribution guide.
{ "packageManager": "bun@1.1.0" }