You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2016/06/20 02:59:01 UTC
[38/50] [abbrv] ignite git commit: IGNITE-3319 Finished migration to
webpack
IGNITE-3319 Finished migration to webpack
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/af05c35c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/af05c35c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/af05c35c
Branch: refs/heads/ignite-3262
Commit: af05c35c09b250a3ec675bee1db0a994a041188a
Parents: 40f6abc
Author: Maxim Afanasiev <ma...@gmail.com>
Authored: Wed Jun 15 16:13:56 2016 +0700
Committer: Maxim Afanasiev <ma...@gmail.com>
Committed: Wed Jun 15 16:13:56 2016 +0700
----------------------------------------------------------------------
modules/web-console/src/main/js/app/index.js | 7 +-
.../clusters/general/discovery/vm.jade | 2 +-
modules/web-console/src/main/js/app/vendor.js | 5 +-
.../src/main/js/gulpfile.babel.js/paths.js | 2 +-
.../main/js/gulpfile.babel.js/tasks/bundle.js | 4 +-
.../main/js/gulpfile.babel.js/tasks/connect.js | 47 -----
.../src/main/js/gulpfile.babel.js/tasks/copy.js | 4 +-
.../main/js/gulpfile.babel.js/tasks/eslint.js | 46 -----
.../gulpfile.babel.js/tasks/ignite-modules.js | 9 +-
.../main/js/gulpfile.babel.js/tasks/server.js | 22 ---
.../main/js/gulpfile.babel.js/tasks/watch.js | 3 +-
.../main/js/gulpfile.babel.js/webpack/common.js | 174 +++++++++++++++++++
.../webpack/environments/development.js | 31 +++-
.../webpack/environments/production.js | 61 ++++---
.../main/js/gulpfile.babel.js/webpack/global.js | 159 -----------------
.../main/js/gulpfile.babel.js/webpack/index.js | 35 ++++
.../webpack/plugins/progress.js | 43 ++++-
modules/web-console/src/main/js/package.json | 24 ++-
.../web-console/src/main/js/views/index.jade | 12 +-
.../web-console/src/main/js/webpack.config.js | 28 ---
20 files changed, 348 insertions(+), 370 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/app/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/app/index.js b/modules/web-console/src/main/js/app/index.js
index 3f12eda..6fe84c2 100644
--- a/modules/web-console/src/main/js/app/index.js
+++ b/modules/web-console/src/main/js/app/index.js
@@ -100,7 +100,8 @@ import 'controllers/profile-controller';
import 'controllers/sql-controller';
// Inject external modules.
-import 'ignite_modules_temp/index';
+import 'ignite_modules_temp/index';
+
import baseTemplate from '../views/base.jade';
@@ -138,9 +139,9 @@ angular
'ignite-console.version',
'ignite-console.loading',
// Ignite legacy module.
- 'ignite-console.legacy'
+ 'ignite-console.legacy',
// Ignite modules.
- // 'ignite-console.modules'
+ 'ignite-console.modules'
])
// Directives.
.directive(...igniteHideOnStateChange)
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade b/modules/web-console/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
index cc39790..1f20613 100644
--- a/modules/web-console/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
+++ b/modules/web-console/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
@@ -37,7 +37,7 @@ include ../../../../../../../app/helpers/jade/mixins.jade
li Hostname and port range (e.g. host1.com:47500..47510, host2:47502..47508, etc)
| If port is 0 or not provided then default port will be used (depends on discovery SPI configuration)#[br]
| If port range is provided (e.g. host:port1..port2) the following should be considered:
- ul: li port1 < port2 should be true
+ ul: li port1 < port2 should be true
li Both port1 and port2 should be greater than 0
ignite-form-group-add(ng-click='group.add = [{}]')
| Add new address
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/app/vendor.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/app/vendor.js b/modules/web-console/src/main/js/app/vendor.js
index e71111f..cf90f4c 100644
--- a/modules/web-console/src/main/js/app/vendor.js
+++ b/modules/web-console/src/main/js/app/vendor.js
@@ -24,13 +24,10 @@ import 'brace/theme/chrome';
import 'font-awesome-webpack';
import 'file-saver';
import 'jszip';
+import 'nvd3';
import 'query-command-supported';
import 'angular-gridster/dist/angular-gridster.min.css';
import 'angular-tree-control/css/tree-control-attribute.css';
import 'angular-tree-control/css/tree-control.css';
import 'angular-ui-grid/ui-grid.css';
import 'angular-motion/dist/angular-motion.css';
-
-// import pdfMake from 'pdfmake';
-
-// window.pdfMake = pdfMake;
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/paths.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/paths.js b/modules/web-console/src/main/js/gulpfile.babel.js/paths.js
index 8de6bcb..9a1e61a 100644
--- a/modules/web-console/src/main/js/gulpfile.babel.js/paths.js
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/paths.js
@@ -19,7 +19,7 @@ import path from 'path';
const rootDir = path.resolve('./');
const srcDir = path.resolve('app');
-const destDir = path.resolve('dist');
+const destDir = path.resolve('build');
const igniteModulesDir = process.env.IGNITE_MODULES ? path.normalize(process.env.IGNITE_MODULES) : './ignite_modules';
const igniteModulesTemp = path.resolve('ignite_modules_temp');
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/tasks/bundle.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/bundle.js b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/bundle.js
index 1f817fb..f4e7fcc 100644
--- a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/bundle.js
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/bundle.js
@@ -17,14 +17,14 @@
import gulp from 'gulp';
import webpack from 'webpack';
-import webpackConfig from '../../webpack.config';
+import webpackConfig from '../webpack';
import WebpackDevServer from 'webpack-dev-server';
gulp.task('bundle', (cb) => {
if (process.env.NODE_ENV === 'development')
// Important! Call webpack and WebpackDevServer must be inline.
new WebpackDevServer(webpack(webpackConfig), webpackConfig.devServer)
- .listen(webpackConfig.devServer.port, 'localhost');
+ .listen(webpackConfig.devServer.port, 'localhost', cb);
else
webpack(webpackConfig, cb);
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/tasks/connect.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/connect.js b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/connect.js
deleted file mode 100644
index 4bffe50..0000000
--- a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/connect.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-import gulp from 'gulp';
-import connect from 'gulp-connect';
-import proxy from 'http-proxy-middleware';
-
-import { destDir } from '../paths';
-
-// Task run static server to local development.
-gulp.task('connect', () => {
- connect.server({
- port: 8090,
- root: [destDir],
- middleware() {
- return [
- proxy('/socket.io', {
- target: 'http://localhost:3000',
- changeOrigin: true,
- ws: true
- }),
- proxy('/api/v1/', {
- target: 'http://localhost:3000',
- changeOrigin: true,
- pathRewrite: {
- '^/api/v1/': '/' // remove path
- }
- })
- ];
- },
- fallback: `${destDir}/index.html`
- });
-});
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/tasks/copy.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/copy.js b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/copy.js
index 5683a48..c0ec9b5 100644
--- a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/copy.js
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/copy.js
@@ -19,7 +19,7 @@ import gulp from 'gulp';
import cache from 'gulp-cached';
import sequence from 'gulp-sequence';
-import { destDir, jsModulePaths, resourcePaths, resourceModulePaths, igniteModulesTemp } from '../paths';
+import { destDir, rootDir, jsModulePaths, resourcePaths, resourceModulePaths, igniteModulesTemp } from '../paths';
gulp.task('copy', (cb) => {
const tasks = ['copy:resource', 'copy:ignite_modules:resource', 'copy:ignite_modules:js'];
@@ -30,7 +30,7 @@ gulp.task('copy', (cb) => {
gulp.task('copy:ignite_modules:js', () =>
gulp.src(jsModulePaths)
.pipe(cache('copy:ignite_modules:js'))
- .pipe(gulp.dest(`${destDir}/${igniteModulesTemp}`))
+ .pipe(gulp.dest(`${rootDir}/${igniteModulesTemp}`))
);
gulp.task('copy:resource', () =>
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/tasks/eslint.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/eslint.js b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/eslint.js
deleted file mode 100644
index 2d60037..0000000
--- a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/eslint.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-import gulp from 'gulp';
-import cache from 'gulp-cached';
-import eslint from 'gulp-eslint';
-import sequence from 'gulp-sequence';
-
-const paths = [
- './app/**/*.js',
- './controllers/**/*.js',
- './generator/**/*.js',
- './ignite_modules_temp/**/*.js',
- './gulpfile.babel.js/**/*.js',
- './gulpfile.babel.js/*.js'
-];
-
-gulp.task('eslint:node', () =>
- gulp.src('./serve/**/*.js')
- .pipe(cache('eslint:node'))
- .pipe(eslint({envs: ['node']}))
- .pipe(eslint.format())
-);
-
-gulp.task('eslint:browser', () =>
- gulp.src(paths)
- .pipe(cache('eslint:browser'))
- .pipe(eslint({envs: ['browser']}))
- .pipe(eslint.format())
-);
-
-gulp.task('eslint', (cb) => sequence('eslint:browser', 'eslint:node', cb));
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/tasks/ignite-modules.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/ignite-modules.js b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/ignite-modules.js
index b1b1190..b97de7c 100644
--- a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/ignite-modules.js
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/ignite-modules.js
@@ -19,8 +19,7 @@ import gulp from 'gulp';
import inject from 'gulp-inject';
import clean from 'gulp-rimraf';
import sequence from 'gulp-sequence';
-
-import { appModulePaths, igniteModulesTemp } from '../paths';
+import {appModulePaths, igniteModulesTemp} from '../paths';
gulp.task('ignite:modules', (cb) => sequence('ignite:modules:copy', 'ignite:modules:inject', cb));
@@ -37,7 +36,7 @@ gulp.task('ignite:modules:inject', () =>
transform: (filePath) => {
const igniteModuleName = filePath.replace(/.*ignite_modules_temp\/([^\/]+).*/mgi, '$1');
- // return file contents as string
+ // Return file contents as string.
return `import './${igniteModuleName}/main';`;
}
}))
@@ -47,10 +46,10 @@ gulp.task('ignite:modules:inject', () =>
transform: (filePath, file, i) => {
const igniteModuleName = filePath.replace(/.*ignite_modules_temp\/([^\/]+).*/mgi, '$1');
- // return file contents as string
+ // Return file contents as string.
return (i ? ',' : '') + `'ignite-console.${igniteModuleName}'`;
}
}))
- .pipe(clean({ force: true }))
+ .pipe(clean({force: true}))
.pipe(gulp.dest(igniteModulesTemp))
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/tasks/server.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/server.js b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/server.js
deleted file mode 100644
index 9999f89..0000000
--- a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/server.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-import gulp from 'gulp';
-
-gulp.task('server', () => {
- require('../../serve');
-});
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/tasks/watch.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/watch.js b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/watch.js
index b2f8348..33b0727 100644
--- a/modules/web-console/src/main/js/gulpfile.babel.js/tasks/watch.js
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/tasks/watch.js
@@ -20,8 +20,7 @@ import sequence from 'gulp-sequence';
import { jadePaths, jadeModulePaths, resourcePaths, resourceModulePaths, appPaths, appModulePaths } from '../paths';
-//TODO Webpack stream || webpack autoload
-gulp.task('watch:ignite-modules', (cb) => sequence('clean:ignite-modules-temp', 'ignite:modules', ['copy:ignite_modules:js'], cb));
+gulp.task('watch:ignite-modules', (cb) => sequence('clean:ignite-modules-temp', 'ignite:modules', 'copy:ignite_modules:js', cb));
// Build + connect + watch task.
gulp.task('watch', ['build'], () => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/webpack/common.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/common.js b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/common.js
new file mode 100644
index 0000000..6160af1
--- /dev/null
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/common.js
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+import path from 'path';
+import webpack from 'webpack';
+import autoprefixer from 'autoprefixer-core';
+import progressPlugin from './plugins/progress';
+
+//import Manifest from 'manifest-revision-webpack-plugin';
+import ExtractTextPlugin from 'extract-text-webpack-plugin';
+import {srcDir, destDir, rootDir} from '../paths';
+
+const NODE_ENV = process.env.NODE_ENV || 'production';
+const IS_DEVELOPMENT = NODE_ENV === 'development';
+const stylesLoader = 'css-loader?sourceMap!postcss-loader!sass-loader?outputStyle=expanded&sourceMap=true&sourceMapContents=true';
+
+export default () => {
+ const NODE_MODULES_PATH = path.resolve('node_modules');
+
+ const webpackConfig = {
+ node: {
+ fs: 'empty'
+ },
+ // Entry points.
+ entry: {
+ polyfill: 'babel-polyfill',
+ app: path.join(srcDir, 'index.js'),
+ vendor: path.join(srcDir, 'vendor.js')
+ },
+
+ // Output system.
+ output: {
+ path: destDir,
+ publicPath: './',
+ filename: '[name].js'
+ },
+
+ // Resolves modules.
+ resolve: {
+ extensions: ['', '.js'],
+ root: [rootDir],
+ modulesDirectories: [NODE_MODULES_PATH, './'],
+ alias: {
+ }
+ },
+
+ // Modules resolvers.
+ module: {
+ noParse: [],
+ preLoaders: [
+ {
+ test: /\.js$/,
+ exclude: [NODE_MODULES_PATH],
+ loader: 'eslint-loader'
+ }
+ ],
+ loaders: [
+ {
+ test: /\.json$/,
+ loader: 'json-loader'
+ },
+ {
+ test: /\.jade$/,
+ loaders: [
+ `ngtemplate-loader?relativeTo=${rootDir}`,
+ 'html-loader?attrs[]=img:src&attrs[]=img:data-src',
+ `jade-html-loader`
+ ]
+ },
+ {
+ test: /\.js$/,
+ loaders: ['baggage-loader?[file].html&[file].css']
+ },
+ {
+ test: /\.js$/,
+ exclude: [NODE_MODULES_PATH],
+ loaders: ['ng-annotate-loader']
+ },
+ {
+ test: /\.js$/,
+ exclude: [NODE_MODULES_PATH],
+ loader: 'babel-loader',
+ query: {
+ cacheDirectory: true,
+ plugins: ['transform-runtime', 'add-module-exports'],
+ presets: ['angular']
+
+ }
+ },
+ {
+ test: /\.css$/,
+ loaders: ['style-loader', 'css-loader?sourceMap', 'postcss-loader']
+ },
+ {
+ test: /\.(scss|sass)$/,
+ loader: IS_DEVELOPMENT ? `style-loader!${stylesLoader}` : ExtractTextPlugin.extract('style-loader', stylesLoader)
+ },
+ {
+ test: /\.(woff2|woff|ttf|eot|svg)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
+ loaders: [
+ 'url-loader?name=fonts/[name]_[hash].[ext]'
+ ]
+ },
+ {
+ test: /\.(jpe?g|png|gif)$/i,
+ loaders: ['url-loader?name=images/[name]_[hash].[ext]']
+ },
+ {
+ test: require.resolve("jquery"),
+ loaders: [
+ "expose-loader?$",
+ "expose-loader?jQuery"
+ ]
+ },
+ {
+ test: require.resolve("nvd3"),
+ loaders: [
+ "expose-loader?nv"
+ ]
+ }
+ ]
+ },
+
+ // Postcss configuration.
+ postcss: [autoprefixer({browsers: ['last 2 versions']})],
+
+ // ESLint loader configuration.
+ eslint: {
+ failOnWarning: false,
+ failOnError: false
+ },
+
+ // Load plugins.
+ plugins: [
+ new webpack.ProvidePlugin({
+ $: 'jquery',
+ jQuery: 'jquery',
+ _: 'lodash',
+ nv: 'nvd3'
+ }),
+ new webpack.DefinePlugin({'NODE_ENV': JSON.stringify(NODE_ENV)}),
+ // new webpack.NoErrorsPlugin(),
+ new webpack.optimize.AggressiveMergingPlugin({moveToParents: true}),
+ new webpack.optimize.CommonsChunkPlugin({
+ name: 'common',
+ async: true,
+ children: true,
+ minChunks: Infinity
+ }),
+ // new Manifest(path.join(_path + '/config', 'manifest.json'), {
+ // rootAssetPath: rootAssetPath,
+ // ignorePaths: ['.DS_Store']
+ // }),
+ new ExtractTextPlugin('assets/css/[name]' + (IS_DEVELOPMENT ? '' : '.[chunkhash]') + '.css', {allChunks: true}),
+ progressPlugin
+ ]
+ };
+
+ return webpackConfig;
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/development.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/development.js b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/development.js
index 37f3eca..716bc25 100644
--- a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/development.js
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/development.js
@@ -1,4 +1,19 @@
-'use strict';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
@@ -6,8 +21,7 @@ import {destDir, rootDir} from '../../paths';
import jade from 'jade';
import path from 'path';
-module.exports = function () {
-
+export default () => {
let plugins = [
new webpack.HotModuleReplacementPlugin(),
@@ -24,7 +38,8 @@ module.exports = function () {
return {
context: rootDir,
debug: true,
- devtool: 'eval',
+ devtool: 'cheap-module-eval-source-map',
+ watch: true,
devServer: {
historyApiFallback: true,
publicPath: '/',
@@ -47,10 +62,14 @@ module.exports = function () {
}
}
},
- stats: {colors: true},
+ watchOptions: {
+ aggregateTimeout: 1000,
+ poll: 1000
+ },
+ stats: 'verbose',
port: 9000
},
stats: {colors: true},
- plugins: plugins
+ plugins
};
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/production.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/production.js b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/production.js
index 4c63d8c..5630448 100644
--- a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/production.js
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/environments/production.js
@@ -1,4 +1,20 @@
-'use strict';
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
import HtmlWebpackPlugin from 'html-webpack-plugin';
import webpack from 'webpack';
import path from 'path';
@@ -6,9 +22,29 @@ import jade from 'jade';
import {destDir, rootDir} from '../../paths';
-module.exports = function (_path) {
+export default () => {
+
+ const plugins = [
+ new HtmlWebpackPlugin({
+ filename: 'index.html',
+ templateContent: () => {
+ return jade.renderFile(path.join(rootDir, 'views', 'index.jade'));
+ },
+ title: 'Ignite Web Console'
+ }),
+ new webpack.optimize.DedupePlugin(),
+ new webpack.optimize.UglifyJsPlugin({
+ path: destDir,
+ minimize: true,
+ warnings: false,
+ sourceMap: true,
+ mangle: true
+ })
+ ];
+
return {
context: rootDir,
+ bail: true, // Cancel build on error.
debug: false,
devtool: 'cheap-source-map',
output: {
@@ -16,22 +52,7 @@ module.exports = function (_path) {
filename: '[name].[chunkhash].js',
path: destDir
},
- plugins: [
- new HtmlWebpackPlugin({
- filename: 'index.html',
- templateContent: () => {
- return jade.renderFile(path.join(_path, 'views', 'index.jade'));
- },
- title: 'Ignite Web Console'
- }),
- new webpack.optimize.DedupePlugin(),
- new webpack.optimize.UglifyJsPlugin({
- path: destDir,
- minimize: true,
- warnings: false,
- sourceMap: true,
- mangle: true
- })
- ]
+ plugins
};
-};
\ No newline at end of file
+
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/webpack/global.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/global.js b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/global.js
deleted file mode 100644
index 9000038..0000000
--- a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/global.js
+++ /dev/null
@@ -1,159 +0,0 @@
-'use strict';
-
-import path from 'path';
-import webpack from 'webpack';
-import autoprefixer from 'autoprefixer-core';
-import progressPlugin from './plugins/progress';
-
-//import Manifest from 'manifest-revision-webpack-plugin';
-import ExtractTextPlugin from 'extract-text-webpack-plugin';
-import {srcDir, destDir, rootDir} from '../paths';
-
-const NODE_ENV = process.env.NODE_ENV || 'production';
-const IS_DEVELOPMENT = NODE_ENV === 'development';
-const stylesLoader = 'css-loader?sourceMap!postcss-loader!sass-loader?outputStyle=expanded&sourceMap=true&sourceMapContents=true';
-
-
-module.exports = function (_path) {
-
- const NODE_MODULES_PATH = path.resolve('node_modules');
- const webpackConfig = {
- node: {
- fs: 'empty'
- },
- // entry points
- entry: {
- polyfill: 'babel-polyfill',
- app: path.join(srcDir, 'index.js'),
- vendor: path.join(srcDir, 'vendor.js')
- },
-
- // Output system.
- output: {
- path: destDir,
- publicPath: './',
- filename: '[name].js'
- },
-
- // resolves modules
- resolve: {
- extensions: ['', '.js'],
- root : rootDir,
- modulesDirectories: [NODE_MODULES_PATH, './'],
- alias: {
- // _appRoot: path.join(_path, 'app'),
- // _images: path.join(_path, 'app', 'assets', 'images'),
- // _stylesheets: path.join(_path, 'app', 'assets', 'styles'),
- // _scripts: path.join(_path, 'app', 'assets', 'js'),
- // ace: path.join(_path, 'node_modules', 'ace-builds', 'src')
- }
- },
-
- // modules resolvers
- module: {
- noParse: [],
- // preLoaders: [
- // {
- // test: /\.js$/,
- // exclude: [NODE_MODULES_PATH],
- // loader: 'eslint-loader'
- // }
- // ],
- loaders: [
- {
- test: /\.json$/,
- loader: 'json-loader'
- },
- {
- test: /\.jade$/,
- loaders: [
- 'ngtemplate-loader?relativeTo=' + _path,
- 'html-loader?attrs[]=img:src&attrs[]=img:data-src',
- 'jade-html-loader'
- ]
- },
- {
- test: /\.js$/,
- loaders: ['baggage-loader?[file].html&[file].css']
- },
- {
- test: /\.js$/,
- exclude: [NODE_MODULES_PATH],
- loaders: ['ng-annotate-loader']
- },
- {
- test: /\.js$/,
- exclude: [NODE_MODULES_PATH],
- loader: 'babel-loader',
- query: {
- cacheDirectory: true,
- plugins: ['transform-runtime', 'add-module-exports'],
- presets: ['angular', 'es2017']
- }
- },
- {
- test: /\.css$/,
- loaders: ['style-loader', 'css-loader?sourceMap', 'postcss-loader']
- },
- {
- test: /\.(scss|sass)$/,
- loader: IS_DEVELOPMENT ? ('style-loader!' + stylesLoader) : ExtractTextPlugin.extract('style-loader', stylesLoader)
- },
- {
- test: /\.(woff2|woff|ttf|eot|svg)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
- loaders: [
- 'url-loader?name=fonts/[name]_[hash].[ext]'
- ]
- },
- {
- test: /\.(jpe?g|png|gif)$/i,
- loaders: ['url-loader?name=images/[name]_[hash].[ext]']
- },
- {
- test: require.resolve("jquery"),
- loaders: [
- "expose?$",
- "expose?jQuery"
- ]
- },
- // {
- // test: require.resolve("angular"),
- // loaders: [
- // "expose?angular"
- // ]
- // }
- ]
- },
-
- // post css
- postcss: [autoprefixer({browsers: ['last 2 versions']})],
-
- // load plugins
- plugins: [
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery',
- _: 'lodash',
- nv: 'nvd3'
- }),
- new webpack.DefinePlugin({'NODE_ENV': JSON.stringify(NODE_ENV)}),
- new webpack.NoErrorsPlugin(),
- new webpack.optimize.AggressiveMergingPlugin({moveToParents: true}),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'common',
- async: true,
- children: true,
- minChunks: Infinity
- }),
-
- // new Manifest(path.join(_path + '/config', 'manifest.json'), {
- // rootAssetPath: rootAssetPath,
- // ignorePaths: ['.DS_Store']
- // }),
- new ExtractTextPlugin('assets/css/[name]' + (IS_DEVELOPMENT ? '' : '.[chunkhash]') + '.css', {allChunks: true}),
- progressPlugin
- ]
- };
-
- return webpackConfig;
-};
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/webpack/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/index.js b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/index.js
new file mode 100644
index 0000000..25eda4c
--- /dev/null
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/index.js
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+import _ from 'lodash';
+import commonConfig from './common';
+import devConfig from './environments/development';
+import prodConfig from './environments/production';
+
+const ENV = process.env.NODE_ENV ? process.env.NODE_ENV : 'production';
+
+const configs = {
+ // Common config section.
+ common: commonConfig,
+
+ // Config by environments.
+ production: prodConfig,
+ development: devConfig
+};
+
+// Load config file by environment
+export default _.merge(configs.common(), configs[ENV]());
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/gulpfile.babel.js/webpack/plugins/progress.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/plugins/progress.js b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/plugins/progress.js
index b6f21b9..5258059 100644
--- a/modules/web-console/src/main/js/gulpfile.babel.js/webpack/plugins/progress.js
+++ b/modules/web-console/src/main/js/gulpfile.babel.js/webpack/plugins/progress.js
@@ -1,22 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
import ProgressPlugin from 'webpack/lib/ProgressPlugin';
let chars = 0,
lastState, lastStateTime;
+const outputStream = process.stdout;
+
const _goToLineStart = (nextMessage) => {
- var str = "";
+ let str = "";
for (; chars > nextMessage.length; chars--) {
str += "\b \b";
}
+
chars = nextMessage.length;
+
for (var i = 0; i < chars; i++) {
str += "\b";
}
- if (str) process.stderr.write(str);
+ if (str)
+ outputStream.write(str);
};
export default new ProgressPlugin((percentage, msg) => {
- var state = msg;
+ let state = msg;
+
if (percentage < 1) {
percentage = Math.floor(percentage * 100);
msg = percentage + "% " + msg;
@@ -27,21 +50,27 @@ export default new ProgressPlugin((percentage, msg) => {
msg = " " + msg;
}
}
+
state = state.replace(/^\d+\/\d+\s+/, "");
+
if (percentage === 0) {
lastState = null;
lastStateTime = +new Date();
- } else if (state !== lastState || percentage === 1) {
- var now = +new Date();
+ }
+ else if (state !== lastState || percentage === 1) {
+ let now = +new Date();
+
if (lastState) {
var stateMsg = (now - lastStateTime) + "ms " + lastState;
_goToLineStart(stateMsg);
- process.stderr.write(stateMsg + "\n");
+ outputStream.write(stateMsg + "\n");
chars = 0;
}
+
lastState = state;
lastStateTime = now;
}
+
_goToLineStart(msg);
- process.stderr.write(msg);
+ outputStream.write(msg);
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/package.json b/modules/web-console/src/main/js/package.json
index 0b46586..1148cc6 100644
--- a/modules/web-console/src/main/js/package.json
+++ b/modules/web-console/src/main/js/package.json
@@ -4,7 +4,7 @@
"description": "Interactive Web console for configuration, executing SQL queries and monitoring of Apache Ignite Cluster",
"private": true,
"scripts": {
- "dev": " NODE_ENV=development node $NODE_DEBUG_OPTION ./node_modules/gulp/bin/gulp.js watch",
+ "dev": "cross-env NODE_ENV=development gulp watch",
"dist": "cross-env NODE_ENV=production gulp build"
},
"author": "",
@@ -50,7 +50,6 @@
"babel-plugin-transform-runtime": "^6.7.5",
"babel-polyfill": "^6.7.4",
"babel-preset-angular": "^6.0.15",
- "babel-preset-es2017": "^1.3.1",
"babel-runtime": "^6.6.1",
"baggage-loader": "^0.2.4",
"body-parser": "^1.15.0",
@@ -83,7 +82,6 @@
"jquery": "^2.1.4",
"json-loader": "^0.5.4",
"jszip": "^2.6.0",
- "less": "^2.7.0",
"lodash": "^4.8.2",
"manifest-revision-webpack-plugin": "~0.1.0",
"mongoose": "^4.4.11",
@@ -109,19 +107,29 @@
"ui-router-metatags": "^1.0.3",
"url": "^0.11.0",
"url-loader": "^0.5.6",
- "webpack": "^1.12.12",
+ "webpack": "^1.13.1",
+ "webpack-dev-server": "^1.14.1",
"ws": "^0.8.0"
},
"devDependencies": {
+ "gulp": "^3.9.1",
"gulp-cached": "^1.1.0",
+ "gulp-connect": "^3.2.2",
+ "gulp-environments": "^0.1.1",
+ "gulp-eslint": "^2.0.0",
+ "gulp-html-replace": "^1.5.5",
+ "gulp-ignore": "^2.0.1",
+ "gulp-inject": "^4.0.0",
+ "gulp-jade": "^1.1.0",
"gulp-rimraf": "^0.2.0",
- "gulp-sequence": "^0.4.5",
+ "gulp-sass": "^2.1.0",
+ "gulp-sequence": "^0.4.1",
+ "gulp-util": "^3.0.7",
"http-proxy-middleware": "^0.13.0",
- "json-loader": "^0.5.4",
+ "less": "^2.7.1",
"mocha": "~2.4.5",
"morgan": "^1.7.0",
"should": "^8.3.0",
- "supertest": "^1.1.0",
- "webpack-dev-server": "1.14.0"
+ "supertest": "^1.1.0"
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/views/index.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/views/index.jade b/modules/web-console/src/main/js/views/index.jade
index 757f281..db4bf99 100644
--- a/modules/web-console/src/main/js/views/index.jade
+++ b/modules/web-console/src/main/js/views/index.jade
@@ -30,8 +30,6 @@ html(ng-app='ignite-console' id='app' ng-strict-di)
meta(name='keywords' content='{{$meta.keywords}}')
meta(ng-repeat='(key, value) in $meta.properties' name='{{::key}}' content='{{::value}}')
-
-
= '{% if (o.htmlWebpackPlugin.files.favicon) { %}'
link(rel='shortcut icon' href='{%=o.htmlWebpackPlugin.files.favicon%}')
= '{% } %}'
@@ -40,11 +38,6 @@ html(ng-app='ignite-console' id='app' ng-strict-di)
link(href='{%=o.htmlWebpackPlugin.files.css[css] %}' rel='stylesheet')
= '{% } %}'
-
- = '{% for (var chunk in o.htmlWebpackPlugin.files.chunks) { %}'
- script(src='{%=o.htmlWebpackPlugin.files.chunks[chunk].entry %}')
- = '{% } %}'
-
body.theme-line.body-overlap.greedy
.splash.splash-max-foreground(hide-on-state-change)
@@ -62,3 +55,8 @@ html(ng-app='ignite-console' id='app' ng-strict-di)
label {{IgniteDemoMode ? "Demo" : "Beta" }}
.wrapper(ui-view='')
+
+
+ = '{% for (var chunk in o.htmlWebpackPlugin.files.chunks) { %}'
+ script(src='{%=o.htmlWebpackPlugin.files.chunks[chunk].entry %}')
+ = '{% } %}'
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/af05c35c/modules/web-console/src/main/js/webpack.config.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/webpack.config.js b/modules/web-console/src/main/js/webpack.config.js
deleted file mode 100644
index b706876..0000000
--- a/modules/web-console/src/main/js/webpack.config.js
+++ /dev/null
@@ -1,28 +0,0 @@
-'use strict';
-
-var _ = require('lodash');
-var _configs = {
-
- // global section
- global: require(__dirname + '/gulpfile.babel.js/webpack/global'),
-
- // config by enviroments
- production: require(__dirname + '/gulpfile.babel.js/webpack/environments/production'),
- development: require(__dirname + '/gulpfile.babel.js/webpack/environments/development')
-};
-
-var _load = function() {
- var ENV = process.env.NODE_ENV
- ? process.env.NODE_ENV
- : 'production';
-
- console.log('Current Environment: ', ENV);
-
- // load config file by environment
- return _configs && _.merge(
- _configs.global(__dirname),
- _configs[ENV](__dirname)
- );
-};
-
-module.exports = _load();