This is a nodejs command line util that will setup the basic structure for my (and your) next typescript library.
Simply run npx create-typescript-library in an empty directory where you want to create your typescript library. If you are using yarn, run yarn exec create-typescript-library.
create-typescript-library will run an interactive prompt to gather information from you, and generate a basic working typescript library for you. Some examples include:
- Use typescript compiler (
tsc) to compile your library:- to commonjs code to consume
- to es2015 code to consume
- Use webpack version 4 to bundle your library:
- to UMD module for others
- Setup
npm/yarnscripts for easy builddevto compile or bundle codedev:watchto watch the file changes (by nodemon) and run thedevscriptbuildto generate minimized code for publishingtestto run test against bundle results, library and demo
- Refer to tslint config for tslint configuration details
- Refer to nodemon config for nodemon configuration sample
- Refer to webpack config for webpack configuration details
Inspired by the awesome blog post Compiling and bundling TypeScript libraries with Webpack by Marco Botto