Skip to content

Latest commit

 

History

History
162 lines (102 loc) · 3.74 KB

CONTRIBUTING.md

File metadata and controls

162 lines (102 loc) · 3.74 KB

Contributing

Contributions are always welcome, no matter how large or small!

Developing

Node: Check that Node is installed with version >= 22. You can check this with node -v.

pnpm: Make sure that pnpm is available. You can use corepack enable to automatically setup pnpm.

Setup

To setup the project, run:

pnpm install

Building

To build the projects, run:

pnpm build # An alias for `tsc --build`

The project is managed using TypeScript's Project Reference.

So running tsc --build at the repository root can build all projects.

Also, the repository can also be built with turborepo. Running:

pnpm turbo build

will built all the projects and it's dependencies recursively with cache enabled.

Build with Watching

To build the projects and incrementally build files on change, run:

pnpm build --watch

Running linting/tests

Lint

pnpm eslint .
  • You can run eslint's auto-fix via:
pnpm eslint --fix .

Tests for all packages via vitest:

pnpm test

Run tests for a specific package

When working on an issue, you will most likely want to focus on a particular packages. Using --project will only run tests for that specific package.

pnpm run test --project websocket

Run tests for a group of packages

You may also run tests of multiple projects together.

pnpm run test --project 'webpack/*'

Run a subset of tests

Pass the name of test suite to pnpm test to run a subset of tests by name:

pnpm run test server
More options You can also use describe.only or test.only to select suites and tests.
-  test('run with webpack-dev-server', async () => {
+  test.only('run with webpack-dev-server', async () => {

Run test with Node debugger

Quick way to debug tests in VS Code is via JavaScript Debug Terminal. Open a new JavaScript Debug Terminal and run pnpm vitest. This works with any code ran in Node, so will work with most JS testing frameworks.

See Debugging Vitest for more details.

You can combine debug with --project or .only to debug a subset of tests. If you plan to stay long in the debugger (which you'll likely do!), you may increase the test timeout by setting --test-timeout.

To overwrite any test fixtures when fixing a bug or anything, add the --update

pnpm run test --project websocket --update

Test coverage

To test the code coverage, use --coverage:

pnpm run test --coverage

Writing API References

Each package should have its own API reference documentation. It is generated by the comments of the public APIs using API Extractor.

Update API References

To update the API reference, just run:

turbo api-extractor -- --local

This will update the <projectFolder>/etc which describe all the public APIs. You should always commit the change to git.

Submitting

Generating changesets

We use 🦋 Changesets to manage versioning and changelogs. Usually, you need to generate changeset(s) for your changes.

Just run:

pnpm changeset

Then select the correct packages with desired versions. See Adding a changeset for details.

Then commit the generated .md file in .changeset/ and submit a PR on GitHub.