mcfly-io / generator-mcfly-ng2

A yeoman generator for scaffolding an app using angular2 and webpack
MIT License
36 stars 2 forks source link

Join the chat

NPM version Downloads
Build Status Coverage percentage
Dependency Status Dependency Dev Status

NPM

generator-mcfly-ng2

A Yeoman generator for scaffolding an app using angular2 and webpack

Credits

This generator was inspired by this amazing repo: https://github.com/AngularClass/angular2-webpack-starter

Installation

First, install Yeoman and generator-mcfly-ng2 using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-mcfly-ng2

Then generate your new project:

yo mcfly-ng2 [project-name]

You then have access to the following sub generators:

NOTE:
When scaffolding a new target, the generator will ask you to choose between web, fuse, or ionic2.
web is a normal web project
fuse is a fusetools mobile app
ionic2 is an Ionic 2 mobile app (cordova)

You have access to the following npm scripts:

Clean & Build

Test

Docs

Note:
All fuse & ionic npm commands accept an optional OPTIONS=(...) variable to pass additional options to those clis. OPTIONS can either be a single plugin name or a space-separated bash/zsh list, i.e. enclosed in parens, (...), or in quotation marks "..."*

Fuse Commands

Ionic Commands

Note:
Normally, the webpack ChangeMode plugin (plugins/ChangeModePlugin.js) should make sure that the ionic hooks in the dist folder are executable. If however you get errors like these:Running command: <path_to_hook_dir> <path_to_hook.js> <path_to_ionic_target_dist> Error: spawn EACCES use npm run ionic:hooks:chmodx to fix the hooks.

Distribution

Note that the code is distributed to the dist folder
You can pass a different TARGET or MODE using the following command:

[TARGET=newtarget MODE=dev] npm run build

Default TARGET is app, possible values will depends if you have scaffolded other targets
Default MODE is dev, can be either prod or dev

The same apply to the webpack:server task or browsersync task
npm run webpack:server: compile and open a the webpack reload browser
You can pass a different TARGET or MODE using the following command:

[TARGET=newtarget MODE=dev] npm run webpack:server

Launching

npm run webpack:server
# or
npm run browsersync

Visit your browser at http://localhost:5000

Testing

npm run test # lint + unit tests
npm run mocha # to run without linting first
npm run mocha.watch # to run in watch mode

License

MIT