repository template for Node.js & TypeScript projects
Node.js & TypeScript template#
This template provides a semi-minimal monorepo setup for Node.js + TypeScript projects.
Features#
- ESM support (ECMAScript modules)
- TypeDoc for generating API documentation
- Spindle for continuous integration
- node-modules-inspector for deep insights on dependency graph
- Uses the VoidZero-based JS toolchain
Getting started#
Create a new repository#
- Clone this repository template
- In the repository directory, remove
.gitfolder withrm -rf .git - In the repository directory, Initialize git repository with
git init .
Replace placeholders#
Using your text editor or IDE, find-and-replace the following placeholders:
@author/package: Replace this with the author's name (e.g a user or organization) and package's name._author_: Replace this with the author's name (e.g real name, GitHub username, etc)._username_: Replace this with your GitHub username._repository_: Replace this with the name of your repository._desc_: Replace this with a short description of the package.
Publishing a package#
# Enter the root directory of the package you want to publish
cd packages/pkg1
# if package is non-scoped, e.g "hello-world"
pnpm publish
# if package is scoped, e.g "@user123/hello-world"
pnpm publish --access public
Configure#
PNPM scripts#
| Command | Description |
|---|---|
pnpm run build |
Build all packages |
pnpm run docs |
Generate documentation |
pnpm run docs-watch |
Generate documentation in watch mode |
pnpm run clean |
Remove all generated files |
pnpm run test |
Run unit tests |
pnpm run test-ci |
Run unit tests in CI mode |
pnpm run test-ui |
Run unit tests in UI/browser mode |
pnpm run test-html |
View test results in browser |
pnpm run test-json |
View test results in JSON format |
pnpm run fmt |
Apply formatting fixes |
pnpm run fmt-ci |
Check for formatting issues (used for CI) |
pnpm run lint |
Check for Oxlint issues |
pnpm run fix |
Apply Oxlint fixes |
pnpm run inspect |
Run node-modules-inspector server |
Developer tools#
| Tool | File | Documentation |
|---|---|---|
| PNPM | package.json, packages/*/package.json |
docs, website |
| TypeScript | tsconfig.json, packages/*/tsconfig.json |
docs, website |
| TypeDoc | tsconfig.json (typedocOptions) |
docs, website |
| Oxfmt | .oxfmtrc.json |
docs, website |
| Oxlint | .oxlintrc.json |
docs, website |
| tsdown | packages/*/tsdown.config.ts |
docs, website |
| Vite | packages/*/vite.config.ts |
docs, website |
| Vitest | vitest.config.ts, packages/*/vite.config.ts (test) |
docs, website |
| Dependabot | .github/dependabot.yml |
docs, website |
License#
This software is licensed under the MIT license (LICENSE or https://opensource.org/license/mit/).
Contribution#
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.