This project is written in Typescript. It uses:
- yarn for package management
- swc to compile Typescript to Javascript,
- tsc to
check type correctness and generate type declaration (
.d.ts
) files, - prettier for auto-formatting
- eslint for static code analysis
We use conditional exports to provide both ESM and CJS builds of the library, in addition to type declarations.
All of the source code lives in src/
.
You must have Node.js v16.9 or higher installed on your development machine, as
well as Yarn v1. If you don't have Yarn installed, you can do so by running
corepack enable
.
Run yarn
or yarn install
to install dependencies locally.
You can check type correctness, eslint validation, and formatting with
yarn check
. You can auto-fix all automatically fixable issues with yarn fix
.
And you can build output files with yarn build
.
You can run tests with yarn test
. If you want to run tests in "watch" mode,
use yarn test -w
. See the Jest CLI docs for more
information.
We use yarn's "deferred versioning" release flow, documented
here. For
any change that affects source code files, developers will be asked at
git push
time to use yarn version check -i
to specify what kind of change
(patch
, minor
, or major
) is contained within the release. This version
type will be documented in the form of a new YAML file added to the
.yarn/versions
directory, which can be reviewed during code review.
Maintainers can then later use yarn version apply --all
to aggregate the
proposed version bumps and apply them to the package.json
file.