A template for an npm package using:
- vite
- typescript
- jest
- prettier & eslint
- controlled commits with commitizen, lint-staged, etc.
- & more!
Inspired by this post by Onur Önder
- Install packages.
- Edit the top of the package.json file to include the correct package name and description. You can find and replace for "<LIBRARY>"
- Edit the README.md
- You may need to review the
vite.config.js
depending on your library structure.
lint
: lint the code. You can also dofix
to auto-fix.test
: test with jest. Alsotest:coverage
andtest:watch
build
: bundle the codecommit
&release
: see belowpushpub
: Used afterrelease
it pushes and publishes the library.deploy
: Build the demo code (index.html) and publish to gh-pages
Code is automatically linted before being committed. I recommend installing the plugins for eslint and prettier in your code editor. You can attempt to fix linting issues with yarn fix
.
When ready to commit, please commit using yarn commit
to use commitizen for standard format commits.
When ready to release use yarn release
with the -r patch|minor|major
flag (default without the flag is patch
).
You'll then need to publish your changes separately. That can be done with yarn pushpub
.
You can deploy an updated demo to github pages using yarn deploy