generator-angular2-module v1.7.1
generator-angular2-module
Simply scaffold your module with this yeoman generator and start writing code without having to setup any tedious boilerplate tooling.
Everything is pre-configured, from a local development server with unit tests, through to publishing your module to npm and a demo to github pages. Hopefully the angular-cli project will one day make this generator obsolete, however currently the angular-cli is geared towards creating a full web-app rather than just a single re-usable module.
Installation
First, install Yeoman and generator-angular2-module using npm (we assume you have pre-installed node.js).
npm install -g yo generator-angular2-moduleThen create your new repo on github, check it out and from the root of the repo folder run:
yo angular2-moduleTo generate the demo:
git branch gh-pages
git push origin gh-pages
npm run gh-pagesFolder structure
srcshould hold your modules components / services / pipes etc. Organised them however you see fit!testcontains all your modules test files. Simply suffix the filenames with.spec.tsand they will be auto-included and randemocontains a demo app that shows off your module to users. It is also handy during development as unit tests will only get you so far when developing a UI component
npm scripts
Once you've scaffolded out your module everything is then controlled by npm scripts:
npm startto serve the demo page of your module with live-reload as you develop. Unit tests are also run in the background.npm testwill run your unit tests once andnpm run test:watchwill run them continuouslynpm run commitwill run the git commit wizard when you're ready to commit a changenpm run releasewill publish a new release. First make sure you've created thegh-pagesbranch and pushed it to github. Next change the version in package.json to the new version you would like to release, but don't commit it yet. Now runnpm run releaseand the new version will be built and published to npm, as well as the demo and documentation generated and pushed to thegh-pagesbranch of your project.
Tools used
- Build your module in typescript with webpack
- Run your tests with karma
- Auto-lint your module with tslint
- Automatic documentation generated with typedoc
- Publish your module to npm
License
MIT © Matt Lewis
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago