Skip to content
/ npm-lib-template Public template

Template repo for creating CommonJS and ESM nodejs npm packages

License

Notifications You must be signed in to change notification settings

edusig/npm-lib-template

Repository files navigation

NPM Library Template

tests badge release badge

This repo is a template for creating CommonJS and ESM packages using Typescript to publish on NPM.

It is intended to be used for Node.js packages

  • It uses tsc to transpile to CommonJS and rollup to build the ESM packages.
  • Has a default MIT license
  • Eslint rules from @edusig/eslint-config
  • Prettier and EditorConfig for code formatting
  • Jest for testing (with ts-jest)
  • Github Actions with:
    • Release: using release-please that automates CHANGELOG generation
    • Testing: as a default it checks the linter and runs test script

Before Publish Checklist

  • Update the license
  • Update rollup.config.js external packages
  • Update src/external.ts to include all the lib files
  • Update src/index.ts line 4 to export a named module (optional)
  • Add Repo Secrets
    • Add GITHUB_TOKEN (release please uses this to open a PR with new changes)
    • Add NPM_TOKEN (release please uses this to publish a new package to NPM)
  • Update package.json
    • Package name
    • Package version
    • Homepage
    • Repository
    • Bugs url
    • Author
    • License
    • Contributors