summaryrefslogtreecommitdiffstats
path: root/usecaseui-holmes/src/main/webapp/config
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-holmes/src/main/webapp/config')
-rw-r--r--usecaseui-holmes/src/main/webapp/config/helpers.js21
-rw-r--r--usecaseui-holmes/src/main/webapp/config/karma-test-shim.js35
-rw-r--r--usecaseui-holmes/src/main/webapp/config/karma.conf.js51
-rw-r--r--usecaseui-holmes/src/main/webapp/config/webpack.common.js115
-rw-r--r--usecaseui-holmes/src/main/webapp/config/webpack.dev.js153
-rw-r--r--usecaseui-holmes/src/main/webapp/config/webpack.prod.js109
-rw-r--r--usecaseui-holmes/src/main/webapp/config/webpack.test.js51
7 files changed, 535 insertions, 0 deletions
diff --git a/usecaseui-holmes/src/main/webapp/config/helpers.js b/usecaseui-holmes/src/main/webapp/config/helpers.js
new file mode 100644
index 00000000..febdefa6
--- /dev/null
+++ b/usecaseui-holmes/src/main/webapp/config/helpers.js
@@ -0,0 +1,21 @@
+/* Copyright 2017 ZTE Corporation.
+ *
+ *Licensed under the Apache License, Version 2.0 (the "License");
+ *you may not use this file except in compliance with the License.
+ *You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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;
diff --git a/usecaseui-holmes/src/main/webapp/config/karma-test-shim.js b/usecaseui-holmes/src/main/webapp/config/karma-test-shim.js
new file mode 100644
index 00000000..c356c69a
--- /dev/null
+++ b/usecaseui-holmes/src/main/webapp/config/karma-test-shim.js
@@ -0,0 +1,35 @@
+/* Copyright 2017 ZTE Corporation.
+ *
+ *Licensed under the Apache License, Version 2.0 (the "License");
+ *you may not use this file except in compliance with the License.
+ *You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+Error.stackTraceLimit = Infinity;
+
+require('core-js/es6');
+require('reflect-metadata');
+
+require('zone.js/dist/zone');
+require('zone.js/dist/long-stack-trace-zone');
+require('zone.js/dist/proxy');
+require('zone.js/dist/sync-test');
+require('zone.js/dist/jasmine-patch');
+require('zone.js/dist/async-test');
+require('zone.js/dist/fake-async-test');
+
+var appContext = require.context('../alarm', true, /\.spec\.ts/);
+
+appContext.keys().forEach(appContext);
+
+var testing = require('@angular/core/testing');
+var browser = require('@angular/platform-browser-dynamic/testing');
+
+testing.TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
diff --git a/usecaseui-holmes/src/main/webapp/config/karma.conf.js b/usecaseui-holmes/src/main/webapp/config/karma.conf.js
new file mode 100644
index 00000000..a6ec28b7
--- /dev/null
+++ b/usecaseui-holmes/src/main/webapp/config/karma.conf.js
@@ -0,0 +1,51 @@
+/* Copyright 2017 ZTE Corporation.
+ *
+ *Licensed under the Apache License, Version 2.0 (the "License");
+ *you may not use this file except in compliance with the License.
+ *You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var webpackConfig = require('./webpack.test');
+
+module.exports = function (config) {
+ var _config = {
+ basePath: '',
+
+ frameworks: ['jasmine'],
+
+ files: [
+ {pattern: './config/karma-test-shim.js', watched: false}
+ ],
+
+ preprocessors: {
+ './config/karma-test-shim.js': ['webpack', 'sourcemap']
+ },
+
+ webpack: webpackConfig,
+
+ webpackMiddleware: {
+ stats: 'errors-only'
+ },
+
+ webpackServer: {
+ noInfo: true
+ },
+
+ reporters: ['progress'],
+ port: 9876,
+ colors: true,
+ logLevel: config.LOG_INFO,
+ autoWatch: false,
+ browsers: ['PhantomJS'],
+ singleRun: true
+ };
+
+ config.set(_config);
+};
diff --git a/usecaseui-holmes/src/main/webapp/config/webpack.common.js b/usecaseui-holmes/src/main/webapp/config/webpack.common.js
new file mode 100644
index 00000000..ba0ed8e5
--- /dev/null
+++ b/usecaseui-holmes/src/main/webapp/config/webpack.common.js
@@ -0,0 +1,115 @@
+/* Copyright 2017 ZTE Corporation.
+ *
+ *Licensed under the Apache License, Version 2.0 (the "License");
+ *you may not use this file except in compliance with the License.
+ *You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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: {
+ 'main': './alarm/main.browser.ts',
+ 'vendor': './alarm/vendor.ts',
+ 'polyfills': './alarm/polyfills.browser.ts'
+ },
+ resolve: {
+
+ extensions: ['.js', '.ts', '.json'],
+ },
+ module: {
+
+ rules: [
+ {
+ test: /\.ts$/,
+ 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$/,
+ 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')
+ ],
+ use: 'file-loader?name=assets/images/[name].[hash].[ext]'
+ },
+
+
+ {
+ test: /\.(eot|woff2?|svg|ttf)([\?]?.*)$/,
+ include: [helpers.root('public', 'thirdparty')
+ ],
+ 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: ['main', 'vendor', 'polyfills']
+ }),
+
+ ]
+};
diff --git a/usecaseui-holmes/src/main/webapp/config/webpack.dev.js b/usecaseui-holmes/src/main/webapp/config/webpack.dev.js
new file mode 100644
index 00000000..d649c1c3
--- /dev/null
+++ b/usecaseui-holmes/src/main/webapp/config/webpack.dev.js
@@ -0,0 +1,153 @@
+/* Copyright 2017 ZTE Corporation.
+ *
+ *Licensed under the Apache License, Version 2.0 (the "License");
+ *you may not use this file except in compliance with the License.
+ *You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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: '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/usecaseui-holmes/src/main/webapp/config/webpack.prod.js b/usecaseui-holmes/src/main/webapp/config/webpack.prod.js
new file mode 100644
index 00000000..dcefdabe
--- /dev/null
+++ b/usecaseui-holmes/src/main/webapp/config/webpack.prod.js
@@ -0,0 +1,109 @@
+/* Copyright 2017 ZTE Corporation.
+ *
+ *Licensed under the Apache License, Version 2.0 (the "License");
+ *you may not use this file except in compliance with the License.
+ *You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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');
+
+
+module.exports = webpackMerge(commonConfig, {
+
+
+ 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
+ }
+ }
+ }),
+ 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
+ }
+
+
+});
diff --git a/usecaseui-holmes/src/main/webapp/config/webpack.test.js b/usecaseui-holmes/src/main/webapp/config/webpack.test.js
new file mode 100644
index 00000000..7ac8b6de
--- /dev/null
+++ b/usecaseui-holmes/src/main/webapp/config/webpack.test.js
@@ -0,0 +1,51 @@
+/* Copyright 2017 ZTE Corporation.
+ *
+ *Licensed under the Apache License, Version 2.0 (the "License");
+ *you may not use this file except in compliance with the License.
+ *You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var helpers = require('./helpers');
+
+module.exports = {
+ devtool: 'inline-source-map',
+
+ resolve: {
+ extensions: ['', '.ts', '.js']
+ },
+
+ module: {
+ loaders: [
+ {
+ test: /\.ts$/,
+ loaders: ['awesome-typescript-loader', 'angular2-template-loader']
+ },
+ {
+ test: /\.html$/,
+ loader: 'html'
+
+ },
+ {
+ test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
+ loader: 'null'
+ },
+ {
+ test: /\.css$/,
+ exclude: helpers.root('src', 'app'),
+ loader: 'null'
+ },
+ {
+ test: /\.css$/,
+ include: helpers.root('src', 'app'),
+ loader: 'raw'
+ }
+ ]
+ }
+};