generator-ts-np v3.3.0
generator-ts-np
Yet another yeoman generator for building npm packages with TypeScript.
TSNP stands for TypeScript Node Package ๐ฆ.

Install
Requires Node >=8.
Install yeoman first
npm i -g yoThen install this generator from npm,
npm i -g generator-ts-npFrom Github Package Registry. (Guide).
Usage
$ mkdir my-new-package # new dir
$ cd my-new-pacakge # go to the package dir
$ yo ts-np # use yeomanWhy
- No global dependencies.
- Written in TypeScript and when publishing, definition(
.d.ts) will also ship with this package. - Prettier and Eslint.
- Support for Github Package Registry and NPM
- Tests uses Jest (tests are also written in TypeScript)
- Pre-publish hook for build (so you never miss it)
- Automated build and deployments (using Github Actions) (eg: scope-prefixer package)
- Lint rules adopted from Google (which means higher coding standard)
- Publishes only the required files (less bundle size)
Directory Structure
$ yo ts-np command will ask you a few questions and generate the below structure.
- You write your typescript files in
/src. - Write their tests in
/tests /srccompiling creates/distdirectory which is used for publishing
The generator produces following files.
.
โโโ .eslintignore
โโโ .eslintrc.json
โโโ .github
โย ย โโโ workflows
โย ย โโโ Build.yml_disabled
โย ย โโโ Deploy.yml_disabled
โโโ .gitignore
โโโ .npmignore
โโโ .prettierrc
โโโ .yo-rc.json
โโโ LICENSE
โโโ README.md
โโโ gulpfile.js
โโโ jest.config.json
โโโ package.json
โโโ src
โย ย โโโ index.ts
โโโ tests
โย ย โโโ index.spec.ts
โโโ tsconfig.json
โโโ tsconfig.spec.jsonHandy npm scripts
npm test: ๐ compiles typescript (npm run build) and run tests.npm run build: compiles src and tests files.npm run lint: runs eslint and prettier checks.
See other scripts and their uses
Automated Build ๐งช and Deployments โ
- Continues integration: run tests when code pushed.
- Continues deployment: run tests and publish the package when a git release is published.
By default, this feature is disabled for convenience. You can enable it in a few steps ๐ผ.
Licence
MIT ยฉ Vajahath Ahmed
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago