From b5dceda99c6bd6ba65d58965839f5b2390261385 Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 28 May 2020 11:48:44 -0600 Subject: [PATCH] Fix js packaging by switching from uglify-es to terser --- Gruntfile.js | 50 ++++++++++++++++++++++++++++++--------------- api/js/jsapi/egw.js | 1 + package.json | 2 ++ updateGruntfile.php | 2 +- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 95f018e1dd..6f0a924319 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -43,12 +43,13 @@ */ module.exports = function (grunt) { grunt.initConfig({ - uglify: { + terser: { options: { - banner: "/*!\n * EGroupware (http://www.egroupware.org/) minified Javascript\n *\n * full sources are available under https://github.com/EGroupware/egroupware/\n *\n * build <%= grunt.template.today() %>\n */\n", mangle: false, sourceMap: true, - screwIE8: true + output: { + preamble: "/*!\n * EGroupware (http://www.egroupware.org/) minified Javascript\n *\n * full sources are available under https://github.com/EGroupware/egroupware/\n *\n * build <%= grunt.template.today() %>\n */\n" + } }, api: { files: { @@ -84,6 +85,7 @@ module.exports = function (grunt) { "api/js/jsapi/egw_notification.js", "api/js/es6-promise.min.js", "api/js/jsapi/app_base.js", + "api/js/jsapi/egw_app.js", "api/js/dhtmlxtree/codebase/dhtmlxcommon.js", "api/js/dhtmlxtree/sources/dhtmlxtree.js", "api/js/dhtmlxtree/sources/ext/dhtmlxtree_json.js", @@ -106,9 +108,9 @@ module.exports = function (grunt) { files: { "api/js/etemplate/etemplate2.min.js": [ "api/js/etemplate/et2_core_xml.js", + "api/js/etemplate/et2_core_interfaces.js", "api/js/etemplate/et2_core_common.js", "api/js/etemplate/et2_core_inheritance.js", - "api/js/etemplate/et2_core_interfaces.js", "api/js/etemplate/et2_core_phpExpressionCompiler.js", "api/js/etemplate/et2_core_arrayMgr.js", "api/js/etemplate/et2_core_widget.js", @@ -148,20 +150,20 @@ module.exports = function (grunt) { "vendor/egroupware/magicsuggest/magicsuggest.js", "api/js/etemplate/et2_widget_taglist.js", "api/js/etemplate/et2_extension_customfields.js", - "api/js/etemplate/et2_dataview_interfaces.js", + "api/js/etemplate/et2_dataview_view_rowProvider.js", + "api/js/etemplate/et2_extension_nextmatch_rowProvider.js", "api/js/etemplate/et2_dataview_view_container.js", "api/js/etemplate/et2_dataview_view_row.js", + "api/js/etemplate/et2_dataview_interfaces.js", "vendor/bower-asset/jquery-touchswipe/jquery.touchSwipe.js", "api/js/etemplate/et2_dataview_view_aoi.js", "api/js/etemplate/et2_dataview_controller_selection.js", - "api/js/etemplate/et2_dataview_controller.js", "api/js/etemplate/et2_dataview_view_tile.js", + "api/js/etemplate/et2_dataview_controller.js", "api/js/etemplate/et2_extension_nextmatch_actions.js", "api/js/etemplate/et2_extension_nextmatch_controller.js", - "api/js/etemplate/et2_extension_nextmatch_rowProvider.js", - "api/js/etemplate/et2_extension_nextmatch_dynheight.js", + "api/js/etemplate/et2_widget_dynheight.js", "api/js/etemplate/et2_dataview_model_columns.js", - "api/js/etemplate/et2_dataview_view_rowProvider.js", "api/js/etemplate/et2_dataview_view_spacer.js", "api/js/etemplate/et2_dataview_view_grid.js", "api/js/etemplate/et2_dataview_view_resizeable.js", @@ -208,6 +210,7 @@ module.exports = function (grunt) { calendar: { files: { "calendar/js/app.min.js": [ + "calendar/js/View.js", "calendar/js/et2_widget_owner.js", "calendar/js/et2_widget_view.js", "calendar/js/et2_widget_timegrid.js", @@ -269,9 +272,6 @@ module.exports = function (grunt) { projectmanager: { files: { "projectmanager/js/app.min.js": [ - "vendor/npm-asset/dhtmlx-gantt/codebase/dhtmlxgantt.js", - "vendor/npm-asset/dhtmlx-gantt/codebase/ext/dhtmlxgantt_marker.js", - "projectmanager/js/et2_widget_gantt.js", "projectmanager/js/app.js" ] } @@ -368,6 +368,24 @@ module.exports = function (grunt) { "pixelegg/css/monochrome.css", "api/templates/default/print.css", "pixelegg/print.css" + ], + "pixelegg/css/modern.min.css": [ + "api/js/jquery/chosen/chosen.css", + "vendor/bower-asset/jquery-ui/themes/redmond/jquery-ui.css", + "vendor/egroupware/magicsuggest/magicsuggest.css", + "api/js/jquery/jquery-ui-timepicker-addon.css", + "api/js/jquery/blueimp/css/blueimp-gallery.min.css", + "api/js/dhtmlxtree/codebase/dhtmlxtree.css", + "api/js/egw_action/test/skins/dhtmlxmenu_egw.css", + "vendor/bower-asset/diff2html/dist/diff2html.css", + "vendor/bower-asset/cropper/dist/cropper.min.css", + "api/templates/default/css/flags.css", + "api/templates/default/css/htmlarea.css", + "api/templates/default/def_tutorials.css", + "api/templates/default/etemplate2.css", + "pixelegg/css/pixelegg.css", + "api/templates/default/print.css", + "pixelegg/print.css" ] } }, @@ -447,17 +465,17 @@ module.exports = function (grunt) { } }); // Load the plugin that provides the "uglify" task. - grunt.loadNpmTasks('grunt-contrib-uglify-es'); + grunt.loadNpmTasks("grunt-terser"); // Load plugin for css minificaton - grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks("grunt-contrib-cssmin"); // Load the plugin that runs tasks only on modified files - grunt.loadNpmTasks('grunt-newer'); + grunt.loadNpmTasks("grunt-newer"); // uncomment to run Gruntfile.js in apps / sub-directories //grunt.loadNpmTasks('grunt-hub'); // Default task(s). - grunt.registerTask('default', ['newer:uglify', 'newer:cssmin']);//, 'hub']); + grunt.registerTask("default", ["newer:terser", "newer:cssmin"]);//, 'hub']); }; diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 1da8f58de6..9f6cd859a5 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -34,6 +34,7 @@ egw_message; egw_notification; app_base; + egw_app; */ (function() diff --git a/package.json b/package.json index 85a2f7968e..ef613fb970 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "grunt-contrib-uglify-es": "^3.3.0", "grunt-hub": "^0.7.0", "grunt-newer": "^1.3.0", + "grunt-terser": "^1.0.0", "grunt-ts": "^6.0.0-beta.22", + "terser": "^4.7.0", "typescript": "^3.7.4" } } diff --git a/updateGruntfile.php b/updateGruntfile.php index 95fb00d4dc..d39c351a17 100755 --- a/updateGruntfile.php +++ b/updateGruntfile.php @@ -37,7 +37,7 @@ if (!preg_match('/grunt\.initConfig\(({.+})\);/s', $content, $matches) || } //print_r($config); exit; -$uglify =& $config['uglify']; +$uglify =& $config['terser']; // some files are not in a bundle, because loaded otherwise or are big enough themselfs $exclude = array(