3.3.0 โ€ข Published 5 years ago

generator-ts-np v3.3.0

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

generator-ts-np

Yet another yeoman generator for building npm packages with TypeScript.

TSNP stands for TypeScript Node Package ๐Ÿ“ฆ.

npm.io Greenkeeper badge

npm.io

Install

Requires Node >=8.

Install yeoman first

npm i -g yo

Then install this generator from npm,

npm i -g generator-ts-np

From Github Package Registry. (Guide).

Usage

$ mkdir my-new-package # new dir
$ cd my-new-pacakge # go to the package dir
$ yo ts-np # use yeoman

Why

  • 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
  • /src compiling creates /dist directory 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.json

Handy 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

3.3.0

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0-rc.1

5 years ago

3.0.0-beta.7

6 years ago

3.0.0-beta.5

6 years ago

3.0.0-beta.6

6 years ago

2.1.2

6 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago