Skip to content

Latest commit

 

History

History
62 lines (51 loc) · 3.28 KB

README-1x.md

File metadata and controls

62 lines (51 loc) · 3.28 KB

TypeScript NodeJS Generator

Build Status npm version

I'm a Yeoman generator that allows you to create NodeJS modules using TypeScript. I let you quickly setup a project with latest available tools and best practices. Tools and libraries I use -

  • tsc - for compiling TypeScript.
  • typings - for management of TypeScript definitions.
  • tsconfig.json - for providing compiler options.
  • tslint - for linting TypeScript source files.
  • gulp - as a build system. You can carry out above tasks through gulp.
  • Jasmine 2 - for writing tests.

You want to know if you can change any of these? Of course, why not? It is your module after all. I simply get down to business of generating, no questions asked. Once done, I get out of the way and you can do as you please!

Usage

Install generator-node-typescript, gulp-cli and typings globally.

npm install -g generator-node-typescript@1x gulp-cli typings

Create a new directory and cd into it.

mkdir my-new-project && cd $_

Run yo node-typescript.

yo node-typescript

Run gulp help for information on available tasks.

gulp help

Here is the list of tasks available out of the box -

  _build          INTERNAL TASK - Compiles all TypeScript source files
  build           Compiles all TypeScript source files and updates module references
  clean           Cleans the generated js files from lib directory
  gen-def         Generate a single .d.ts bundle containing external module declarations exported from TypeScript module files
  help            Display this help text.
  test            Runs the Jasmine test specs [build]
  tslint          Lints all TypeScript source files
  update-tsconfig Update files section in tsconfig.json using filesGlob entries
  watch           Watches ts source files and runs build on change

What's new in the latest release?

  • Use of latest version of TypeScript(^1.8).
  • Switch to typings as manager for TypeScript definitions. The TSD team has deprecated tsd in favour of typings. You can find more information about typings on Github.
  • Integration of dts-generator tool to generate a single .d.ts bundle containing external module declarations exported from TypeScript source files in the module. The package.json now declares typings field that points to the single .d.ts bundle. You can find more information about typings field on TypeScript Wiki.
  • Less global dependencies. typescript and tslint are now installed as local dev dependencies allowing you to freely use different versions of these for different modules.
  • Addition of gulp watch task that watches ts source files and runs build on change.

Additional notes

  • I provide nice integration with VS Code editor. I configure the gulp build task as the default VS Code build task.

License

MIT