A Yeoman generator for scaffolding an app using angular2 and webpack
This generator was inspired by this amazing repo: https://github.com/AngularClass/angular2-webpack-starter
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 betweenweb
,fuse
, orionic2
.
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
dist
folder)dist
folder)Test
Docs
typedoc.json
config file)Note:
All fuse & ionic npm commands accept an optionalOPTIONS=(...)
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
uno clean
to clean up generated resources in your fuse target)ios
or android
), if omitted the command will do both of the alternatives in this order.ios
or android
), if omitted the command will do both of the alternatives in this order.Ionic Commands
rm
or add
) and platform (ios
or android
), if either is omitted the command will do both of the alternatives in this order.rm
or add
), if it is omitted the command will attempt to remove and then add the plugin.PLUGIN
can either be a single plugin name or a space-separated bash/zsh list, i.e. enclosed in parens, (...)
, or in quotation marks "..."
ios
or android
), if omitted the command will do both of the alternatives in this order.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.
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
npm run webpack:server
# or
npm run browsersync
Visit your browser at http://localhost:5000
npm run test # lint + unit tests
npm run mocha # to run without linting first
npm run mocha.watch # to run in watch mode
MIT