Starter kit with zero-config for building a library in TypeScript, featuring RollupJS, Jest, Prettier, TSLint, Semantic Release, and more!
Switch branches/tags
Nothing to show
Clone or download
greenkeeper[bot] and alexjoverm Update rollup to the latest version ๐Ÿš€ (#217)
## Version **0.59.2** of [rollup]( was just published.

    <th align=left>
    <th align=left>
      Current Version
    <th align=left>

The version **0.59.2** is **not covered** by your **current version range**.

If you donโ€™t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

It might be worth looking into these changes and trying to get this project onto the latest version of rollup.

If you have a solid test suite and good coverage, a passing build is a strong indicator that you can take advantage of these changes directly by merging the proposed change into your project. If the build fails or you donโ€™t have such unconditional trust in your tests, this branch is a great starting point for you to work on the update.


<p>The new version differs by 79 commits.</p>
<li><a href=""><code>c464db8</code></a> <code>0.59.2</code></li>
<li><a href=""><code>b97f0c2</code></a> <code>Update changelog</code></li>
<li><a href=""><code>4783eef</code></a> <code>Reassign for-in loop variable; resolves #2199</code></li>
<li><a href=""><code>6fdc744</code></a> <code>0.59.1</code></li>
<li><a href=""><code>d0de715</code></a> <code>Merge branch 'missing-space'</code></li>
<li><a href=""><code>a8a9800</code></a> <code>Merge branch 'circular-get-value'</code></li>
<li><a href=""><code>4e8435c</code></a> <code>Resolve #2191: Add spaces after return and yield if necessary</code></li>
<li><a href=""><code>e69fbf2</code></a> <code>Add circularity prevention to getLiteralValueAtPath</code></li>
<li><a href=""><code>6065388</code></a> <code>Fix code style</code></li>
<li><a href=""><code>8840dc2</code></a> <code>0.59.0</code></li>
<li><a href=""><code>652be15</code></a> <code>Add release date</code></li>
<li><a href=""><code>4fbdd1d</code></a> <code>Merge branch 'chunk-export-mode-fix'</code></li>
<li><a href=""><code>32913d0</code></a> <code>early exportMode detection, remove default indirection</code></li>
<li><a href=""><code>c084d4a</code></a> <code>handle namedExportsMode switch on entrypoint dependencies</code></li>
<li><a href=""><code>4b0b32b</code></a> <code>add failing test for default import exportMode check</code></li>
<p>There are 79 commits in total.</p>
<p>See the <a href="">full diff</a></p>

  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions]( If those donโ€™t help, you can always [ask the humans behind Greenkeeper](


Your [Greenkeeper]( bot ๐ŸŒด
Latest commit 7b887bb Jul 18, 2018

TypeScript library starter

styled with prettier Greenkeeper badge Travis Coveralls Dev Dependencies Donate

A starter project that makes creating a TypeScript library extremely easy.



# Run npm install and write your library name when asked. That's all!
npm install

Start coding! package.json and entry files are already set up for you, so don't worry about linking to your main file, typings, etc. Just keep those files with the same name.


Importing library

You can import the generated bundle to use the whole library generated by this starter:

import myLib from 'mylib'

Additionally, you can import the transpiled modules from dist/lib in case you have a modular library:

import something from 'mylib/dist/lib/something'

NPM scripts

  • npm t: Run test suite
  • npm start: Run npm run build in watch mode
  • npm run test:watch: Run test suite in interactive watch mode
  • npm run test:prod: Run linting and generate coverage
  • npm run build: Generate bundles and typings, create docs
  • npm run lint: Lints code
  • npm run commit: Commit using conventional commit style (husky will tell you to use it if you haven't ๐Ÿ˜‰)

Excluding peerDependencies

On library development, one might want to set some peer dependencies, and thus remove those from the final bundle. You can see in Rollup docs how to do that.

Good news: the setup is here for you, you must only include the dependency name in external property within rollup.config.js. For example, if you want to exclude lodash, just write there external: ['lodash'].

Automatic releases

Prerequisites: you need to create/login accounts and add your project to:

Prerequisite for Windows: Semantic-release uses node-gyp so you will need to install Microsoft's windows-build-tools using this command:

npm install --global --production windows-build-tools

Setup steps

Follow the console instructions to install semantic release and run it (answer NO to "Do you want a .travis.yml file with semantic-release setup?").

Note: make sure you've setup repository.url in your package.json file

npm install -g semantic-release-cli
semantic-release-cli setup
# IMPORTANT!! Answer NO to "Do you want a `.travis.yml` file with semantic-release setup?" question. It is already prepared for you :P

From now on, you'll need to use npm run commit, which is a convenient way to create conventional commits.

Automatic releases are possible thanks to semantic release, which publishes your code automatically on github and npm, plus generates automatically a changelog. This setup is highly influenced by Kent C. Dodds course on

Git Hooks

There is already set a precommit hook for formatting your code with Prettier ๐Ÿ’…

By default, there are two disabled git hooks. They're set up when you run the npm run semantic-release-prepare script. They make sure:

This makes more sense in combination with automatic releases


Array.prototype.from, Promise, Map... is undefined?

TypeScript or Babel only provides down-emits on syntactical features (class, let, async/await...), but not on functional features (Array.prototype.find, Set, Promise...), . For that, you need Polyfills, such as core-js or babel-polyfill (which extends core-js).

For a library, core-js plays very nicely, since you can import just the polyfills you need:

import "core-js/fn/array/find"
import "core-js/fn/string/includes"
import "core-js/fn/promise"

What is npm install doing on first run?

It runs the script tools/init which sets up everything for you. In short, it:

  • Configures RollupJS for the build, which creates the bundles
  • Configures package.json (typings file, main file, etc)
  • Renames main src and test files

What if I don't want git-hooks, automatic releases or semantic-release?

Then you may want to:

  • Remove commitmsg, postinstall scripts from package.json. That will not use those git hooks to make sure you make a conventional commit
  • Remove npm run semantic-release from .travis.yml

What if I don't want to use coveralls or report my coverage?

Remove npm run report-coverage from .travis.yml


Projects using typescript-library-starter

Here are some projects that use typescript-library-starter:


Made with โค๏ธ by @alexjoverm and all these wonderful contributors (emoji key):


๐Ÿ’ป ๐Ÿ”ง

Marius Schulz


Alexander Odell


Ryan Ham



๐Ÿ’ป ๐Ÿ”ง ๐Ÿ“–

Matt Mazzola

๐Ÿ’ป ๐Ÿ”ง

Sergii Lischuk


Steve Lee


Flavio Corpa




Alex Coles


David Khourshid


Aarรณn Garcรญa Hervรกs


Jonathan Hart


Sanjiv Lobo


Stefan Aleksovski




Aaron Groome


Aaron Reisman




Andrea Gottardi


Yogendra Sharma


Rayan Salhab


This project follows the all-contributors specification. Contributions of any kind are welcome!