This template is used for our internal packages. Feel free to use it for your own projects, but please note that some of the settings may not be relevant to your work.
This repository provides a starting point for TypeScript-based npm packages. It includes:
- TypeScript configuration for building and type-checking
- Pre-configured ESLint and Prettier for code quality and formatting
- Jest for unit testing
- Example source and test files
- Coverage reporting
- Modern package management with pnpm
Clone this repository and install dependencies using pnpm:
pnpm install-
Source code lives in the
src/directory. -
Tests are in the
tests/directory. -
To build the package:
pnpm run build
-
To run tests:
pnpm test -
To check code formatting and linting:
pnpm lint pnpm format
This monorepo uses the Changeset Autopilot GitHub Action for fully automated, dependency-aware versioning and publishing. It:
- Detects conventional commits and generates changesets automatically
- Handles branch-based release channels (main, next, beta, etc.)
- Versions and publishes only changed packages to npm
- Manages pre-releases and dist-tags
- Runs entirely in CI for maximum reliability
How it works:
- On every push to a release branch, the action analyzes commits, generates changesets, versions packages, and publishes to npm.
- No manual steps are needed—just follow the conventional commit format and push to the correct branch.
- See the Changeset Autopilot documentation for setup and configuration details.
Manual releases are possible if needed (for example, for hotfixes or if CI is unavailable):
-
Ensure you have an
NPM_TOKENwith publish rights set in your environment (for CI/CD, set as a secret). -
Run the following commands from the root:
pnpm changeset pnpm changeset version pnpm changeset publish
This will version and publish only those workspace packages with relevant changes.
- Each package is versioned independently.
- Git tags are created in the format
<package-name>-<version>. - See
.changeset/config.jsonfor configuration details.
For more, see the Changesets documentation.
To get started quickly, you can follow these steps:
- Add your own code and tests to the
srcandtestdirectories. - Update the
README.mdwith usage instructions and examples. - Update the
package.jsonwith your package information. - Run
pnpm installto install dependencies. - Run
pnpm testto run tests. - Run
pnpm buildto build the package. - Run
pnpm lintto lint the code. - Run
pnpm formatto format the code. - Run
pnpm releaseto release a new version.