npm-module-template
What
- bun build - with types the best I could (see build notes below)
- eslint with prettier formatting
-
fixpack to normalize package.json changes along with
npm pkg fix
- husky pre commit hooks
- changesets change and release workflow
- renovate dependency management
Installation
Click the Use this template button to create a new repository
(or run bun create Enalmada/npm-module-template <your-new-library-name>
)
To switch existing repository
git remote add template https://github.com/Enalmada/npm-module-template
git fetch template
git merge template/main --allow-unrelated-histories
- resolve conflicts and merge
Github settings
- add NPM_TOKEN with access to deploy to npm to environment variables
- Actions > General > Workflow Permissions
- Read and Write (to allow changesets to create changelog, and release)
- Allow github actions to create and approve PR
Workflow
- install dependencies
bun install
- lint files
bun lint:fix
- run tests
bun run test
(notbun test
as we are not using native tests) - run build
bun run build
(notbun build
as we are using build script) - create changeset before PR
changeset
and choose appropriate semver and changelog
TODO
- [ ] tests framework to bun (when bun supports mocking modules)
Alternative Tech
inspiration
Notes
Build
- Using latest module and target settings for current LTS
- using tsc for types until bun support comes around
Contribute
Using changesets so please remember to run "changeset" with any PR that might be interesting to people on an older template. Although this isn't being deployed as a module, I would like to call out things worth keeping in sync.