Project Configuration
This page documents the development toolchain and configuration files located in the root module of the ms repository. It covers the build system, testing framework, linting and formatting tools, and the scripts that orchestrate them. Contributors should read this page alongside Contributing for the full development workflow.
Repository Layout
The root module ("") contains only configuration files. All library source code lives in the src module. The three configuration files at the project root are:
| File | Purpose |
|---|---|
jest.config.ts | Jest test runner configuration |
lint-staged.config.ts | Lint-staged configuration for pre-commit hooks |
tsdown.config.ts | Build bundler configuration |
Build Tool
The library uses tsdown as its build tool. The configuration file tsdown.config.ts (located at the project root) defines how the TypeScript source in src is compiled and bundled into distributable output. The build process is triggered by the build script in package.json:
pnpm buildThis command produces the compiled package that consumers install from npm. The build is also run automatically in the release workflow (.github/workflows/release.yml) before publishing.
Testing
Test Runner
The project uses Jest as its test runner, configured in jest.config.ts at the project root. There are two test suites defined in package.json:
| Script | Command | Purpose |
|---|---|---|
test:nodejs | pnpm test:nodejs | Runs tests in a Node.js environment |
test:edge | pnpm test:edge | Runs tests in an Edge Runtime environment |
Running Tests
To run all tests locally:
pnpm test:nodejs
pnpm test:edgeThe CI workflow .github/workflows/test.yml runs both test suites across three Node.js versions (20, 22, 24) on every push to main and on pull requests targeting main. The matrix strategy ensures compatibility across supported Node.js releases .github/workflows/test.yml:13-16.
Linting and Formatting
Linting
The project uses a linter configured through the lint script in package.json. Run it with:
pnpm lintThe CI quality workflow (.github/workflows/quality.yml) runs linting as one of its matrix tasks on every push to main and on pull requests .github/workflows/quality.yml:11-13.
Formatting
Code formatting is managed through a formatter configured via the format script:
pnpm formatThe quality workflow also runs formatting checks as a separate matrix task .github/workflows/quality.yml:11-13.
Pre-commit Hooks
The project uses lint-staged (configured in lint-staged.config.ts) to run linters and formatters on staged files before commits. The precommit script in package.json triggers lint-staged:
pnpm precommitThis ensures that only properly formatted and lint-free code enters the repository. The prepare script in package.json likely sets up the git hooks automatically on pnpm install.
Type Checking
TypeScript type checking is performed via the typecheck script:
pnpm typecheckThis script runs the TypeScript compiler in type-checking mode (without emitting output) to verify that the codebase has no type errors. The quality workflow includes typecheck as a matrix task .github/workflows/quality.yml:11-13.
Additional Quality Checks
The project also runs attw (Are The Types Wrong) as part of the quality workflow .github/workflows/quality.yml:11-13. This tool validates that the package's TypeScript type definitions are correctly exported and consumable by consumers. Run it with:
pnpm attwCI Workflows
Three GitHub Actions workflows automate the development pipeline:
Quality Workflow (.github/workflows/quality.yml)
- Triggered on push to
mainand pull requests targetingmain - Runs four tasks in parallel:
format,lint,typecheck,attw - Uses Node.js 24 and pnpm
.github/workflows/quality.yml:1-29
Test Workflow (.github/workflows/test.yml)
- Triggered on push to
mainand pull requests targetingmain - Runs
test:nodejsandtest:edgeacross Node.js 20, 22, and 24 - Uses a matrix strategy with
fail-fast: falseto report all failures.github/workflows/test.yml:1-33
Release Workflow (.github/workflows/release.yml)
- Triggered only on push to
main - Builds the package and publishes a nightly canary release to npm under the
nightlytag - Uses npm provenance for supply chain security (
NPM_CONFIG_PROVENANCE: 'true').github/workflows/release.yml:1-43
Development Workflow Summary
For contributors, the typical development cycle is:
- Install dependencies:
pnpm install - Make changes in the
srcmodule - Run type checking:
pnpm typecheck - Run linting:
pnpm lint - Run formatting:
pnpm format - Run tests:
pnpm test:nodejsandpnpm test:edge - Build the package:
pnpm build - Commit changes (pre-commit hooks run automatically via lint-staged)
All of these checks are enforced in CI on pull requests, so running them locally before pushing saves iteration time.