Pārlūkot izejas kodu

HUE-8687 [frontend] Bump versions for webpack and babel to the latest

This also cleans up previously generated bundles
Johan Ahlen 6 gadi atpakaļ
vecāks
revīzija
634bc81b2f

+ 12 - 0
.babelrc

@@ -0,0 +1,12 @@
+{
+  "presets": [
+    [
+      "env",
+      {
+        "targets": {
+          "browsers": ["last 2 versions", "safari >= 7"]
+        }
+      }
+    ]
+  ]
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 57 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle-4b39795494c144680d44.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle-4b39795494c144680d44.js.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 32
desktop/core/src/desktop/static/desktop/js/hue-bundle-88f5760ed32fdd31e59e.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle-88f5760ed32fdd31e59e.js.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 32
desktop/core/src/desktop/static/desktop/js/hue-bundle-d5f45f241629b44678eb.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle-d5f45f241629b44678eb.js.map


+ 1 - 3
desktop/core/src/desktop/static/desktop/js/hue.js

@@ -26,6 +26,4 @@ window._ = _;
 window.$ = $;
 window.ko = ko;
 window.ko.mapping = komapping;
-window.page = page;
-
-console.log('boo');
+window.page = page;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 844 - 142
package-lock.json


+ 23 - 29
package.json

@@ -1,6 +1,6 @@
 {
   "name": "hue",
-  "version": "4.0.0",
+  "version": "4.4.0",
   "description": "Hue is an open source Web interface for analyzing data with Hadoop and Spark",
   "homepage": "http://gethue.com",
   "repository": {
@@ -10,7 +10,6 @@
   "author": "Cloudera, Inc.",
   "contributors": [
     "Andrew Yao <andyao@cloudera.com>",
-    "Enrico Berti <enrico.berti@cloudera.com>",
     "Johan Ahlen <johan.ahlen@cloudera.com>"
   ],
   "license": "Apache",
@@ -19,38 +18,33 @@
     "node": ">=0.10.0"
   },
   "dependencies": {
-    "bootstrap": "3.3.6",
-    "commander": "^2.16.0",
-    "dompurify": "0.8.2",
-    "jquery": "2.1.1",
-    "knockout": "3.4.0",
+    "bootstrap-2.3.2": "1.0.0",
+    "jquery": "2.2.4",
+    "knockout": "3.4.2",
     "knockout.mapping": "2.4.3",
-    "less": "2.6.1",
-    "libxmljs": "^0.19.0",
-    "lodash": "3.10.1",
+    "less": "3.9.0",
     "minimist": "^1.2.0",
-    "mkdirp": "^0.5.1",
-    "page": "^1.7.1",
-    "pubsub.js": "1.4.3",
-    "xml2js": "^0.4.19"
+    "page": "1.11.3"
   },
   "devDependencies": {
-    "architect-build": "0.1.1",
-    "babel-core": "6.22.1",
+    "@babel/core": "7.2.2",
+    "architect-build": "0.1.1", // For building Ace "make ace"
+    "babel-cli": "6.26.0",
     "babel-jscs": "3.0.0-beta1",
-    "babel-loader": "6.2.5",
-    "babel-plugin-transform-es2015-modules-amd": "6.8.0",
-    "babel-plugin-transform-strict-mode": "6.6.5",
-    "babel-preset-es2015": "6.6.0",
-    "dryice": "0.4.11",
-    "expose-loader": "0.7.1",
-    "grunt": "0.4.5",
-    "grunt-contrib-less": "1.3.0",
-    "grunt-contrib-uglify": "^3.0.1",
-    "grunt-contrib-watch": "0.6.1",
-    "load-grunt-tasks": "3.1.0",
-    "webpack": "1.13.1",
-    "webpack-bundle-tracker": "^0.3.0"
+    "babel-loader": "8.0.5",
+    "babel-preset-env": "1.7.0",
+    "babel-preset-es2015": "7.0.0-beta.3",
+    "expose-loader": "0.7.5",
+    "dryice": "0.4.11", // For building Ace "make ace"
+    "grunt": "1.0.3",
+    "grunt-contrib-less": "2.0.0",
+    "grunt-contrib-uglify": "4.0.0",
+    "grunt-contrib-watch": "1.1.0",
+    "load-grunt-tasks": "4.0.0",
+    "webpack": "4.29.0",
+    "webpack-bundle-tracker": "0.4.2-beta",
+    "webpack-cli": "^3.2.1",
+    "webpack-shell-plugin": "^0.5.0"
   },
   "scripts": {
     "devinstall": "npm cache clean && npm install && npm prune",

+ 19 - 0
tools/scripts/clean_js_bundles.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+#
+
+rm $1/desktop/core/src/desktop/static/desktop/js/hue-bundle-*

+ 1 - 1
webpack-stats.json

@@ -1 +1 @@
-{"status":"done","chunks":{"hue":[{"name":"hue-bundle-88f5760ed32fdd31e59e.js","path":"desktop/core/src/desktop/static/desktop/js/hue-bundle-88f5760ed32fdd31e59e.js"},{"name":"hue-bundle-88f5760ed32fdd31e59e.js.map","path":"desktop/core/src/desktop/static/desktop/js/hue-bundle-88f5760ed32fdd31e59e.js.map"}]}}
+{"status":"done","chunks":{"hue":[{"name":"hue-bundle-4b39795494c144680d44.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-4b39795494c144680d44.js"},{"name":"hue-bundle-4b39795494c144680d44.js.map","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-4b39795494c144680d44.js.map"}]}}

+ 19 - 26
webpack.config.js

@@ -1,33 +1,26 @@
-var fs  = require('fs');
 var webpack = require('webpack');
 var BundleTracker = require('webpack-bundle-tracker');
-var path = require('path');
+var WebpackShellPlugin = require('webpack-shell-plugin');
 
-var jqueryShim = new webpack.ProvidePlugin({
+new webpack.ProvidePlugin({
   $: 'jquery',
   jQuery: 'jquery',
   'window.jQuery': 'jquery'
 });
 
-// Note that since we are using 'npm install' and stopped using --legacy-bundling,
-// we are not ensured which version is installed and where. We will try cloudera-ui
-// first, and if it is not there we will let 'require' resolve it. The latter means
-// that a version compatible with cloudera-ui and other libraries was installed at the
-// top of the node_modules directory.
-var lodashDir = path.resolve('node_modules/lodash');
-if (!fs.exists(lodashDir)) {
-  lodashDir = require.resolve('lodash');
-}
-
 module.exports = {
   devtool: 'source-map',
-  progress: true,
-  host: '0.0.0.0',
-  port: '8080',
+  mode: 'development',
+  optimization: {
+    minimize: true
+  },
+  performance: {
+    maxEntrypointSize: 400 * 1024, // 400kb
+    maxAssetSize: 400 * 1024 // 400kb
+  },
   resolve: {
-    extensions: ['', '.json', '.jsx', '.js'],
-
-    modulesDirectories: [
+    extensions: ['.json', '.jsx', '.js'],
+    modules: [
       'node_modules',
       'js',
       'desktop/core/src/desktop/static/desktop/js/cui'
@@ -46,11 +39,11 @@ module.exports = {
     hue: ['./desktop/core/src/desktop/static/desktop/js/hue.js']
   },
   output: {
-    path: './desktop/core/src/desktop/static/desktop/js',
+    path:  __dirname + '/desktop/core/src/desktop/static/desktop/js',
     filename: 'hue-bundle-[hash].js'
   },
   module: {
-    loaders: [
+    rules: [
       { test: /\.(html)$/, loader: 'html?interpolate&removeComments=false' },
       { test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
       { test: /\.css$/, loader: 'style-loader!css-loader' },
@@ -65,8 +58,8 @@ module.exports = {
       },
 
       // expose lodash and jquery for knockout templates to access
-      { test: /lodash$/, loader: 'expose?_' },
-      { test: /jquery/, loader: 'expose?$!expose?jQuery' },
+      { test: /lodash$/, loader: 'expose-loader?_' },
+      { test: /jquery/, loader: 'expose-loader?$!expose-loader?jQuery' },
 
       // needed for moment-timezone
       { include: /\.json$/, loaders: ['json-loader'] }
@@ -74,8 +67,8 @@ module.exports = {
   },
 
   plugins: [
-    new BundleTracker({filename: './webpack-stats.json'}),
-    new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
+    new WebpackShellPlugin({ onBuildStart:[__dirname + '/tools/scripts/clean_js_bundles.sh ' +  __dirname ] }),
+    new BundleTracker({ filename: './webpack-stats.json' }),
     new webpack.BannerPlugin('\nLicensed to Cloudera, Inc. under one\nor more contributor license agreements.  See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership.  Cloudera, Inc. licenses this file\nto you under the Apache License, Version 2.0 (the\n"License"); you may not use this file except in compliance\nwith the License.  You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n'),
   ]
-};
+};

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels