Socket
Socket
Sign inDemoInstall

generator-ts-np

Package Overview
Dependencies
348
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    generator-ts-np

Yeoman Generator For Building Node Packages With Typescript


Version published
Weekly downloads
1
Maintainers
1
Install size
26.5 MB
Created
Weekly downloads
 

Readme

Source

generator-ts-np

Yet another yeoman generator for building npm packages with TypeScript.

TSNP stands for TypeScript Node Package 📦.

Greenkeeper badge

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

Keywords

FAQs

Last updated on 29 Mar 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc