diff options
Diffstat (limited to 'alarm-analysis/src/main/webapp/config')
4 files changed, 298 insertions, 96 deletions
diff --git a/alarm-analysis/src/main/webapp/config/karma-test-shim.js b/alarm-analysis/src/main/webapp/config/karma-test-shim.js index 3eb1f5e2..3f77315c 100644 --- a/alarm-analysis/src/main/webapp/config/karma-test-shim.js +++ b/alarm-analysis/src/main/webapp/config/karma-test-shim.js @@ -25,7 +25,7 @@ require('zone.js/dist/jasmine-patch'); require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');
-var appContext = require.context('../src', true, /\.spec\.ts/);
+var appContext = require.context('../alarm', true, /\.spec\.ts/);
appContext.keys().forEach(appContext);
diff --git a/alarm-analysis/src/main/webapp/config/webpack.common.js b/alarm-analysis/src/main/webapp/config/webpack.common.js index 34ce92df..642e1664 100644 --- a/alarm-analysis/src/main/webapp/config/webpack.common.js +++ b/alarm-analysis/src/main/webapp/config/webpack.common.js @@ -12,70 +12,104 @@ * See the License for the specific language governing permissions and
* limitations under the License.
*/
-var webpack = require('webpack');
-var HtmlWebpackPlugin = require('html-webpack-plugin');
-var ExtractTextPlugin = require('extract-text-webpack-plugin');
-var helpers = require('./helpers');
+const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
+const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
+const CopyWebpackPlugin = require('copy-webpack-plugin');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
+
+const webpack = require('webpack');
+const helpers = require('./helpers');
+const path = require('path');
+
+
+
module.exports = {
entry: {
- 'polyfills': './alarm/polyfills.ts',
- 'vendor': './alarm/vendor.ts',
- 'app': './alarm/main.ts'
+ 'main': './alarm/main.browser.ts',
+ 'vendor': './alarm/vendor.ts',
+ 'polyfills': './alarm/polyfills.browser.ts'
},
-
resolve: {
- extensions: ['', '.js', '.ts']
- },
+ extensions: ['.js', '.ts', '.json'],
+ },
module: {
- loaders: [
+
+ rules: [
{
test: /\.ts$/,
- loaders: ['awesome-typescript-loader', 'angular2-template-loader']
+ use: [
+
+ {
+ loader: 'awesome-typescript-loader',
+ options: {
+ }
+ },
+ {
+ loader: 'angular2-template-loader'
+ }
+ ],
+ exclude: [/\.(spec|e2e)\.ts$/]
+ },
+ {
+ test: /\.json$/,
+ use: 'json-loader'
+ },
+ {
+ test: /\.css$/,
+ use: ['to-string-loader', 'css-loader?sourceMap'],
+ include: helpers.root('alarm', 'app'),
+ exclude: [helpers.root('alarm/assets'), helpers.root('public')]
},
-
- {
+ {
test: /\.html$/,
- loader: 'html'
+ use: 'raw-loader',
+ include: [helpers.root('alarm/app')],
+ exclude: [helpers.root('alarm/index.html')]
},
- {
+
+
+ {
test: /\.(png|jpe?g|gif|ico|svg)$/,
- include: [helpers.root('public', 'thirdparty'),helpers.root('public', 'framework'),
- helpers.root('public', 'thirdparty/images'),helpers.root('public', 'framework/browser/thirdparty/images')
+ include: [helpers.root('public')
],
- loader: 'file?name=public/images/[name].[hash].[ext]'
+ use: 'file-loader?name=assets/images/[name].[hash].[ext]'
},
- {
- test: /\.(svg|woff|woff2|ttf|eot)$/,
+
+
+ {
+ test: /\.(eot|woff2?|svg|ttf)([\?]?.*)$/,
include: [helpers.root('public', 'thirdparty')
],
- loader: 'file?name=public/fonts/[name].[hash].[ext]'
- },
- {
- test: /\.css$/,
- exclude: [helpers.root('alarm', 'app'),helpers.root('public', 'component/thirdparty/icheck/skins/line')
- ],
- loader: ExtractTextPlugin.extract('style', 'css?sourceMap')
- },
- {
- test: /\.css$/,
- include: helpers.root('alarm', 'app'),
- loader: 'raw'
+ use: 'file-loader?name=assets/fonts/[name].[hash].[ext]'
}
- ]
+
+ ],
+
},
plugins: [
+
+ new CheckerPlugin(),
+
+ new ContextReplacementPlugin(
+ /angular(\\|\/)core(\\|\/)alarm(\\|\/)linker/,
+ helpers.root('alarm'),
+ {
+ }
+ ),
+
+ new HtmlWebpackPlugin({
+ template: 'alarm/index.html',
+ }),
+
new webpack.optimize.CommonsChunkPlugin({
- name: ['app', 'vendor', 'polyfills']
+ name: ['main', 'vendor', 'polyfills']
}),
- new HtmlWebpackPlugin({
- template: 'alarm/index.html'
- })
-
]
};
diff --git a/alarm-analysis/src/main/webapp/config/webpack.dev.js b/alarm-analysis/src/main/webapp/config/webpack.dev.js index 235a3acd..3028c2d5 100644 --- a/alarm-analysis/src/main/webapp/config/webpack.dev.js +++ b/alarm-analysis/src/main/webapp/config/webpack.dev.js @@ -12,31 +12,142 @@ * See the License for the specific language governing permissions and
* limitations under the License.
*/
-var webpackMerge = require('webpack-merge');
-var ExtractTextPlugin = require('extract-text-webpack-plugin');
-var commonConfig = require('./webpack.common.js');
-var helpers = require('./helpers');
+const webpackMerge = require('webpack-merge');
+const commonConfig = require('./webpack.common.js');
+const helpers = require('./helpers');
+
+
+/**
+ * Webpack Plugins
+ */
+const DefinePlugin = require('webpack/lib/DefinePlugin');
+const ExtractTextPlugin = require('extract-text-webpack-plugin');
+const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
+const CopyWebpackPlugin = require('copy-webpack-plugin');
+
module.exports = webpackMerge(commonConfig, {
- devtool: 'cheap-module-eval-source-map',
-
- output: {
- path: helpers.root('dist'),
- filename: '[name].js',
- chunkFilename: '[id].chunk.js'
- },
-
- plugins: [
- new ExtractTextPlugin('[name].css')
- ],
-
- devServer: {
- port: 9527,
- host: '10.74.24.30',
- historyApiFallback: true,
- watchOptions: {
- aggregateTimeout: 300,
- poll: 1000
- }
- }
+
+
+
+
+ devtool: 'source-map',
+
+
+
+ output: {
+
+
+
+ path: helpers.root('holmes'),
+
+
+ filename: '[name].bundle.js',
+
+
+ sourceMapFilename: '[name].map',
+
+
+ chunkFilename: '[id].chunk.js'
+ },
+
+
+
+ module: {
+
+ rules: [
+ {
+ test: /\.ts$/,
+ use: [
+ {
+ loader: 'tslint-loader',
+ options: {
+ configFile: 'tslint.json',
+ fileOutput: {
+ dir: './foo/',
+
+ ext: 'xml',
+
+ clean: true,
+
+ header: '<?xml version="1.0" encoding="utf-8"?>\n<checkstyle version="5.7">',
+
+ footer: '</checkstyle>'
+ }
+ }
+ }
+ ],
+ exclude: [/\.(spec|e2e)\.ts$/]
+ },
+
+ {
+ test: /\.css$/,
+ use: ['to-string-loader', 'style-loader', 'css-loader'],
+ include: [helpers.root('alarm/assets'), helpers.root('public')]
+ },
+
+ ]
+
+ },
+
+
+
+ plugins: [
+
+
+ new CopyWebpackPlugin([
+ { from: helpers.root('public/thirdparty/js/jquery_1.12.4.min.js'), to: helpers.root('holmes/public/js') },
+ { from: helpers.root('public/common/js/popModal.js'), to: helpers.root('holmes/public/js') },
+ { from: helpers.root('public/common/js/jQuery-File-Upload/js/jquery.ui.widget.js'), to: helpers.root('holmes/public/js') },
+ { from: helpers.root('public/common/js/jQuery-File-Upload/js/vendor/jquery.ui.widget.js'), to: helpers.root('holmes/public/js') },
+ { from: helpers.root('public/common/js/jQuery-File-Upload/js/jquery.iframe-transport.js'), to: helpers.root('holmes/public/js') },
+ { from: helpers.root('public/common/js/jQuery-File-Upload/js/jquery.fileupload.js'), to: helpers.root('holmes/public/js') },
+ { from: helpers.root('i18n'), to: helpers.root('holmes/i18n') },
+ { from: helpers.root('public/thirdparty/images/'), to: helpers.root('holmes/public/thirdparty/images') }
+ ]),
+
+
+
+ new DefinePlugin({
+ VERSION: JSON.stringify('version'),
+ CONST2: JSON.stringify('CONST2')
+ }),
+
+
+ ],
+
+
+
+
+
+ devServer: {
+
+ port: 9528,
+
+ host: '10.74.24.20',
+
+ historyApiFallback: true,
+
+ inline: true,
+
+ progress: true,
+
+ colors: true,
+
+ watch: false
+ },
+
+
+ node: {
+ global: true,
+ console: true,
+ crypto: 'empty',
+ process: true,
+ module: false,
+ clearImmediate: false,
+ setImmediate: false
+ }
+
+
+
});
diff --git a/alarm-analysis/src/main/webapp/config/webpack.prod.js b/alarm-analysis/src/main/webapp/config/webpack.prod.js index 11920244..d6ddc420 100644 --- a/alarm-analysis/src/main/webapp/config/webpack.prod.js +++ b/alarm-analysis/src/main/webapp/config/webpack.prod.js @@ -12,41 +12,98 @@ * See the License for the specific language governing permissions and
* limitations under the License.
*/
-var webpack = require('webpack');
-var webpackMerge = require('webpack-merge');
-var ExtractTextPlugin = require('extract-text-webpack-plugin');
-var commonConfig = require('./webpack.common.js');
-var helpers = require('./helpers');
+const ExtractTextPlugin = require('extract-text-webpack-plugin');
+const DefinePlugin = require('webpack/lib/DefinePlugin');
+const CopyWebpackPlugin = require('copy-webpack-plugin');
+const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
+const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
+
+
+const webpack = require('webpack');
+const commonConfig = require('./webpack.common.js');
+const webpackMerge = require('webpack-merge');
+const helpers = require('./helpers');
-const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
module.exports = webpackMerge(commonConfig, {
- devtool: 'source-map',
-
- output: {
- path: helpers.root('dist'),
- publicPath: '/',
- filename: '[name].[hash].js',
- chunkFilename: '[id].[hash].chunk.js'
- },
-
- htmlLoader: {
- minimize: false
- },
-
- plugins: [
- new webpack.NoErrorsPlugin(),
- new webpack.optimize.DedupePlugin(),
- new webpack.optimize.UglifyJsPlugin({
- mangle: {
- keep_fnames: true
+
+
+ devtool: 'source-map',
+
+
+ output: {
+
+ path: helpers.root('holmes'),
+
+ filename: '[name].[chunkhash].bundle.js',//'[name].[hash].js',
+
+ sourceMapFilename: '[name].[chunkhash].bundle.map',
+
+
+ chunkFilename: '[id].[chunkhash].chunk.js'//'[id].[hash].chunk.js'
+ },
+
+
+
+
+ module: {
+
+ rules: [
+
+ {
+ test: /\.css$/,
+ loader: ExtractTextPlugin.extract({
+ fallback: 'style-loader',
+ use: {
+ loader: 'css-loader',
+ options: {
+ sourceMap: true,
+ minimize: true
}
+ }
}),
- new ExtractTextPlugin('[name].[hash].css'),
- new webpack.DefinePlugin({
- 'process.env': {
- 'ENV': JSON.stringify(ENV)
- }
- })
+ include: [helpers.root('alarm/assets'), helpers.root('public'),helpers.root('alarm/app')]
+ },
]
+
+ },
+
+ plugins: [
+
+ new webpack.NoErrorsPlugin(),
+
+ new webpack.optimize.DedupePlugin(),
+
+ new webpack.optimize.UglifyJsPlugin({
+ sourceMap: true,
+ mangle: {
+ keep_fnames: true
+ }
+ }),
+
+
+ new ExtractTextPlugin('[name].[contenthash].css'),
+
+ new DefinePlugin({
+ 'CONST': true,
+ }),
+
+
+ new LoaderOptionsPlugin({
+ minimize: true,
+ debug: false,
+ })
+ ],
+
+
+ node: {
+ global: true,
+ crypto: 'empty',
+ process: false,
+ module: false,
+ clearImmediate: false,
+ setImmediate: false
+ }
+
+
});
|