This is a template repository for Node.js libraries. It has been configured with:
- vite - bundling
- vitest - testing
- typescript - typing
- eslint - linting
- prettier - formatting
- husky - pre-commit hooks
- lint-staged - pre-commit checks
- github actions - deploying
Please read the docs for each for any customizations you need.
I intentionally did not include anything for CSS, or a library such as Vue or React. There are official plugins for most of that, and anything beyond the basics there is, for example, Awesome Vite.js.
Click Use this template → Create new repository and follow the prompts. Then clone the new repository to your computer.
Locally, edit package.json
and replace the name
with your own package name. This can either include a scope, e.g. @scope/package-name
, or omit it, e.g. package-name
. Commit the changes and push the commit. It's usually safer to include a scope to ensure the package name is not taken.
In your new repository on GitHub, click Settings → Secrets and variables → Actions. Here, add new secrets for:
GIT_NAME
- the name Git should use when bumping the version number. I typically set it to "Publish Bot"GIT_EMAIL
- the email Git should use, typically the same email as your GitHub account.NPM_TOKEN
- the npm access token to publish the library. You get this from your npmjs.com account.
Update this file with some documentation for your library.
The default license is the MIT license, but feel free to adjust to your needs. At minimum update the year, if needed, and set <copyright holders>
to your name or organization.
The typical. Create a feature branch, commit some changes, make a PR, have checks pass, merge.
Create a new release with a semver tag. Use the auto-generate feature to have all PR titles listed.