Permalink
Browse files

wip: general project setup: e2e demo app

  • Loading branch information...
1 parent ad8ecc8 commit c52b48c88fc086b0a0de97ef6078bfdba1888bf7 @mseemann committed Sep 17, 2016
View
@@ -0,0 +1,3 @@
+- the components are tested with a system.js configuration
+- the demo/e2e app is build with webpack
+=> both widly used dev configurations are used (system.js and webpack)
@@ -0,0 +1,8 @@
+var path = require('path');
+var _root = path.resolve(__dirname, '../..');
+
+function root(args) {
+ args = Array.prototype.slice.call(arguments, 0);
+ return path.join.apply(path, [_root].concat(args));
+}
+exports.root = root;
@@ -0,0 +1,58 @@
+var webpack = require('webpack');
+var HtmlWebpackPlugin = require('html-webpack-plugin');
+var ExtractTextPlugin = require('extract-text-webpack-plugin');
+var util = require('./util');
+
+module.exports = {
+ entry: {
+ 'polyfills': './src/e2e-app/polyfills.ts',
+ 'vendor': './src/e2e-app/vendor.ts',
+ 'app': './src/e2e-app/main.ts'
+ },
+
+ resolve: {
+ extensions: ['', '.js', '.ts']
+ },
+
+ module: {
+ loaders: [
+ {
+ test: /\.ts$/,
+ loaders: ['awesome-typescript-loader?tsconfig=./src/e2e-app/tsconfig.json', 'angular2-template-loader']
+ },
+ {
+ test: /\.html$/,
+ loader: 'html'
+ },
+ {
+ test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
+ loader: 'file?name=assets/[name].[hash].[ext]'
+ },
+ {
+ test: /\.css$/,
+ exclude: util.root('src/e2e-app', 'app'),
+ loader: ExtractTextPlugin.extract('style', 'css?sourceMap')
+ },
+ {
+ test: /\.css$/,
+ include: util.root('src/e2e-app', 'app'),
+ loader: 'raw-loader'
+ },
+ {
+ test: /\.hbs$/,
+ loader: 'handlebars'
+ }
+ ]
+ },
+
+ plugins: [
+ new webpack.optimize.CommonsChunkPlugin({
+ name: ['app', 'vendor', 'polyfills']
+ }),
+
+ new HtmlWebpackPlugin({
+ template: '!!handlebars!src/e2e-app/index.hbs',
+ baseUrl: process.env.NODE_ENV == 'production' ? '/angular2-mdl-ext/' : '/'
+ })
+ ]
+};
@@ -0,0 +1,26 @@
+var webpackMerge = require('webpack-merge');
+var ExtractTextPlugin = require('extract-text-webpack-plugin');
+var commonConfig = require('./webpack.common.js');
+var util = require('./util');
+
+module.exports = webpackMerge(commonConfig, {
+ devtool: 'cheap-module-eval-source-map',
+
+ debug: true,
+
+ output: {
+ path: util.root('dist'),
+ publicPath: 'http://localhost:8080/',
+ filename: '[name].js',
+ chunkFilename: '[id].chunk.js'
+ },
+
+ plugins: [
+ new ExtractTextPlugin('[name].css')
+ ],
+
+ devServer: {
+ historyApiFallback: true,
+ stats: 'minimal'
+ }
+});
@@ -0,0 +1,38 @@
+var webpack = require('webpack');
+var webpackMerge = require('webpack-merge');
+var ExtractTextPlugin = require('extract-text-webpack-plugin');
+var commonConfig = require('./webpack.common.js');
+var util = require('./util');
+
+const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
+
+module.exports = webpackMerge(commonConfig, {
+ devtool: 'source-map',
+
+ output: {
+ path: util.root('dist'),
+ publicPath: '',
+ filename: '[name].[hash].js',
+ chunkFilename: '[id].[hash].chunk.js'
+ },
+
+ htmlLoader: {
+ minimize: false // workaround for ng2
+ },
+
+ plugins: [
+ new webpack.NoErrorsPlugin(),
+ new webpack.optimize.DedupePlugin(),
+ new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
+ mangle: {
+ keep_fnames: true
+ }
+ }),
+ new ExtractTextPlugin('[name].[hash].css'),
+ new webpack.DefinePlugin({
+ 'process.env': {
+ 'ENV': JSON.stringify(ENV)
+ }
+ })
+ ]
+});
View
@@ -7,6 +7,8 @@
"test": "gulp test:single-run",
"posttest": "remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-mapped.json -t lcovonly -o coverage/lcov.info; remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-mapped.json -t html -o coverage/coverage-remap",
"gulp": "gulp",
+ "start": "webpack-dev-server --inline --progress --port 8080",
+ "build": "rimraf dist && cross-env NODE_ENV=production webpack --config config/webpack/webpack.prod.js --progress --profile --bail",
"codeclimate": "CODECLIMATE_REPO_TOKEN=162088e65c68b91563b5ca8e31de5cd5706ae99f4b8c8e76ed0cf4357170bec1 codeclimate-test-reporter < coverage/lcov.info"
},
"repository": {
@@ -18,6 +20,8 @@
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
+ "@angular/http": "2.0.0",
+ "@angular/router": "3.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"angular2-mdl": "1.7.1",
@@ -28,18 +32,27 @@
"zone.js": "0.6.23"
},
"devDependencies": {
+ "@types/core-js": "^0.9.32",
"@types/gulp": "3.8.31",
"@types/jasmine": "2.2.33",
"@types/merge2": "0.0.28",
"@types/node": "6.0.38",
"angular-cli": "1.0.0-beta.14",
+ "angular2-template-loader": "^0.5.0",
+ "awesome-typescript-loader": "^2.2.4",
"codeclimate-test-reporter": "^0.3.3",
"coveralls": "^2.11.12",
+ "cross-env": "^2.0.1",
+ "css-loader": "^0.25.0",
+ "extract-text-webpack-plugin": "^1.0.1",
"gulp": "3.9.1",
"gulp-clean": "0.3.2",
"gulp-print": "^2.0.1",
"gulp-sass": "^2.3.2",
"gulp-typescript": "2.13.6",
+ "handlebars-loader": "^1.4.0",
+ "html-loader": "^0.4.4",
+ "html-webpack-plugin": "^2.22.0",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.7.0",
"karma": "1.3.0",
@@ -50,12 +63,18 @@
"karma-remap-istanbul": "^0.2.1",
"karma-spec-reporter": "0.0.26",
"merge2": "^1.0.2",
+ "raw-loader": "^0.5.1",
"remap-istanbul": "0.6.4",
+ "rimraf": "^2.5.4",
"run-sequence": "^1.2.2",
+ "style-loader": "^0.13.1",
"ts-node": "1.3.0",
"tslint": "3.15.1",
"typescript": "2.0.2",
- "typings": "1.3.3"
+ "typings": "1.3.3",
+ "webpack": "^1.13.2",
+ "webpack-dev-server": "^1.15.2",
+ "webpack-merge": "^0.14.1"
},
"keywords": [
"angular2",
Oops, something went wrong.

0 comments on commit c52b48c

Please sign in to comment.