Project template for Node libraries. Features:
- ESM Module
- Types: TypeScript
- Tests: Vitest
- Linting: oxlint
- Formatting: dprint
- Publishing: Dripip
- Continuous Integration: GitHub Actions
- Dependency Management: Renovate
- Community: Issue Templates
Make sure you have corepack enabled:
$ corepack enable
The following will get you a ready to go new repository on GitHub based on this one.
-
Run:
gh repo create foobar --template jasonkuhrt/template-typescript-lib --clone --public && \ cd foobar && \ pnpm install && \ pnpm bootstrap -
Setup a repo secret called
NPM_TOKENcontaining an npm token for CI package publishing.
The following will get you a ready to go new repository on GitHub based on this one.
-
Run:
gh repo clone jasonkuhrt/template-typescript-lib <directory> && \ cd <directory> && \ pnpm install && \ pnpm bootstrap -
Setup a repo secret called
NPM_TOKENcontaining an npm token for CI package publishing.
- TypeScript
- oxlint
- Vitest
- Dripip
- Simple succinct friendly low-barrier issue templates
- dprint
- npm scripts for development lifecycle
- CI with GitHub Actions
- Renovate
- PnPM
- Zed Settings
- Readme Table of Contents
- Useful TypeScript Libraries
TypeScript for Type Safety & Productivity
-
Optimal settings for type safety via
@tsconfig/node22and@tsconfig/strictest -
.tsbuildinfocache setup, output discretely intonode_modules/.cache -
Base
tsconfig.jsonshared acrosstestsandsrc. -
Optimal output setup for your users
declarationso your users can power their intellisense with your packages typings.declarationMapenabled to make your published source code be navigated to when your users use "go to definition".sourceMapenabled to allow your users' tools to base off the source for e.g. stack traces instead of the less informative derived built JS.- Publish
srcwith build files so that jump-to-definition tools work optimally for users.
-
tsxfor running TypeScript scripts/modules.
oxlint For Linting
- Rust-based, extremely fast (~100x faster than ESLint)
- Zero config needed
- Setup as a CI check for PRs
Vitest for Testing
Just Works :)
Dripip for Releasing
- Emojis
โ๏ธ - Feature / bug / docs / something-else
- Config to display discussions link right in new issue type listing UI
dprint for code formatting
- Setup as a CI check for PRs
- npm script
cleanto remove cache and build filesbuildthat runscleanbeforehandprepublishOnlythat runsbuildbeforehandformatto rundprintover whole codebaselintto runoxlintover whole codebase
- Separate trunk and pull-request (PR) workflows.
- Dependency install cache enabled.
- On PR:
- Formatting Check
- Lint Check
- Type Check
- Tests across matrix of mac/linux/windows for Node 22
- On trunk:
- Tests across matrix of mac/linux/windows for Node 22
- Automated canary release
Renovate configuration
- JSON Schema setup for optimal intellisense
- Group all non-major devDependency updates into single PR (which "chore" conventional commit type)
- Group all major devDependency updates into single PR (with "chore" conventional commit type)
- Group all non-major dependency updates into single PR (with "deps" conventional commit type)
- Each major dependency update in own PR (with "deps" conventional commit type)
PnPM for package management
- Using Corepack. This means the PnPM specified in
package.jsonwill be used. And note this is a PnPM binary shipped with Node now. In a future version of Node you will not need to even opt-in into Corepack. Make sure you've donecorepack enableat least once.
This template does not include a .zed directory. Instead, it assumes you configure tsgo (the native Go-based TypeScript language server) in your global Zed settings (~/.config/zed/settings.json):
{
"languages": {
"TypeScript": {
"language_servers": ["tsgo", "!vtsls", "oxc"]
},
"TSX": {
"language_servers": ["tsgo", "!vtsls", "oxc"]
}
}
}- Using
markdown-toc
Here are some TypeScript libraries you might want to use for your new project: