Socket
Book a DemoInstallSign in
Socket

generator-node-ts

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator-node-ts

scaffolds a basic node project with typescript.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

node-ts generator

Creates a simple project structure for a node application using typescript. It installs the default node type definition files as well. You can choose to add mocha and chai for testing, via a prompt.

Installation

If you have yeoman installed, simply call (if 'name' is not present, the working folders name will be used):

npm install generator-node-ts [-g]
yo node-ts [name]

You will then be asked, if you like to add testing capabilities to your project (default is false):

Would you like to add mocha and chai (testing)? (y/N)

If you chose to add testing, you are then able to choose if you prefer to have your specs in a separate 'test' folder (next to the 'src' folder) or having the specs next to the source files in the 'src' folder.

Should tests be stored in a separate folder, instead of next to the source files?
-yes:
 <your-app>/
   src/
     .ts
   test/
     .spec.ts
-no:
 <your-app>/
   src/
     .ts
     .spec.ts
 (y/N)

npm scripts

The generator comes with the following npm scripts:

npm start

Will transpile the .ts in src folder to .js files in dist folder. And start the node application.

npm test

[Only available if you enabled testing!] This will also transpile all .ts files and will run mocha tests on all .spec.js files in the dist folder.

Generated folder structure

    root \
    • src \
    • main.module.ts
    • (main.module.spec.ts)
  • package.json
  • .gitignore
  • tsconfig.json

Keywords

yeoman-generator

FAQs

Package last updated on 31 Aug 2017

Did you know?

Socket

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