Skip to content

Rollup your code and types for publishing

License

Notifications You must be signed in to change notification settings

reconbot/typescript-library-template

Repository files navigation

Typescript Library Template

Release

This is an example project for shipping typescript using the rules layed out by @southpolesteve in his "Shipping Typescript to NPM" talk that he gave at NYC typescript.

It gives you a library in CommonJS and ESM that's rolled up with rollup and includes rolled up types. It makes most javascript users and me very happy.

Also includes eslint, node:test, semantic-release and github actions. Now updated to include the exports directive in the package.json.

Guide

  • Set the repo secret NPM_TOKEN before your first push so that you can publish to npm.
  • Change all references in package.json and bundle-types.mjs to your own project name
  • If you want external dependencies, add them to the external section in the rollup.config.js otherwise they will be bundled in the library.