Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

old-skull/ts-lib-starter-kit

Repository files navigation

ts-lib-starter-kit

Example of library/package based on Typescript.

How does it works?

All files from src folder are imported into the root index.ts. When you runs build script Babel will transpile your code using babel.config and tsc will generate .d.ts types. All this will be moved to the dist folder. Now you can publish your library.

How to use it?

  1. Add your files to the src folder.
  2. Run build script from package.json or via command line with your package manager: npm run build yarn build pnpm build

Inspect compiled types declarations in the dist folder.

How to publish to the registry?

I added files for npm registry. You can safely delete it or replace.

  1. Login:
npm login
  1. Publish:
npm publish --access public

NOTE: Sometimes you need to provide login token or something similar. Remember to delete it from your project.

Scripts

Build

npm run build

Test

npm test

or using watch mode

npm run test:watch

Collect coverage

npm run test:cov

Lint

npm run lint

Format

npm run format