Angular Common Module

A simple module for Angular 2, that encapsulates the complete Webpack build and just requires some basic configuration in the using Angular2 projects without hassle around with the build

Installation
npm install @holisticon/angular-common --save-dev
Or if you want to use the development version (nightly build), which maybe not stable!:
npm install @holisticon/angular-common@next --save-dev
Usage
Basic Usage
- Create an config path, e.g. etc/appConfig.js:
var path = require("path");
var sourceRoot = path.resolve(__dirname, '..', 'src', 'main', 'frontend'),
testRoot = path.resolve(__dirname, '..', 'src', 'test', 'frontend'),
distRoot = path.resolve(__dirname, '..', 'src', 'main', 'resources', 'static');
var appConfig = {
srcPath: 'src/main/frontend',
testPath: 'src/test/frontend',
entry: {
app: sourceRoot + '/scripts/app.js',
salesboard: sourceRoot + '/scripts/app.salesboard.js',
assignment: sourceRoot + '/scripts/app.assignment.js'
},
srcApp: path.resolve(sourceRoot, 'app'),
testApp: path.resolve(testRoot, 'specs'),
srcSASS: path.resolve(sourceRoot, 'scss'),
srcI18N: path.resolve(sourceRoot, 'app', 'i18n'),
srcIMG: path.resolve(sourceRoot, 'img'),
dist: distRoot
};
module.exports = appConfig;
And provide a dummy files for
process.env['APP_CONFIG'] = require("path").resolve(__dirname, 'etc', 'appConfig.js');
module.exports = require('@holisticon/angular-common').karma;
process.env['APP_CONFIG'] = require("path").resolve(__dirname, 'etc', 'appConfig.js');
module.exports = require('@holisticon/angular-common').karma_ci;
process.env['APP_CONFIG'] = require("path").resolve(__dirname, 'etc', 'appConfig.js');
module.exports = require('@holisticon/angular-common').webpack;
- Append following entries to your package.json:
...
"scripts": {
"start": "npm install && npm run watch",
"watch": "cross-env NODE_ENV=development webpack-dev-server --hot --inline --colors --progress --display-error-details --port 3000 ",
"build": "cross-env NODE_ENV=production webpack",
"test": "cross-env NODE_ENV=test karma start etc/karma.conf.ci.js",
"debug": "cross-env NODE_ENV=test karma start etc/karma.conf.js"
},
...
Advanced Usage
TODO multi-app