|
1 |
| -# generator-node-typescript-webpack |
| 1 | +# TypeScript NodeJS Generator |
| 2 | +[](https://travis-ci.org/ospatil/generator-node-typescript) |
| 3 | +[](http://badge.fury.io/js/generator-node-typescript) |
| 4 | + |
| 5 | +Bonjour! I'm a minimal [Yeoman](http://yeoman.io) generator for creating NodeJS packages using TypeScript. I let you quickly setup a project with latest available tools and best practices. |
| 6 | + |
| 7 | +I use: |
| 8 | + |
| 9 | +- _npm_ - as task runner. |
| 10 | +- _jest_ - as [testing and coverage framework](https://facebook.github.io/jest/) to write specs in **TypeScript** itself. You can choose to use _mocha_ or _ava_ instead. |
| 11 | + |
| 12 | +You want to know if you can change any of these? Of course, why not? It is your package after all. I simply get down to business of generating, no questions asked and then quiety get out of the way! |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +Install `generator-node-typescript` globally. |
| 17 | + |
| 18 | +```sh |
| 19 | +$npm i -g generator-node-typescript |
| 20 | +``` |
| 21 | + |
| 22 | +Create a new directory and `cd` into it. |
| 23 | + |
| 24 | +```sh |
| 25 | +$mkdir my-new-project && cd $_ |
| 26 | + |
| 27 | +``` |
| 28 | + |
| 29 | +Run the generator. |
| 30 | + |
| 31 | +```sh |
| 32 | +$yo node-typescript |
| 33 | +``` |
| 34 | + |
| 35 | +You can choose to use _mocha_ as your test framework using command - `$yo node-typescript --mocha` |
| 36 | + |
| 37 | +You can choose to use _ava_ as your test framework using command - `$yo node-typescript --ava` |
| 38 | + |
| 39 | +Generate a new class and test file. |
| 40 | + |
| 41 | +```sh |
| 42 | +$yo node-typescript:classlib MyNewClass [--mocha | --ava] |
| 43 | +``` |
| 44 | + |
| 45 | +## Highlights of the latest release |
| 46 | + |
| 47 | +- I use latest version of **TypeScript**. |
| 48 | +- I use [yarn](https://yarnpkg.com) in place of npm if it's available. |
| 49 | +- I use _jest_ which is a "batteries-included" testing framework with coverage built-in (optionally _mocha_ or _ava_). **You write tests in TypeScript itself**. |
| 50 | +- I use _prettier_ integrated with _tslint_ to provide no-fuss code formatting and linting. |
| 51 | +- I need **no global dependencies**. Every dependency such as _TypeScript_ and _tslint_ is installed as local dev dependency allowing you to freely use different versions of these for different packages. |
| 52 | + |
| 53 | + ### Integration with VS Code |
| 54 | +- I configure `build`, `clean`, `lint`, `coverage`, `format` and `test` tasks that you can run using `Run Task` option. |
| 55 | +- You can directly run currently open source file using task `Run current file`. I use [ts-node](https://github.com/TypeStrong/ts-node) to provide this functionality. |
| 56 | +- You can debug currently open source file using `Debug file` launch configuration. You can also debug currently open test file using `Debug test` launch configuration without the need of compiling it first. Here is the preview - |
| 57 | + |
| 58 | +  |
| 59 | + |
| 60 | +## License |
| 61 | + |
| 62 | +MIT |
0 commit comments