You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/31 09:23:01 UTC
[11/51] ignite git commit: IGNITE-5200 Reworked webpack build.
IGNITE-5200 Reworked webpack build.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/88fd1a63
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/88fd1a63
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/88fd1a63
Branch: refs/heads/ignite-5075-pds
Commit: 88fd1a63f0fe8b856cbb42c750a9f3b4efced530
Parents: 52e14ac
Author: Andrey Novikov <an...@gridgain.com>
Authored: Mon May 29 10:11:24 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Mon May 29 10:11:24 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/.babelrc | 9 +-
modules/web-console/frontend/.gitignore | 1 -
modules/web-console/frontend/app/app.js | 18 +-
.../components/web-console-header/component.js | 6 +-
.../app/modules/agent/AgentManager.service.js | 2 -
.../frontend/gulpfile.babel.js/index.js | 26 ---
.../frontend/gulpfile.babel.js/paths.js | 64 ------
.../frontend/gulpfile.babel.js/tasks/build.js | 21 --
.../frontend/gulpfile.babel.js/tasks/bundle.js | 36 ----
.../frontend/gulpfile.babel.js/tasks/clean.js | 32 ---
.../frontend/gulpfile.babel.js/tasks/copy.js | 33 ---
.../gulpfile.babel.js/tasks/ignite-modules.js | 55 -----
.../frontend/gulpfile.babel.js/tasks/watch.js | 30 ---
.../gulpfile.babel.js/webpack/common.js | 205 -------------------
.../webpack/environments/development.js | 60 ------
.../webpack/environments/production.js | 41 ----
.../webpack/environments/test.js | 44 ----
.../frontend/gulpfile.babel.js/webpack/index.js | 36 ----
.../frontend/ignite_modules/index.js | 7 +-
modules/web-console/frontend/package.json | 104 ++++------
.../frontend/test/karma.conf.babel.js | 13 +-
modules/web-console/frontend/test/karma.conf.js | 2 +-
.../frontend/webpack/webpack.common.js | 188 +++++++++++++++++
.../frontend/webpack/webpack.dev.babel.js | 100 +++++++++
.../frontend/webpack/webpack.prod.babel.js | 64 ++++++
.../frontend/webpack/webpack.test.js | 33 +++
26 files changed, 449 insertions(+), 781 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/.babelrc
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.babelrc b/modules/web-console/frontend/.babelrc
index a1d48c1..da16f08 100644
--- a/modules/web-console/frontend/.babelrc
+++ b/modules/web-console/frontend/.babelrc
@@ -1,9 +1,4 @@
{
- "presets": ["angular"],
- "plugins": [[
- "transform-builtin-extend", {
- "globals": ["Error", "Array"],
- "approximate": true
- }
- ]]
+ "presets": ["es2015", "stage-1"],
+ "plugins": ["add-module-exports"]
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/.gitignore
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.gitignore b/modules/web-console/frontend/.gitignore
index 27138f6..296d61c 100644
--- a/modules/web-console/frontend/.gitignore
+++ b/modules/web-console/frontend/.gitignore
@@ -4,5 +4,4 @@
.npmrc
build/*
node_modules
-ignite_modules_temp/*
public/stylesheets/*.css
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index e32b1ad..df58f0e 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -103,11 +103,11 @@ import hasPojo from './filters/hasPojo.filter';
import uiGridSubcategories from './filters/uiGridSubcategories.filter';
// Controllers
-import caches from 'controllers/caches-controller';
-import clusters from 'controllers/clusters-controller';
-import domains from 'controllers/domains-controller';
-import igfs from 'controllers/igfs-controller';
-import profile from 'controllers/profile-controller';
+import caches from '../controllers/caches-controller';
+import clusters from '../controllers/clusters-controller';
+import domains from '../controllers/domains-controller';
+import igfs from '../controllers/igfs-controller';
+import profile from '../controllers/profile-controller';
import auth from './controllers/auth.controller';
import resetPassword from './controllers/reset-password.controller';
@@ -121,7 +121,7 @@ import webConsoleFooter from './components/web-console-footer';
import igniteIcon from './components/ignite-icon';
// Inject external modules.
-import 'ignite_modules_temp/index';
+import IgniteModules from 'IgniteModules/index';
import baseTemplate from 'views/base.pug';
@@ -175,12 +175,12 @@ angular
'ignite-console.loading',
// Ignite configuration module.
'ignite-console.config',
- // Ignite modules.
- 'ignite-console.modules',
// Components
webConsoleHeader.name,
webConsoleFooter.name,
- igniteIcon.name
+ igniteIcon.name,
+ // Ignite modules.
+ IgniteModules.name
])
// Directives.
.directive(...igniteAutoFocus)
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/app/components/web-console-header/component.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/web-console-header/component.js b/modules/web-console/frontend/app/components/web-console-header/component.js
index 339ec46..364037f 100644
--- a/modules/web-console/frontend/app/components/web-console-header/component.js
+++ b/modules/web-console/frontend/app/components/web-console-header/component.js
@@ -21,7 +21,7 @@ import './style.scss';
export default {
template,
controller: class {
- static $inject = ['$scope', '$state', 'IgniteBranding'];
+ static $inject = ['$rootScope', '$scope', '$state', 'IgniteBranding'];
static webAgentDownloadVisibleStates = [
'base.configuration',
@@ -29,8 +29,8 @@ export default {
'base.settings'
];
- constructor($scope, $state, branding) {
- Object.assign(this, {$scope, $state, branding});
+ constructor($rootScope, $scope, $state, branding) {
+ Object.assign(this, {$rootScope, $scope, $state, branding});
}
$onInit() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
index c511242..3344ef2 100644
--- a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
+++ b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
@@ -15,8 +15,6 @@
* limitations under the License.
*/
-import io from 'socket.io-client'; // eslint-disable-line no-unused-vars
-
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
const maskNull = (val) => _.isNil(val) ? 'null' : val;
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/index.js b/modules/web-console/frontend/gulpfile.babel.js/index.js
deleted file mode 100644
index 95602a1..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/index.js
+++ /dev/null
@@ -1,26 +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 requireDir from 'require-dir';
-
-// Require all tasks in gulpfile.js/tasks, including subfolders.
-requireDir('./tasks', { recurse: true });
-
-// Default no-arg task.
-gulp.task('default', ['build']);
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/paths.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/paths.js b/modules/web-console/frontend/gulpfile.babel.js/paths.js
deleted file mode 100644
index 0007c18..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/paths.js
+++ /dev/null
@@ -1,64 +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 path from 'path';
-
-const rootDir = path.resolve('./');
-const srcDir = path.resolve('app');
-const destDir = path.resolve('build');
-
-const igniteModulesDir = process.env.IGNITE_MODULES ? path.join(path.normalize(process.env.IGNITE_MODULES), 'frontend') : './ignite_modules';
-const igniteModulesTemp = path.resolve('ignite_modules_temp');
-
-const appModulePaths = [
- igniteModulesDir + '/index.js',
- igniteModulesDir + '/**/main.js',
- igniteModulesDir + '/**/module.js',
- igniteModulesDir + '/**/app/modules/*.js',
- igniteModulesDir + '/**/app/modules/**/*.js',
- igniteModulesDir + '/**/app/modules/**/*.pug',
- igniteModulesDir + '/**/*.pug',
- igniteModulesDir + '/**/*.tpl.pug',
- igniteModulesDir + '/**/app/**/*.js',
- igniteModulesDir + '/**/app/**/*.css',
- igniteModulesDir + '/**/app/**/*.scss',
- igniteModulesDir + '/**/app/data/*.json'
-];
-
-const resourcePaths = [
- './public/**/*.svg',
- './public/**/*.png',
- './public/*.ico'
-];
-
-const resourceModulePaths = [
- igniteModulesDir + '/**/images/*.png',
- igniteModulesDir + '/**/images/*.svg',
- igniteModulesDir + '/*.ico'
-];
-
-export {
- rootDir,
- srcDir,
- destDir,
- igniteModulesDir,
- igniteModulesTemp,
-
- resourcePaths,
- resourceModulePaths,
- appModulePaths
-};
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/tasks/build.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/tasks/build.js b/modules/web-console/frontend/gulpfile.babel.js/tasks/build.js
deleted file mode 100644
index 149b076..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/tasks/build.js
+++ /dev/null
@@ -1,21 +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 sequence from 'gulp-sequence';
-
-gulp.task('build', (cb) => sequence(['clean', 'clean:ignite-modules-temp'], 'ignite:modules', ['copy:resource'], 'bundle', cb));
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js b/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js
deleted file mode 100644
index d42a711..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js
+++ /dev/null
@@ -1,36 +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 webpack from 'webpack';
-import webpackConfig from '../webpack';
-import WebpackDevServer from 'webpack-dev-server';
-
-gulp.task('bundle', (cb) => {
- const devServerConfig = webpackConfig.devServer;
-
- delete webpackConfig.devServer;
-
- if (process.env.NODE_ENV === 'development') {
- // Important! Call webpack and WebpackDevServer must be inline.
- new WebpackDevServer(webpack(webpackConfig), devServerConfig)
- .listen(devServerConfig.port, devServerConfig.host, cb);
- }
- else
- webpack(webpackConfig, cb);
-});
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/tasks/clean.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/tasks/clean.js b/modules/web-console/frontend/gulpfile.babel.js/tasks/clean.js
deleted file mode 100644
index c9104b2..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/tasks/clean.js
+++ /dev/null
@@ -1,32 +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 clean from 'gulp-rimraf';
-
-import { destDir, igniteModulesTemp } from '../paths';
-
-// Clean build folder, remove files.
-gulp.task('clean', () =>
- gulp.src(`${destDir}/*`, {read: false})
- .pipe(clean({ force: true }))
-);
-
-gulp.task('clean:ignite-modules-temp', () =>
- gulp.src(igniteModulesTemp, {read: false})
- .pipe(clean({ force: true }))
-);
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/tasks/copy.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/tasks/copy.js b/modules/web-console/frontend/gulpfile.babel.js/tasks/copy.js
deleted file mode 100644
index 59373a8..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/tasks/copy.js
+++ /dev/null
@@ -1,33 +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 sequence from 'gulp-sequence';
-
-import { destDir, resourcePaths, resourceModulePaths } from '../paths';
-
-gulp.task('copy:resource', (cb) => sequence('copy:resource:app', 'copy:resource:ignite_modules', cb));
-
-gulp.task('copy:resource:app', () =>
- gulp.src(resourcePaths)
- .pipe(gulp.dest(destDir))
-);
-
-gulp.task('copy:resource:ignite_modules', () =>
- gulp.src(resourceModulePaths)
- .pipe(gulp.dest(`${destDir}/ignite_modules`))
-);
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/tasks/ignite-modules.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/tasks/ignite-modules.js b/modules/web-console/frontend/gulpfile.babel.js/tasks/ignite-modules.js
deleted file mode 100644
index b97de7c..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/tasks/ignite-modules.js
+++ /dev/null
@@ -1,55 +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 inject from 'gulp-inject';
-import clean from 'gulp-rimraf';
-import sequence from 'gulp-sequence';
-import {appModulePaths, igniteModulesTemp} from '../paths';
-
-gulp.task('ignite:modules', (cb) => sequence('ignite:modules:copy', 'ignite:modules:inject', cb));
-
-gulp.task('ignite:modules:copy', () =>
- gulp.src(appModulePaths)
- .pipe(gulp.dest(igniteModulesTemp))
-);
-
-gulp.task('ignite:modules:inject', () =>
- gulp.src(`${igniteModulesTemp}/index.js`)
- .pipe(inject(gulp.src([`${igniteModulesTemp}/**/main.js`]), {
- starttag: '/* ignite:modules */',
- endtag: '/* endignite */',
- transform: (filePath) => {
- const igniteModuleName = filePath.replace(/.*ignite_modules_temp\/([^\/]+).*/mgi, '$1');
-
- // Return file contents as string.
- return `import './${igniteModuleName}/main';`;
- }
- }))
- .pipe(inject(gulp.src([`${igniteModulesTemp}/**/main.js`]), {
- starttag: '/* ignite-console:modules */',
- endtag: '/* endignite */',
- transform: (filePath, file, i) => {
- const igniteModuleName = filePath.replace(/.*ignite_modules_temp\/([^\/]+).*/mgi, '$1');
-
- // Return file contents as string.
- return (i ? ',' : '') + `'ignite-console.${igniteModuleName}'`;
- }
- }))
- .pipe(clean({force: true}))
- .pipe(gulp.dest(igniteModulesTemp))
-);
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/tasks/watch.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/tasks/watch.js b/modules/web-console/frontend/gulpfile.babel.js/tasks/watch.js
deleted file mode 100644
index 9a02b88..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/tasks/watch.js
+++ /dev/null
@@ -1,30 +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 sequence from 'gulp-sequence';
-
-import { resourcePaths, resourceModulePaths, appModulePaths } from '../paths';
-
-gulp.task('watch:ignite-modules', (cb) => sequence('clean:ignite-modules-temp', 'ignite:modules', cb));
-
-// Build + watch task.
-gulp.task('watch', ['build'], () => {
- gulp.watch(resourcePaths, ['copy:resource:app']);
- gulp.watch(resourceModulePaths, ['copy:resource:ignite_modules']);
- gulp.watch(appModulePaths, ['watch:ignite-modules']);
-});
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js
deleted file mode 100644
index 75b0ef4..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js
+++ /dev/null
@@ -1,205 +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 path from 'path';
-import fs from 'fs';
-import webpack from 'webpack';
-
-import ProgressBarPlugin from 'progress-bar-webpack-plugin';
-import eslintFormatter from 'eslint-friendly-formatter';
-
-import HtmlWebpackPlugin from 'html-webpack-plugin';
-
-import ExtractTextPlugin from 'extract-text-webpack-plugin';
-
-import {srcDir, destDir, rootDir, igniteModulesDir} from '../paths';
-
-const viewsDir = path.resolve('views');
-const imagesDir = path.resolve('public/images');
-const iconsDir = path.resolve('public/images/icons');
-
-const NODE_ENV = process.env.NODE_ENV || 'production';
-const development = NODE_ENV === 'development';
-const node_modules_path = path.resolve('node_modules');
-
-let favicon = 'build/ignite_modules/favicon.ico';
-
-try {
- fs.accessSync(path.join(igniteModulesDir, 'favicon.ico'), fs.F_OK);
-} catch (ignore) {
- favicon = 'build/favicon.ico';
-}
-
-export default {
- cache: true,
- node: {
- fs: 'empty'
- },
- // Entry points.
- entry: {
- polyfill: 'babel-polyfill',
- vendor: path.join(srcDir, 'vendor.js'),
- app: path.join(srcDir, 'app.js')
- },
-
- // Output system.
- output: {
- path: destDir,
- filename: '[name].js'
- },
-
- // Resolves modules.
- resolve: {
- extensions: [
- '.js'
- ],
- modules: [
- srcDir,
- rootDir,
- node_modules_path
- ],
- // A list of module source folders.
- alias: {
- app: srcDir,
- views: viewsDir,
- images: imagesDir
- }
- },
-
- // Resolve loader use postfix.
- resolveLoader: {
- moduleExtensions: ['-loader']
- },
-
- module: {
- rules: [
- {
- test: /\.json$/,
- loader: 'json'
- },
-
- // Exclude tpl.pug files to import in bundle.
- {
- test: /^(?:(?!tpl\.pug$).)*\.pug$/, // TODO: check this regexp for correct.
- loader: `pug-html?basedir=${rootDir}`
- },
-
- // Render .tpl.pug files to assets folder.
- {
- test: /\.tpl\.pug$/,
- use: [
- 'file?exports=false&name=assets/templates/[name].[hash].html',
- `pug-html?exports=false&basedir=${rootDir}`
- ]
- },
- {
- test: /\.js$/,
- enforce: 'pre',
- exclude: [node_modules_path],
- use: [{
- loader: 'eslint',
- options: {
- failOnWarning: false,
- failOnError: false,
- formatter: eslintFormatter
- }
- }]
- },
- {
- test: /\.js$/,
- exclude: [node_modules_path],
- use: [{
- loader: 'babel',
- options: {
- cacheDirectory: true,
- plugins: [
- 'transform-runtime',
- 'add-module-exports'
- ],
- presets: ['angular']
- }
- }]
- },
- {
- test: /\.css$/,
- use: development ? ['style', 'css'] : ExtractTextPlugin.extract({
- fallback: 'style',
- use: ['css']
- })
- },
- {
- test: /\.scss$/,
- use: development ? ['style', 'css', 'sass'] : ExtractTextPlugin.extract({
- fallback: 'style-loader',
- use: ['css', 'sass']
- })
- },
- {
- test: /\.(ttf|eot|svg|woff(2)?)(\?v=[\d.]+)?(\?[a-z0-9#-]+)?$/,
- exclude: [iconsDir],
- loader: 'file?name=assets/fonts/[name].[ext]'
- },
- {
- test: /.*\.svg$/,
- include: [iconsDir],
- use: ['svg-sprite-loader']
- },
- {
- test: /\.(jpe?g|png|gif)$/i,
- loader: 'file?name=assets/images/[name]_[hash].[ext]'
- },
- {
- test: require.resolve('jquery'),
- use: [
- 'expose-loader?$',
- 'expose-loader?jQuery'
- ]
- },
- {
- test: require.resolve('nvd3'),
- use: ['expose-loader?nv']
- }
- ]
- },
-
- // Load plugins.
- plugins: [
- new webpack.LoaderOptionsPlugin({
- options: {
- pug: {
- basedir: rootDir
- },
- target: 'web'
- }
- }),
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery',
- _: 'lodash',
- nv: 'nvd3'
- }),
- new webpack.DefinePlugin({NODE_ENV: JSON.stringify(NODE_ENV)}),
- new webpack.optimize.CommonsChunkPlugin({name: 'vendor'}),
- new webpack.optimize.AggressiveMergingPlugin({moveToParents: true}),
- new HtmlWebpackPlugin({
- template: './views/index.pug',
- favicon
- }),
- new ExtractTextPlugin({filename: 'assets/css/[name].css', allChunks: true}),
- new ProgressBarPlugin()
- ]
-};
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
deleted file mode 100644
index 28ecc13..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
+++ /dev/null
@@ -1,60 +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 {destDir} from '../../paths';
-
-const backendPort = 3000;
-const devServerPort = process.env.PORT || 9000;
-const devServerHost = process.env.HOST || '0.0.0.0';
-
-export default {
- devtool: 'source-map',
- watch: true,
- devServer: {
- compress: true,
- historyApiFallback: true,
- contentBase: destDir,
- // hot: true,
- inline: true,
- proxy: {
- '/socket.io': {
- target: `http://localhost:${backendPort}`,
- ws: true
- },
- '/agents': {
- target: `http://localhost:${backendPort}`,
- ws: true
- },
- '/api/v1/*': {
- target: `http://localhost:${backendPort}`,
- pathRewrite: {
- '^/api/v1': ''
- }
- }
- },
- watchOptions: {
- aggregateTimeout: 1000,
- poll: 2000
- },
- stats: {
- colors: true,
- chunks: false
- },
- host: devServerHost,
- port: devServerPort
- }
-};
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js
deleted file mode 100644
index cbbe9ca..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js
+++ /dev/null
@@ -1,41 +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 webpack from 'webpack';
-
-import {destDir} from '../../paths';
-
-const plugins = [
- new webpack.optimize.UglifyJsPlugin({
- path: destDir,
- minimize: true,
- warnings: false,
- sourceMap: false,
- mangle: true
- })
-];
-
-export default {
- bail: true, // Cancel build on error.
- devtool: 'cheap-source-map',
- output: {
- publicPath: '/',
- filename: '[name].[chunkhash].js'
- },
- plugins
-};
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/test.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/test.js
deleted file mode 100644
index 0cb9b77..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/test.js
+++ /dev/null
@@ -1,44 +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 webpack from 'webpack';
-
-const NODE_ENV = process.env.NODE_ENV || 'production';
-
-export default {
- cache: true,
- node: {
- fs: 'empty'
- },
-
- // Entry points.
- entry: null,
-
- // Output system.
- output: null,
-
- // Load plugins.
- plugins: [
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery',
- _: 'lodash',
- nv: 'nvd3'
- }),
- new webpack.DefinePlugin({NODE_ENV: JSON.stringify(NODE_ENV)})
- ]
-};
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/gulpfile.babel.js/webpack/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/index.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/index.js
deleted file mode 100644
index 3caf06c..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/index.js
+++ /dev/null
@@ -1,36 +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 _ from 'lodash';
-import commonConfig from './common';
-import devConfig from './environments/development';
-import prodConfig from './environments/production';
-
-// TODO check test config
-import testConfig from './environments/test';
-
-const env = process.env.NODE_ENV || 'production';
-
-// Config by environments.
-const configs = {
- production: prodConfig,
- development: devConfig,
- test: testConfig
-};
-
-// Load config file by environment
-export default _.merge(commonConfig, configs[env]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/ignite_modules/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/ignite_modules/index.js b/modules/web-console/frontend/ignite_modules/index.js
index c38d2d4..21ccf6a 100644
--- a/modules/web-console/frontend/ignite_modules/index.js
+++ b/modules/web-console/frontend/ignite_modules/index.js
@@ -17,11 +17,6 @@
import angular from 'angular';
-/* ignite:modules */
-/* endignite */
-
-angular
+export default angular
.module('ignite-console.modules', [
- /* ignite-console:modules */
- /* endignite */
]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index 31a34f2..b20089a 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -4,10 +4,11 @@
"description": "Interactive Web console for configuration, executing SQL queries and monitoring of Apache Ignite Cluster",
"private": true,
"scripts": {
- "dev": "cross-env NODE_ENV=development gulp watch",
- "build": "cross-env NODE_ENV=production gulp build",
- "test": "cross-env NODE_ENV=test karma start ./test/karma.conf.js",
- "eslint": "eslint --format node_modules/eslint-friendly-formatter gulpfile.babel.js/ app/ controllers/ ignite_modules/ ignite_modules_temp/ -- --eff-by-issue"
+ "start": "webpack-dev-server --config ./webpack/webpack.dev.babel.js",
+ "dev": "npm start",
+ "build": "webpack --config ./webpack/webpack.prod.babel.js",
+ "test": "karma start ./test/karma.conf.js",
+ "eslint": "eslint --format node_modules/eslint-friendly-formatter gulpfile.babel.js/ app/ controllers/ ignite_modules/ -- --eff-by-issue"
},
"author": "",
"contributors": [
@@ -20,8 +21,8 @@
"keywords": "grid",
"homepage": "https://ignite.apache.org/",
"engines": {
- "npm": "^3.x.x",
- "node": "^4.x.x"
+ "npm": "3.x.x",
+ "node": "4.x.x"
},
"os": [
"darwin",
@@ -48,55 +49,57 @@
"angular-tree-control": "0.2.28",
"angular-ui-grid": "4.0.4",
"angular-ui-router": "0.4.2",
+ "babel-core": "6.24.1",
+ "babel-eslint": "7.2.3",
+ "babel-loader": "7.0.0",
+ "babel-plugin-add-module-exports": "0.2.1",
+ "babel-plugin-transform-runtime": "6.23.0",
+ "babel-polyfill": "6.23.0",
+ "babel-preset-es2015": "6.24.1",
+ "babel-preset-stage-1": "6.24.1",
+ "babel-runtime": "6.23.0",
"bootstrap-sass": "3.3.7",
"brace": "0.10.0",
- "es6-promise": "4.1.0",
+ "copy-webpack-plugin": "4.0.1",
+ "css-loader": "0.28.3",
+ "eslint": "3.19.0",
+ "eslint-friendly-formatter": "3.0.0",
+ "eslint-loader": "1.7.1",
+ "expose-loader": "0.7.3",
+ "extract-text-webpack-plugin": "2.1.0",
+ "file-loader": "0.11.1",
"file-saver": "1.3.3",
"font-awesome": "4.7.0",
- "glob": "7.1.1",
+ "glob": "7.1.2",
+ "html-loader": "0.4.5",
+ "html-webpack-plugin": "2.28.0",
"jquery": "3.2.1",
+ "json-loader": "0.5.4",
"jszip": "3.1.3",
"lodash": "4.17.4",
+ "node-sass": "4.5.3",
"nvd3": "1.8.4",
+ "progress-bar-webpack-plugin": "1.9.3",
+ "pug-html-loader": "1.1.0",
+ "pug-loader": "2.3.0",
"raleway-webfont": "3.0.1",
+ "resolve-url-loader": "2.0.2",
"roboto-font": "0.1.0",
"rxjs": "5.4.0",
+ "sass-loader": "6.0.5",
"socket.io-client": "1.7.3",
- "ui-router-metatags": "1.0.3"
+ "style-loader": "0.18.1",
+ "svg-sprite-loader": "^3.0.2",
+ "ui-router-metatags": "1.0.3",
+ "webpack": "2.6.1",
+ "webpack-dev-server": "2.4.5",
+ "webpack-merge": "4.1.0",
+ "worker-loader": "0.8.0"
},
"devDependencies": {
- "assets-webpack-plugin": "3.5.1",
- "autoprefixer": "6.7.7",
- "babel-core": "6.24.1",
- "babel-eslint": "7.2.1",
- "babel-loader": "6.4.1",
- "babel-plugin-add-module-exports": "0.2.1",
- "babel-plugin-transform-builtin-extend": "1.1.2",
- "babel-plugin-transform-runtime": "6.23.0",
- "babel-polyfill": "6.23.0",
- "babel-preset-angular": "6.0.15",
- "babel-preset-es2015": "6.24.1",
- "babel-runtime": "6.23.0",
"chai": "3.5.0",
- "cross-env": "4.0.0",
- "css-loader": "0.28.0",
- "eslint": "3.19.0",
- "eslint-friendly-formatter": "2.0.7",
- "eslint-loader": "1.7.1",
- "expose-loader": "0.7.3",
- "extract-text-webpack-plugin": "2.1.0",
- "file-loader": "0.11.1",
- "gulp": "3.9.1",
- "gulp-eslint": "3.0.1",
- "gulp-inject": "4.2.0",
- "gulp-rimraf": "0.2.1",
- "gulp-sequence": "0.4.6",
- "gulp-util": "3.0.8",
- "html-loader": "0.4.5",
- "html-webpack-plugin": "2.28.0",
- "jasmine-core": "2.5.2",
- "json-loader": "0.5.4",
- "karma": "1.6.0",
+ "jasmine-core": "2.6.2",
+ "karma": "1.7.0",
"karma-babel-preprocessor": "6.0.1",
"karma-jasmine": "1.1.0",
"karma-mocha": "1.3.0",
@@ -104,25 +107,8 @@
"karma-phantomjs-launcher": "1.0.4",
"karma-teamcity-reporter": "1.0.0",
"karma-webpack": "2.0.3",
- "mocha": "3.2.0",
+ "mocha": "3.4.2",
"mocha-teamcity-reporter": "1.1.1",
- "ngtemplate-loader": "1.3.1",
- "node-sass": "4.5.2",
- "phantomjs-prebuilt": "2.1.14",
- "postcss-loader": "1.3.3",
- "progress-bar-webpack-plugin": "1.9.3",
- "pug-html-loader": "1.1.0",
- "pug-loader": "2.3.0",
- "require-dir": "0.3.1",
- "resolve-url-loader": "2.0.2",
- "sass-loader": "6.0.3",
- "style-loader": "0.16.1",
- "svg-sprite-loader": "2.1.0",
- "url": "0.11.0",
- "url-loader": "0.5.8",
- "webpack": "2.3.3",
- "webpack-dev-server": "2.4.2",
- "webpack-stream": "3.2.0",
- "worker-loader": "0.8.0"
+ "phantomjs-prebuilt": "2.1.14"
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/test/karma.conf.babel.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/test/karma.conf.babel.js b/modules/web-console/frontend/test/karma.conf.babel.js
index aa6b11c..1651c30 100644
--- a/modules/web-console/frontend/test/karma.conf.babel.js
+++ b/modules/web-console/frontend/test/karma.conf.babel.js
@@ -15,21 +15,14 @@
* limitations under the License.
*/
-import webpack from '../gulpfile.babel.js/webpack';
import path from 'path';
-const basePath = path.resolve('./');
-
-// Webpack chunk plugin has to be removed during test runs due to incompatibility issues,
-// otherwise tests would not run at all.
-// https://github.com/webpack-contrib/karma-webpack/issues/24#issuecomment-257613167
-const chunkPluginIndex = webpack.plugins.findIndex((plugin) => plugin.chunkNames);
-webpack.plugins.splice(chunkPluginIndex, 1);
+import testCfg from '../webpack/webpack.test';
export default (config) => {
config.set({
// Base path that will be used to resolve all patterns (eg. files, exclude).
- basePath,
+ basePath: path.resolve('./'),
// Frameworks to use available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],
@@ -53,7 +46,7 @@ export default (config) => {
'test/**/*.js': ['webpack']
},
- webpack,
+ webpack: testCfg,
webpackMiddleware: {
noInfo: true
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/test/karma.conf.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/test/karma.conf.js b/modules/web-console/frontend/test/karma.conf.js
index a8b1b11..e354482 100644
--- a/modules/web-console/frontend/test/karma.conf.js
+++ b/modules/web-console/frontend/test/karma.conf.js
@@ -16,4 +16,4 @@
*/
require('babel-core/register');
-module.exports = require('./karma.conf.babel.js').default;
+module.exports = require('./karma.conf.babel.js');
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/webpack/webpack.common.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/webpack/webpack.common.js b/modules/web-console/frontend/webpack/webpack.common.js
new file mode 100644
index 0000000..ca7f672
--- /dev/null
+++ b/modules/web-console/frontend/webpack/webpack.common.js
@@ -0,0 +1,188 @@
+/*
+ * 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 transformRuntime from 'babel-plugin-transform-runtime';
+import presetEs2015 from 'babel-preset-es2015';
+import presetStage1 from 'babel-preset-stage-1';
+
+import CopyWebpackPlugin from 'copy-webpack-plugin';
+import ExtractTextPlugin from 'extract-text-webpack-plugin';
+import HtmlWebpackPlugin from 'html-webpack-plugin';
+import ProgressBarPlugin from 'progress-bar-webpack-plugin';
+
+const basedir = path.resolve('./');
+const contentBase = path.resolve('public');
+const node_modules = path.resolve('node_modules');
+
+const app = path.resolve('app');
+const IgniteModules = process.env.IGNITE_MODULES ? path.join(process.env.IGNITE_MODULES, 'frontend') : path.resolve('ignite_modules');
+
+export default {
+ cache: true,
+ node: {
+ fs: 'empty'
+ },
+ // Entry points.
+ entry: {
+ polyfill: 'babel-polyfill',
+ vendor: path.join(app, 'vendor.js'),
+ app: path.join(app, 'app.js')
+ },
+
+ // Output system.
+ output: {
+ path: path.resolve('build'),
+ filename: '[name].[chunkhash].js',
+ publicPath: '/',
+ sourceMapFilename: '[name].[chunkhash].map'
+ },
+
+ // Resolves modules.
+ resolve: {
+ modules: [node_modules],
+ // A list of module source folders.
+ alias: {
+ app,
+ images: path.resolve('public/images'),
+ views: path.resolve('views'),
+ IgniteModules
+ }
+ },
+
+ // Resolve loader use postfix.
+ resolveLoader: {
+ modules: [
+ node_modules
+ ],
+ moduleExtensions: ['-loader']
+ },
+
+ module: {
+ rules: [
+ {
+ test: /\.json$/,
+ loader: 'json'
+ },
+ // Exclude tpl.pug files to import in bundle.
+ {
+ test: /^(?:(?!tpl\.pug$).)*\.pug$/, // TODO: check this regexp for correct.
+ loader: `pug-html?basedir=${basedir}`
+ },
+
+ // Render .tpl.pug files to assets folder.
+ {
+ test: /\.tpl\.pug$/,
+ use: [
+ 'file?exports=false&name=assets/templates/[name].[hash].html',
+ `pug-html?exports=false&basedir=${basedir}`
+ ]
+ },
+ {
+ test: /\.js$/,
+ enforce: 'pre',
+ exclude: [node_modules],
+ use: [{
+ loader: 'eslint',
+ options: {
+ failOnWarning: false,
+ failOnError: false,
+ formatter: 'eslint-friendly-formatter'
+ }
+ }]
+ },
+ {
+ test: /\.js$/,
+ exclude: [node_modules],
+ use: [{
+ loader: 'babel-loader',
+ options: {
+ cacheDirectory: true,
+ plugins: [
+ transformRuntime
+ ],
+ presets: [
+ presetEs2015,
+ presetStage1
+ ]
+ }
+ }]
+ },
+ {
+ test: /\.(ttf|eot|svg|woff(2)?)(\?v=[\d.]+)?(\?[a-z0-9#-]+)?$/,
+ exclude: [contentBase],
+ loader: 'file?name=assets/fonts/[name].[ext]'
+ },
+ {
+ test: /.*\.svg$/,
+ include: [contentBase],
+ use: ['svg-sprite-loader']
+ },
+ {
+ test: /\.(jpe?g|png|gif)$/i,
+ loader: 'file?name=assets/images/[name]_[hash].[ext]'
+ },
+ {
+ test: require.resolve('jquery'),
+ use: [
+ 'expose-loader?$',
+ 'expose-loader?jQuery'
+ ]
+ },
+ {
+ test: require.resolve('nvd3'),
+ use: ['expose-loader?nv']
+ }
+ ]
+ },
+
+ // Load plugins.
+ plugins: [
+ new webpack.LoaderOptionsPlugin({
+ options: {
+ pug: {
+ basedir
+ },
+ target: 'web'
+ }
+ }),
+ new webpack.ProvidePlugin({
+ $: 'jquery',
+ jQuery: 'jquery',
+ _: 'lodash',
+ nv: 'nvd3',
+ io: 'socket.io-client'
+ }),
+ new webpack.optimize.AggressiveMergingPlugin({moveToParents: true}),
+ new HtmlWebpackPlugin({
+ template: './views/index.pug'
+ }),
+ new ExtractTextPlugin({filename: 'assets/css/[name].css', allChunks: true}),
+ new CopyWebpackPlugin([
+ { context: 'public', from: '**/*.png' },
+ { context: 'public', from: '**/*.svg' },
+ { context: 'public', from: '**/*.ico' },
+ // Ignite modules.
+ { context: IgniteModules, from: '**/*.png', force: true },
+ { context: IgniteModules, from: '**/*.svg', force: true },
+ { context: IgniteModules, from: '**/*.ico', force: true }
+ ]),
+ new ProgressBarPlugin()
+ ]
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/webpack/webpack.dev.babel.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/webpack/webpack.dev.babel.js b/modules/web-console/frontend/webpack/webpack.dev.babel.js
new file mode 100644
index 0000000..dc5cd41
--- /dev/null
+++ b/modules/web-console/frontend/webpack/webpack.dev.babel.js
@@ -0,0 +1,100 @@
+/*
+ * 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 merge from 'webpack-merge';
+
+import path from 'path';
+
+import commonCfg from './webpack.common';
+
+import ExtractTextPlugin from 'extract-text-webpack-plugin';
+
+const backendPort = process.env.BACKEND_PORT || 3000;
+const devServerPort = process.env.PORT || 9000;
+const devServerHost = process.env.HOST || '0.0.0.0';
+
+export default merge(commonCfg, {
+ devtool: 'source-map',
+ watch: true,
+ module: {
+ rules: [
+ {
+ test: /\.css$/,
+ use: ['style', 'css']
+ },
+ {
+ test: /\.scss$/,
+ // Version without extract plugin fails on some machines. https://github.com/sass/node-sass/issues/1895
+ use: ExtractTextPlugin.extract({
+ fallback: 'style-loader',
+ use: [
+ {
+ loader: 'css',
+ options: {
+ sourceMap: true
+ }
+ },
+ {
+ loader: 'sass',
+ options: {
+ sourceMap: true
+ }
+ }
+ ]
+ })
+ }
+ ]
+ },
+ devServer: {
+ compress: true,
+ historyApiFallback: true,
+ disableHostCheck: true,
+ contentBase: path.resolve('build'),
+ // hot: true,
+ inline: true,
+ proxy: {
+ '/socket.io': {
+ target: `http://localhost:${backendPort}`,
+ ws: true
+ },
+ '/agents': {
+ target: `http://localhost:${backendPort}`,
+ ws: true
+ },
+ '/api/v1/*': {
+ target: `http://localhost:${backendPort}`,
+ pathRewrite: {
+ '^/api/v1': ''
+ }
+ }
+ },
+ watchOptions: {
+ aggregateTimeout: 1000,
+ poll: 2000
+ },
+ stats: {
+ colors: true,
+ chunks: false
+ },
+ host: devServerHost,
+ port: devServerPort
+ },
+ plugins: [
+ new webpack.optimize.CommonsChunkPlugin({name: 'vendor'})
+ ]
+});
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/webpack/webpack.prod.babel.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/webpack/webpack.prod.babel.js b/modules/web-console/frontend/webpack/webpack.prod.babel.js
new file mode 100644
index 0000000..f18a3ba
--- /dev/null
+++ b/modules/web-console/frontend/webpack/webpack.prod.babel.js
@@ -0,0 +1,64 @@
+/*
+ * 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 merge from 'webpack-merge';
+
+import ExtractTextPlugin from 'extract-text-webpack-plugin';
+
+import commonCfg from './webpack.common';
+
+export default merge(commonCfg, {
+ bail: true, // Cancel build on error.
+ devtool: 'cheap-source-map',
+ module: {
+ rules: [
+ {
+ test: /\.css$/,
+ use: ExtractTextPlugin.extract({
+ fallback: 'style',
+ use: ['css']
+ })
+ },
+ {
+ test: /\.scss$/,
+ use: ExtractTextPlugin.extract({
+ fallback: 'style-loader',
+ use: ['css', 'sass']
+ })
+ }
+ ]
+ },
+ plugins: [
+ new webpack.optimize.CommonsChunkPlugin({name: 'vendor'}),
+ new webpack.LoaderOptionsPlugin({
+ minimize: true,
+ debug: false
+ }),
+ new webpack.optimize.UglifyJsPlugin({
+ beautify: false,
+ mangle: {
+ screw_ie8: true,
+ keep_fnames: true
+ },
+ compress: {
+ screw_ie8: true
+ },
+ comments: false
+ })
+ ]
+});
http://git-wip-us.apache.org/repos/asf/ignite/blob/88fd1a63/modules/web-console/frontend/webpack/webpack.test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/webpack/webpack.test.js b/modules/web-console/frontend/webpack/webpack.test.js
new file mode 100644
index 0000000..36d2650
--- /dev/null
+++ b/modules/web-console/frontend/webpack/webpack.test.js
@@ -0,0 +1,33 @@
+/*
+ * 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 merge from 'webpack-merge';
+
+import commonCfg from './webpack.common';
+
+export default merge(commonCfg, {
+ cache: true,
+ node: {
+ fs: 'empty'
+ },
+
+ // Entry points.
+ entry: null,
+
+ // Output system.
+ output: null
+});