1.0.2 • Published 5 years ago

create-ts-library v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

create-ts-library

Create typescript-based javascript libraries without any configuration. Simply run create-ts-library init, and it will generate a project structure for you:

project
├─ src
│  └─ index.ts
├─ test
│  └─ index.test.ts
├─ tslint.json
└─ tsconfig.json

You will also need to set the name, version & config/library properties of your package.json-file.

{
  "name": "<name>",
  "version": "<version>",
  "config": {
    "library": "<module>"
  }
}

Use create-ts-library build to build your library for distribution.

This will output multiple different consumable versions of the library into the dist folder. The consumable versions are:

  • ./lib - The compiled library with commonjs modules.
  • ./es - The compiled library with native javascript modules.
  • ./types - The type declarations for the library.
  • <name>.<version>.js - A single bundled file, containing the whole library.
  • <name>.<version>.min.js - A minified version of the bundled library.
  • <name>.<version>.d.ts - A type declaration file for the bundled library.

Commands

FlagDescription
initSet up required files.
buildRun a full build.
devBuild a development bundle.
prodBuild a production bundle.
libBuild a commonjs library.
esBuild a esnext library.
testRun tests.
watchRun in watch mode.
helpDisplay commands.
lintLint Project.

More

If you want to override the default webpack configuration, you just need to create a new file named webpack.config.ts in the project root directory.