Contributions are always welcome, no matter how large or small!
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.
To setup the project, run:
pnpm install
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.
To build the projects and incrementally build files on change, run:
pnpm build --watch
pnpm eslint .
- You can run eslint's auto-fix via:
pnpm eslint --fix .
Tests for all packages via vitest
:
pnpm test
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
You may also run tests of multiple projects together.
pnpm run test --project 'webpack/*'
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 usedescribe.only
or test.only
to select suites and tests.
- test('run with webpack-dev-server', async () => {
+ test.only('run with webpack-dev-server', async () => {
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
To test the code coverage, use --coverage
:
pnpm run test --coverage
Each package should have its own API reference documentation. It is generated by the comments of the public APIs using API Extractor.
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.
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.