From efe1bd70f5f9f9b46bed97392d2ae1f8151c28fc Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Thu, 25 Oct 2018 14:57:25 -0700 Subject: [PATCH 01/16] Generate and use source maps for debugging uglified code --- build.properties | 2 +- docs/ReleaseNotes.md | 5 ++- js/build.xml | 103 +++++++++++++++++++++++-------------------- js/webpack.config.js | 5 +++ package.json | 8 ++-- 5 files changed, 70 insertions(+), 53 deletions(-) diff --git a/build.properties b/build.properties index 98e3913d58..5ee34b99d7 100644 --- a/build.properties +++ b/build.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -version=14.1.1 +version=14.2.0 diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 20edb438af..45e1c33249 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -3,7 +3,10 @@ Release Notes for Version 14 Build 003 ------- -Published as version 14.1.1 +Published as version 14.2.0 + +New Features: +* Added source maps to the npm package so that you can debug into the original ilib code easily Bug Fixes * Worked around a problem with uglifyjs which optimized out a block of code that contained the comment that diff --git a/js/build.xml b/js/build.xml index 45bcd0d204..07a3697ea3 100644 --- a/js/build.xml +++ b/js/build.xml @@ -287,28 +287,32 @@ limitations under the License. - + - + - - - + + + - - - + + + + + - + - - + + - - + + + + @@ -324,14 +328,16 @@ limitations under the License. - - - + + + - - + + - + + + @@ -348,21 +354,23 @@ limitations under the License. - - - - + + + + - - - - - - - - + + + + + + + + + + @@ -439,25 +447,26 @@ limitations under the License. - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -470,7 +479,7 @@ limitations under the License. - + @@ -513,7 +522,7 @@ limitations under the License. - + diff --git a/js/webpack.config.js b/js/webpack.config.js index 268b1f3362..71a41485be 100644 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -93,6 +93,10 @@ module.exports = function(env, args) { target: target } } + },{ + test: /\.js$/, + use: ["source-map-loader"], + enforce: "pre" }] }, plugins: [ @@ -126,6 +130,7 @@ module.exports = function(env, args) { ret.plugins.splice(0, 0, new UglifyJsPlugin({ cache: true, parallel: 4, + sourceMap: true, uglifyOptions: { compress: true, warnings: true diff --git a/package.json b/package.json index c407b43ee9..2e66f1b47c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ilib", - "version": "14.1.1", + "version": "14.2.0", "main": "js/lib/ilib-node.js", "description": "iLib is a cross-engine library of internationalization (i18n) classes written in pure JS", "keywords": [ @@ -50,7 +50,7 @@ }, "engines": { "ringojs": ">=0.9", - "nodejs": ">= 0.10" + "node": ">= 0.10" }, "devDependencies": { "babel-loader": "^7.1.2", @@ -61,7 +61,7 @@ "grunt-contrib-clean": "^1.1.0", "grunt-contrib-compress": "^1.4.3", "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^3.4.0", + "grunt-contrib-uglify": "~0.5.0", "grunt-eslint": "^21.0.0", "grunt-http-server": "^2.1.0", "grunt-jsdoc": "^2.2.1", @@ -71,13 +71,13 @@ "grunt-contrib-nodeunit": "~0.4.1", "grunt-shell": "^2.1.0", "grunt-text-replace": "^0.4.0", - "grunt-contrib-uglify": "~0.5.0", "http-server": "^0.11.1", "ilib-webpack-loader": "^1.0.2", "ilib-webpack-plugin": "^1.0.2", "iso-15924": "^2.0.0", "jsdoc2": "^2.4.0", "should": ">=11.1.0", + "source-map-loader": "^0.2.4", "tap": "^10.0.2", "trireme": "^0.9.0", "uglify-js": "^3.3.0", From bf67dbd0db8cb348cc0fce50a228a50dc25d617c Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Fri, 26 Oct 2018 09:13:50 -0700 Subject: [PATCH 02/16] Fix the version check unit test --- js/test/root/testglobal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/test/root/testglobal.js b/js/test/root/testglobal.js index 7391b4fe57..15b91ced5a 100644 --- a/js/test/root/testglobal.js +++ b/js/test/root/testglobal.js @@ -70,7 +70,7 @@ module.exports.testglobal = { testGetVersion: function(test) { test.expect(1); - test.equal(ilib.getVersion().substring(0,4), "14.1"); + test.equal(ilib.getVersion().substring(0,4), "14.2"); test.done(); }, From 5d2017cc96290a6327f4501250ec70fb6247f3a4 Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Thu, 25 Oct 2018 14:57:25 -0700 Subject: [PATCH 03/16] Generate and use source maps for debugging uglified code --- build.properties | 2 +- docs/ReleaseNotes.md | 5 ++- js/build.xml | 103 +++++++++++++++++++++++-------------------- js/webpack.config.js | 5 +++ package.json | 8 ++-- 5 files changed, 70 insertions(+), 53 deletions(-) diff --git a/build.properties b/build.properties index 98e3913d58..5ee34b99d7 100644 --- a/build.properties +++ b/build.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -version=14.1.1 +version=14.2.0 diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index e3ee5826f1..cebe182a52 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -3,7 +3,10 @@ Release Notes for Version 14 Build 003 ------- -Published as version 14.1.1 +Published as version 14.2.0 + +New Features: +* Added source maps to the npm package so that you can debug into the original ilib code easily Bug Fixes: * Worked around a problem with uglifyjs which optimized out a block diff --git a/js/build.xml b/js/build.xml index 45bcd0d204..07a3697ea3 100644 --- a/js/build.xml +++ b/js/build.xml @@ -287,28 +287,32 @@ limitations under the License. - + - + - - - + + + - - - + + + + + - + - - + + - - + + + + @@ -324,14 +328,16 @@ limitations under the License. - - - + + + - - + + - + + + @@ -348,21 +354,23 @@ limitations under the License. - - - - + + + + - - - - - - - - + + + + + + + + + + @@ -439,25 +447,26 @@ limitations under the License. - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -470,7 +479,7 @@ limitations under the License. - + @@ -513,7 +522,7 @@ limitations under the License. - + diff --git a/js/webpack.config.js b/js/webpack.config.js index 268b1f3362..71a41485be 100644 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -93,6 +93,10 @@ module.exports = function(env, args) { target: target } } + },{ + test: /\.js$/, + use: ["source-map-loader"], + enforce: "pre" }] }, plugins: [ @@ -126,6 +130,7 @@ module.exports = function(env, args) { ret.plugins.splice(0, 0, new UglifyJsPlugin({ cache: true, parallel: 4, + sourceMap: true, uglifyOptions: { compress: true, warnings: true diff --git a/package.json b/package.json index c407b43ee9..2e66f1b47c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ilib", - "version": "14.1.1", + "version": "14.2.0", "main": "js/lib/ilib-node.js", "description": "iLib is a cross-engine library of internationalization (i18n) classes written in pure JS", "keywords": [ @@ -50,7 +50,7 @@ }, "engines": { "ringojs": ">=0.9", - "nodejs": ">= 0.10" + "node": ">= 0.10" }, "devDependencies": { "babel-loader": "^7.1.2", @@ -61,7 +61,7 @@ "grunt-contrib-clean": "^1.1.0", "grunt-contrib-compress": "^1.4.3", "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^3.4.0", + "grunt-contrib-uglify": "~0.5.0", "grunt-eslint": "^21.0.0", "grunt-http-server": "^2.1.0", "grunt-jsdoc": "^2.2.1", @@ -71,13 +71,13 @@ "grunt-contrib-nodeunit": "~0.4.1", "grunt-shell": "^2.1.0", "grunt-text-replace": "^0.4.0", - "grunt-contrib-uglify": "~0.5.0", "http-server": "^0.11.1", "ilib-webpack-loader": "^1.0.2", "ilib-webpack-plugin": "^1.0.2", "iso-15924": "^2.0.0", "jsdoc2": "^2.4.0", "should": ">=11.1.0", + "source-map-loader": "^0.2.4", "tap": "^10.0.2", "trireme": "^0.9.0", "uglify-js": "^3.3.0", From 79c74e60f14d1f796e1017f147754263f98e127c Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Fri, 26 Oct 2018 09:13:50 -0700 Subject: [PATCH 04/16] Fix the version check unit test --- js/test/root/testglobal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/test/root/testglobal.js b/js/test/root/testglobal.js index 7391b4fe57..15b91ced5a 100644 --- a/js/test/root/testglobal.js +++ b/js/test/root/testglobal.js @@ -70,7 +70,7 @@ module.exports.testglobal = { testGetVersion: function(test) { test.expect(1); - test.equal(ilib.getVersion().substring(0,4), "14.1"); + test.equal(ilib.getVersion().substring(0,4), "14.2"); test.done(); }, From 98556dcb69199386169dc4277816a8a0e19943c8 Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Fri, 26 Oct 2018 10:04:49 -0700 Subject: [PATCH 05/16] Increase the js heap space so travis doesn't puke when running webpack --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b10fa18f2d..1925fcdbcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - sudo apt-get -y install qmlscene qt5-default qtdeclarative5-dev qtbase5-dev - npm install - export PATH=$PWD/node_modules/.bin:$PATH - - export NODE_OPTIONS="--max-old-space-size=3072" + - export NODE_OPTIONS="--max-old-space-size=4096" script: # [Error] module QtQuick is not installed - source /opt/qt55/bin/qt55-env.sh From 60f92ed9287c876676d3b0aab72b222ce790c60d Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Fri, 26 Oct 2018 11:31:32 -0700 Subject: [PATCH 06/16] Increase the java heap space even more --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1925fcdbcf..32d34ddd73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - sudo apt-get -y install qmlscene qt5-default qtdeclarative5-dev qtbase5-dev - npm install - export PATH=$PWD/node_modules/.bin:$PATH - - export NODE_OPTIONS="--max-old-space-size=4096" + - export NODE_OPTIONS="--max-old-space-size=5192" script: # [Error] module QtQuick is not installed - source /opt/qt55/bin/qt55-env.sh From 65aefcbe93e961e961d252fb88f8ba5c200a1881 Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Fri, 26 Oct 2018 13:08:11 -0700 Subject: [PATCH 07/16] Use the heap size in the build.xml instead of the travis yml --- .travis.yml | 2 +- js/build.properties | 1 + js/build.xml | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 32d34ddd73..1925fcdbcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - sudo apt-get -y install qmlscene qt5-default qtdeclarative5-dev qtbase5-dev - npm install - export PATH=$PWD/node_modules/.bin:$PATH - - export NODE_OPTIONS="--max-old-space-size=5192" + - export NODE_OPTIONS="--max-old-space-size=4096" script: # [Error] module QtQuick is not installed - source /opt/qt55/bin/qt55-env.sh diff --git a/js/build.properties b/js/build.properties index 4a3440321d..359c34f41b 100644 --- a/js/build.properties +++ b/js/build.properties @@ -18,3 +18,4 @@ CLOSURECOMP=${basedir}/../tools/google-closure-compiler.r20150920 WEBPACKDIR=${basedir}/../node_modules/webpack uglify.location=${basedir}/../node_modules/uglify-js webpack.command=${basedir}/../node_modules/.bin/webpack +webpack.heap.size=4096 \ No newline at end of file diff --git a/js/build.xml b/js/build.xml index 07a3697ea3..ee75b43a8d 100644 --- a/js/build.xml +++ b/js/build.xml @@ -129,7 +129,7 @@ limitations under the License. executing webpack - + @@ -138,7 +138,7 @@ limitations under the License. - + @@ -583,11 +583,11 @@ limitations under the License. Executing webpack - + - + @@ -596,11 +596,11 @@ limitations under the License. Executing webpack - + - + From 6ec5c37076993b26431e62817e6859800c90cc62 Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Fri, 11 Oct 2019 10:27:08 -0700 Subject: [PATCH 08/16] Fixed some merge problems --- docs/ReleaseNotes.md | 4 +--- package.json | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index f36ae6b68f..8fad4d97c2 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -13,6 +13,7 @@ part of the locale specifier if it has a very common/default value * For languages that are written in multiple scripts, but where one is dominant, the script is only included when it is not the default/dominant one * Most languages are only ever written in one script, so the script is left out * Updated the script info to UCD 12.0.0, and the likely locale info to CLDR 35.1 +* Added source maps to the npm package so that you can debug into the original ilib code easily Bug Fixes: * Fixed unit test failures which occur on QT 5.12 @@ -80,9 +81,6 @@ Build 003 ------- Published as version 14.1.1 -New Features: -* Added source maps to the npm package so that you can debug into the original ilib code easily - Bug Fixes: * Worked around a problem with uglifyjs which optimized out a block of code that contained the comment that the ilib-webpack-loader was diff --git a/package.json b/package.json index 4204d07589..57912e08a1 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "grunt-contrib-compress": "^1.4.3", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-nodeunit": "~0.4.1", - "grunt-contrib-uglify": "~0.5.0", + "grunt-contrib-uglify": "^3.4.0", "grunt-eslint": "^21.0.0", "grunt-http-server": "^2.1.0", "grunt-jsdoc": "^2.2.1", From a14c053c362d30d426d521658097882f8c3e0a8c Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Tue, 15 Oct 2019 10:38:32 -0700 Subject: [PATCH 09/16] Try using base or url with uglify ... doesn't seem to be working --- js/build.xml | 28 ++++++++++++++++++++++++---- package.json | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/js/build.xml b/js/build.xml index 8d92974c94..6c72ae1945 100644 --- a/js/build.xml +++ b/js/build.xml @@ -302,10 +302,15 @@ limitations under the License. + + + - + + + @@ -315,10 +320,15 @@ limitations under the License. + + + + + - + @@ -341,10 +351,15 @@ limitations under the License. + + + - + + + @@ -371,10 +386,15 @@ limitations under the License. + + + + + - + diff --git a/package.json b/package.json index 57912e08a1..0a6d5474d5 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "source-map-loader": "^0.2.4", "tap": "^10.0.2", "trireme": "^0.9.3", - "uglify-js": "^3.4.9", + "uglify-js": "^3.6.1", "uglifyjs-webpack-plugin": "^1.3.0", "webpack": "^4.32.2", "webpack-cli": "^3.3.2", From c2b73be47d0062a04bd27adffdca22b5a7b4487a Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Thu, 7 Nov 2019 10:51:23 -0800 Subject: [PATCH 10/16] Try using uglify-js2 instead because uglify-js was having problems outputting the sourceMappingURL properly. This still needs more work. --- js/build.xml | 28 +++++++++++++++++----------- js/index.js | 51 +-------------------------------------------------- package.json | 2 +- 3 files changed, 19 insertions(+), 62 deletions(-) diff --git a/js/build.xml b/js/build.xml index 6c72ae1945..95f28e44f9 100644 --- a/js/build.xml +++ b/js/build.xml @@ -310,7 +310,7 @@ limitations under the License. - + @@ -328,7 +328,7 @@ limitations under the License. - + @@ -344,11 +344,11 @@ limitations under the License. - + + - @@ -356,11 +356,17 @@ limitations under the License. - - - - - + + + + + + + + + + + @@ -377,7 +383,6 @@ limitations under the License. - @@ -394,7 +399,8 @@ limitations under the License. - + + diff --git a/js/index.js b/js/index.js index 96b699cbd4..52adc1a5b2 100644 --- a/js/index.js +++ b/js/index.js @@ -1,50 +1 @@ -/* - * index.js - top level entry point for ilib - * - * Copyright © 2018 JEDLSoft - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var ilib = require("./lib/ilib.js"); - -if (!ilib._platform || (typeof(ilib._dyndata) !== 'boolean' && typeof(ilib._dyncode) !== 'boolean')) { - if (typeof(__webpack_require__) !== 'undefined') { - require("./lib/ilib-webpack.js"); - } else { - switch (ilib._getPlatform()) { - case 'webos-webapp': - break; - case 'webos': - case 'nodejs': - require("./lib/ilib-node.js"); - break; - case 'qt': - require("./lib/ilib-qt.js"); - break; - case 'rhino': - require("./lib/ilib-rhino.js"); - break; - case 'ringo': - require("./lib/ilib-ringo.js"); - break; - default: - ilib._dyncode = false; - ilib._dyndata = false; - break; - } - } -} - -module.exports = ilib; +var ilib=require("./lib/ilib.js");if(!ilib._platform||"boolean"!=typeof ilib._dyndata&&"boolean"!=typeof ilib._dyncode)if("undefined"!=typeof __webpack_require__)require("./lib/ilib-webpack.js");else switch(ilib._getPlatform()){case"webos-webapp":break;case"webos":case"nodejs":require("./lib/ilib-node.js");break;case"qt":require("./lib/ilib-qt.js");break;case"rhino":require("./lib/ilib-rhino.js");break;case"ringo":require("./lib/ilib-ringo.js");break;default:ilib._dyncode=!1,ilib._dyndata=!1}module.exports=ilib; \ No newline at end of file diff --git a/package.json b/package.json index a6f1fba286..92071c80ef 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "source-map-loader": "^0.2.4", "tap": "^10.0.2", "trireme": "^0.9.3", - "uglify-js": "^3.6.1", + "uglify-js2": "^2.1.11", "uglifyjs-webpack-plugin": "^1.3.0", "webpack": "^4.32.2", "webpack-cli": "^3.3.2", From d0b454dd7002cd6cf5dd3918e8fe99a749bff1fb Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Mon, 11 Nov 2019 13:54:20 -0800 Subject: [PATCH 11/16] Revert a file that was accidentally compressed It should be compressed at build time, not in the repo. --- js/index.js | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/js/index.js b/js/index.js index 52adc1a5b2..96b699cbd4 100644 --- a/js/index.js +++ b/js/index.js @@ -1 +1,50 @@ -var ilib=require("./lib/ilib.js");if(!ilib._platform||"boolean"!=typeof ilib._dyndata&&"boolean"!=typeof ilib._dyncode)if("undefined"!=typeof __webpack_require__)require("./lib/ilib-webpack.js");else switch(ilib._getPlatform()){case"webos-webapp":break;case"webos":case"nodejs":require("./lib/ilib-node.js");break;case"qt":require("./lib/ilib-qt.js");break;case"rhino":require("./lib/ilib-rhino.js");break;case"ringo":require("./lib/ilib-ringo.js");break;default:ilib._dyncode=!1,ilib._dyndata=!1}module.exports=ilib; \ No newline at end of file +/* + * index.js - top level entry point for ilib + * + * Copyright © 2018 JEDLSoft + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var ilib = require("./lib/ilib.js"); + +if (!ilib._platform || (typeof(ilib._dyndata) !== 'boolean' && typeof(ilib._dyncode) !== 'boolean')) { + if (typeof(__webpack_require__) !== 'undefined') { + require("./lib/ilib-webpack.js"); + } else { + switch (ilib._getPlatform()) { + case 'webos-webapp': + break; + case 'webos': + case 'nodejs': + require("./lib/ilib-node.js"); + break; + case 'qt': + require("./lib/ilib-qt.js"); + break; + case 'rhino': + require("./lib/ilib-rhino.js"); + break; + case 'ringo': + require("./lib/ilib-ringo.js"); + break; + default: + ilib._dyncode = false; + ilib._dyndata = false; + break; + } + } +} + +module.exports = ilib; From 3e953233ddd58d0d7c306f6aba86c11a3eec7bf7 Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Mon, 11 Nov 2019 17:21:20 -0800 Subject: [PATCH 12/16] Closer to getting uglify/source maps working .. but still not working yet. --- js/build.xml | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/js/build.xml b/js/build.xml index 95f28e44f9..166f257b0a 100644 --- a/js/build.xml +++ b/js/build.xml @@ -344,8 +344,32 @@ limitations under the License. - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -361,27 +385,13 @@ limitations under the License. - + - + - - - - - - - - - - - - - - - - + + From 65729f9b8238ffd87c832ca24542be88baf1ac1a Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Tue, 12 Nov 2019 17:11:01 -0800 Subject: [PATCH 13/16] Got the source map output correct with grunt Now need to fix up the dist target to use it properly --- js/Gruntfile.js | 126 +++++++++++++++++++++++++++++++++ js/build.xml | 148 ++++++--------------------------------- js/package.json.template | 12 ++-- package.json | 13 ++-- 4 files changed, 159 insertions(+), 140 deletions(-) create mode 100644 js/Gruntfile.js diff --git a/js/Gruntfile.js b/js/Gruntfile.js new file mode 100644 index 0000000000..2a9a550a53 --- /dev/null +++ b/js/Gruntfile.js @@ -0,0 +1,126 @@ +/** + * Gruntfile.js - build the ilib javascript project + * + * @license + * Copyright © 2019, JEDLSoft + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = function(grunt) { + require('load-grunt-tasks')(grunt); + + // Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + mkdir: { + prepare: { + options: { + create: [ + 'locale', + 'output', + 'output/reports', + 'output/js', + 'output/dyncode', + 'output/dyncode/lib', + 'output/dyncode/src/lib', + 'output/test', + 'output/jsdoc' + ] + } + } + }, + copy: { + src: { + files: [{ + cwd:"lib", + src: [ + "**/*.js", + "!**/ilib.js", + '!**/ilib-*.js', + '!externs.js', + '!datefmtstr.js', + '!ilib-stubs*', + "!**/metafiles/*" + ], + dest: 'output/dyncode/src/lib', + expand: true + },{ + cwd:"lib", + src: [ + "ilib-node*", + "ilib-qt*", + "ilib-webpack*", + "ilib-unpack.js", + "ilib-web.js" + ], + dest: 'output/dyncode/src/lib', + expand: true + },{ + src: [ + "index.js" + ], + dest: 'output/dyncode/src', + expand: true + }] + } + }, + replace: { + version: { + src: [ + "lib/ilib.js" + ], + dest: "output/dyncode/src/lib/ilib.js", + replacements: [{ + from: '// !macro ilibVersion', + to: '"<%= pkg.version %>"' + }] + } + }, + uglify: { + lib: { + options: { + banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n', + mangle: false, + sourceMap: true, + output: { + comments: "/(\!data|\!loadLocaleData|\!defineLocaleData|\!macro|eslint-)/" + } + }, + files: [{ + expand: true, + cwd: 'output/dyncode/src', + src: [ + '**/*.js' + ], + dest: 'output/dyncode' + }] + } + }, + clean: { + dist: ['lib'] + } + }); + + // Load the plugin that provides the "uglify" task. + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-mkdir'); + + // Default task(s). + // grunt.registerTask('default', ['uglify']); + // grunt.registerMultiTask('mkdir', ['mkdir']); + // grunt.registerMultiTask('copy', ['copy']); + grunt.registerTask('uglifypkg', ['mkdir:prepare', 'copy:src', 'replace:version', 'uglify:lib']); +}; diff --git a/js/build.xml b/js/build.xml index 166f257b0a..10ffaa2fdc 100644 --- a/js/build.xml +++ b/js/build.xml @@ -116,8 +116,8 @@ limitations under the License. + - @@ -289,146 +289,38 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + - - - - - - - - - - - - - - - - - - - - - - - + + + - - + + + + + - + - - + diff --git a/js/package.json.template b/js/package.json.template index d2e74646b1..e3c99a8710 100644 --- a/js/package.json.template +++ b/js/package.json.template @@ -50,16 +50,14 @@ "type": "git", "url": "git@github.com:iLib-js/iLib.git" }, - "repositories": [ - { - "type": "git", - "url": "git@github.com:iLib-js/iLib.git" - } - ], "scripts": { "test": "ant test" }, "devDependencies": { - "http-server": "^0.9.0" + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-uglify": "^4.0.1", + "grunt-mkdir": "^1.0.0", + "grunt-text-replace": "^0.4.0", + "http-server": "^0.9.0" } } diff --git a/package.json b/package.json index 92071c80ef..b33977dc42 100644 --- a/package.json +++ b/package.json @@ -54,13 +54,14 @@ "babel-loader": "^7.1.5", "cldr-data": "^34.0.0", "ejs": "^2.6.1", - "grunt": "^1.0.3", - "grunt-cli": "^1.2.0", - "grunt-contrib-clean": "^1.1.0", + "grunt": "^1.0.4", + "grunt-cli": "^1.3.2", + "grunt-contrib-clean": "^2.0.0", + "grunt-contrib-jshint": "^2.1.0", "grunt-contrib-compress": "^1.4.3", "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-nodeunit": "~0.4.1", - "grunt-contrib-uglify": "^3.4.0", + "grunt-contrib-nodeunit": "^2.0.0", + "grunt-contrib-uglify": "^4.0.1", "grunt-eslint": "^21.0.0", "grunt-http-server": "^2.1.0", "grunt-jsdoc": "^2.2.1", @@ -74,7 +75,9 @@ "ilib-webpack-loader": "^1.3.0", "ilib-webpack-plugin": "^1.3.0", "iso-15924": "^2.1.0", + "jit-grunt": "^0.10.0", "jsdoc2": "^2.4.0", + "load-grunt-tasks": "^5.0.0", "nodeunit": "^0.11.0", "should": "^13.2.3", "source-map-loader": "^0.2.4", From 77503ff2cdd0c0bf00786d912b580d25b52921ce Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Tue, 12 Nov 2019 22:31:50 -0800 Subject: [PATCH 14/16] Modify the dist target to place things in the right place --- js/build.xml | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/js/build.xml b/js/build.xml index 166f257b0a..4812bff571 100644 --- a/js/build.xml +++ b/js/build.xml @@ -24,7 +24,7 @@ limitations under the License. - + @@ -117,7 +117,7 @@ limitations under the License. - + @@ -464,9 +464,8 @@ limitations under the License. - - - + + @@ -498,38 +497,23 @@ limitations under the License. - - + - - - - - - - - - - - - - - - - - + + + From 6e6e7707121408c9e15e43b418c9c66674abf891 Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Wed, 13 Nov 2019 08:18:45 -0800 Subject: [PATCH 15/16] Don't need to copy the src dir separately --- js/build.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/js/build.xml b/js/build.xml index 960933a572..80f3a289f6 100644 --- a/js/build.xml +++ b/js/build.xml @@ -403,9 +403,6 @@ limitations under the License. - - - From 6dfad8436b0709fa35bc70bed6e93a8182b5abcd Mon Sep 17 00:00:00 2001 From: Edwin Hoogerbeets Date: Tue, 26 Nov 2019 00:46:54 -0800 Subject: [PATCH 16/16] Some clean-up --- js/build.xml | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/js/build.xml b/js/build.xml index 10ffaa2fdc..ed79029c75 100644 --- a/js/build.xml +++ b/js/build.xml @@ -40,6 +40,7 @@ limitations under the License. + @@ -116,7 +117,7 @@ limitations under the License. - + @@ -296,7 +297,7 @@ limitations under the License. - + @@ -305,7 +306,7 @@ limitations under the License. - + @@ -316,7 +317,7 @@ limitations under the License. - + @@ -356,7 +357,7 @@ limitations under the License. - + @@ -391,32 +392,15 @@ limitations under the License. - + - - - - - - - - - - - - - - - - -