n2w

1.4.0 • Public • Published

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

  1. build process
  2. karma tests
  3. protractor tests
  4. lazy routes
  5. chunks
  6. npm linked packages

Quick Start

To start working with project simply do next:

  1. Add n2w as dependency into package.json
  2. 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"
  }
}
  1. Remove standard karma configuration and protractor configuration files
  2. 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

  1. develop
npm start
  1. build
npm run build
  1. test
npm test
  1. e2e
npm run e2e

License

MIT :)

Dependents (0)

Package Sidebar

Install

npm i n2w

Weekly Downloads

4

Version

1.4.0

License

MIT

Last publish

Collaborators

  • serhiisol