Pure ESM monorepo using native TypeScript compiler instead of external bundlers ๐
Node.js 22.2.0 or newer is required
NPM 10.8.0 or newer is required
git clone https://github.com/negezor/typescript-monorepo-boilerplate.git
cd typescript-monorepo-boilerplate
npm install
npm run build
- In
tsconfig.json
, change thepaths
from@template
to the one you need - Change the namespace in the
name
property of thepackage.json
file of each module
- In
package.json
, changeworkspaces
and path in scriptslint:biome
&typescript:clean
- In
tsconfig.json
, change thepaths
- In
.gitignore
, change the# Build
place - Run
npm run update:tsconfig
for update tsconfig references
- Copy template structure
- Run
npm run update:tsconfig
for update tsconfig references - Run
npm install
for create new symlinks in node_modules
- Add to
package.json
dependency inpeerDependencies
- Run
npm run update:tsconfig
for update tsconfig references
npm run build
- Starts the build of all packages in monorepo
npm run watch
- Waits for changes in each package and performs build. Used for development.
npm run test
- Runs tests for packages
npm run lint
- Checks the code with the biome.js linter
npm run fmt
- Formats source code using biome.js
npm run clean
- Cleans the entire TypeScript build cache
npm run build --workspaces
- Run build in all packages. More info
npm run build --workspace=name
- Run build in specific package. More info
Because they are external dependencies, yes of course they can faster than the typescript compiler for a build. But we will still check types and it is trivially easier. It's worth noting that now we use tsx which depends on esbuild (will be replaced later with a simpler solution).
It's very simple, eslint is very slow. Usually the rules that we often need are already available in Biome.js, and those that are not are probably will implemented in the next version. It is also worth noting that eslint pulls a lot of small dependencies, while Biome.js is 1 binary file for your platform, which is much faster when installing and updating dependencies. Also it provides a formatter out of the box, we don't need to install prettier separately.
Because these are external dependencies, and node:test
is available out of the box, plus it's faster. The only thing that may be missing is simpler expect comparison, but you can put a smaller module for that separately.