A bleeding edge, prod ready starter template for creating and publishing Node.js libraries to npm.
Features Include:
- MIT License
- Configured for pure ESM only output
- Easy out-of-the box development with watch and test mode with only TypeScript
- Editorconfig for collaboration
- Testing with node's native test runner - pre-setup for typescript ESM
- CI runs on push to main in github actions
- Linting with xo (space configuration)
- Formatting with prettier and xo
- Markdown linting and formatting with prettier
- Package.json linting and formatting with prettier-plugin-package-json
- np for publishing to npm
This is a github template and is best used by using the github UI to start a new project.
Once you've cloned the template for a new repository, the first thing you want to do is to make sure all the deps are up to date!
- Run
npm install
to get the immediately needed deps - run
npm run update
to have npm-check-updates run an interactive program to update all the other deps. - run
npm run test
to ensure updates haven't broken anything themselves (this typically shouldn't happen).
This starter-template is already set up to run typescript code out of the box with tsc
and node --watch
in parallel.
npm run dev
Will compile the src/index.ts
in memory and execute it.
npm run build
will build the project to the dist
directory (which is already gitignored).
npm run dev
will build the project with tsc --watch
execute the script with the new nodejs watch
flag.
npm run test
will build the project and run the tests once
npm run test:coverage
will build the project once and run the tests once with node experimental test coverage flags.
npm run test:watch
will build the project in watch mode, and re-run the tests anytime something changes.
npm run update
will use ncu -i
to update all dependencies to their latest versions, interactively
To encourage best practices for publishing an open source package on npm, np is installed by default.
npm run release