n2w
v1.4.0
Published
This project implements functionality of [angular-cli](https://github.com/angular/angular-cli) but with [open configurations](#configuration-extending).
Downloads
7
Readme
Ng2Webpack [n2w]
This project implements functionality of angular-cli but with open configurations.
An Angular 2 bundler system (cli) featuring latest Angular 2, Karma, Protractor, Jasmine, TypeScript, @types, TSLint, Codelyzer, Hot Module Replacement, and Webpack 2.
This project serves as an Angular 2 bundler system as replacement of angular-cli (due to beta stage of angular-cli) for anyone looking to get up and running with Angular 2 and TypeScript fast. Using a Webpack 2 for building our files and assisting with boilerplate. We're also using Protractor for our end-to-end story and Karma for our unit tests.
Project supports
- build process
- karma tests
- protractor tests
- lazy routes
- chunks
- npm linked packages
Quick Start
To start working with project simply do next:
- Add n2w as dependency into package.json
- Copy scripts into package.json
{
"scripts": {
"start": "n2w serve",
"build": "n2w build",
"test": "n2w test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "n2w e2e",
"lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check"
}
}
- Remove standard karma configuration and protractor configuration files
- Keep angular-cli.json, project reuses it
Supported options
Standard options
- --env or --environment - see angular-cli env options
npm run bundler -- --env=prod
- --prod or --production - for production builds
npm run bundler -- --prod
- --port - dev server port, default port is 4200
- --host - dev server host, default host is localhost
- --live-reload-port - port for live reloading, default the same as --port
- --live-reload-host - specify host for live reloading, default the same as --host
Configuration extending
- --conf - link to the module, which can extend webpack configuration
- --karma-conf - link to the module, which can extend karma configuration
- --protractor-conf - link to the module, which can extend protractor configuration
- --server-conf - link to the module, which can extend dev server configuration Note: Each module should return function to extend configuration and should return extended configuration, e.g.:
module.exports = function (config) {
//extend config here
return config
}
Examples
- develop
npm start
- build
npm run build
- test
npm test
- e2e
npm run e2e
License
MIT :)