From effb2fb4b4bf12e6ecc3934761e0305147f6e2e2 Mon Sep 17 00:00:00 2001 From: Bardi Harborow Date: Fri, 23 Dec 2016 23:43:46 +1100 Subject: [PATCH] Move uglifyjs to npm script. --- Gruntfile.js | 28 +++++++----------------- grunt/npm-shrinkwrap.json | 46 +-------------------------------------- package.json | 6 +++-- 3 files changed, 13 insertions(+), 67 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8a34c4e63f1d..b707034f6c2b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -121,24 +121,6 @@ module.exports = function (grunt) { } }, - uglify: { - options: { - compress: { - warnings: false - }, - mangle: true, - preserveComments: /^!|@preserve|@license|@cc_on/i - }, - core: { - src: '<%= concat.bootstrap.dest %>', - dest: 'dist/js/<%= pkg.name %>.min.js' - }, - docsJs: { - src: configBridge.paths.docsJs, - dest: 'docs/assets/js/docs.min.js' - } - }, - qunit: { options: { inject: 'js/tests/unit/phantom.js' @@ -250,6 +232,12 @@ module.exports = function (grunt) { }, 'scss-lint-docs': { command: 'npm run scss-lint-docs' + }, + uglify: { + command: 'npm run uglify' + }, + 'uglify-docs': { + command: 'npm run uglify-docs' } }, @@ -335,7 +323,7 @@ module.exports = function (grunt) { grunt.registerTask('test', testSubtasks); // JS distribution task. - grunt.registerTask('dist-js', ['babel:dev', 'concat', 'babel:dist', 'stamp', 'uglify:core']); + grunt.registerTask('dist-js', ['babel:dev', 'concat', 'babel:dist', 'stamp', 'exec:uglify']); grunt.registerTask('test-scss', ['exec:scss-lint']); @@ -358,7 +346,7 @@ module.exports = function (grunt) { // Docs task. grunt.registerTask('docs-css', ['exec:clean-css-docs', 'exec:postcss-docs']); grunt.registerTask('lint-docs-css', ['exec:scss-lint-docs']); - grunt.registerTask('docs-js', ['uglify:docsJs']); + grunt.registerTask('docs-js', ['exec:uglify-docs']); grunt.registerTask('docs', ['lint-docs-css', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs']); grunt.registerTask('docs-github', ['jekyll:github']); diff --git a/grunt/npm-shrinkwrap.json b/grunt/npm-shrinkwrap.json index b3988531fd8e..06435123ec72 100644 --- a/grunt/npm-shrinkwrap.json +++ b/grunt/npm-shrinkwrap.json @@ -644,12 +644,6 @@ "dev": true, "optional": true }, - "browserify-zlib": { - "version": "0.1.4", - "from": "browserify-zlib@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", - "dev": true - }, "browserslist": { "version": "1.4.0", "from": "browserslist@>=1.4.0 <1.5.0", @@ -1789,12 +1783,6 @@ } } }, - "grunt-contrib-uglify": { - "version": "2.0.0", - "from": "grunt-contrib-uglify@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-2.0.0.tgz", - "dev": true - }, "grunt-contrib-watch": { "version": "1.0.0", "from": "grunt-contrib-watch@>=1.0.0 <2.0.0", @@ -1915,12 +1903,6 @@ "resolved": "https://registry.npmjs.org/grunt-stamp/-/grunt-stamp-0.3.0.tgz", "dev": true }, - "gzip-size": { - "version": "1.0.0", - "from": "gzip-size@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-1.0.0.tgz", - "dev": true - }, "har-validator": { "version": "2.0.6", "from": "har-validator@>=2.0.6 <2.1.0", @@ -2643,20 +2625,6 @@ "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "dev": true }, - "maxmin": { - "version": "1.1.0", - "from": "maxmin@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/maxmin/-/maxmin-1.1.0.tgz", - "dev": true, - "dependencies": { - "pretty-bytes": { - "version": "1.0.4", - "from": "pretty-bytes@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", - "dev": true - } - } - }, "media-typer": { "version": "0.3.0", "from": "media-typer@0.3.0", @@ -2989,12 +2957,6 @@ "resolved": "https://registry.npmjs.org/package/-/package-1.0.1.tgz", "dev": true }, - "pako": { - "version": "0.2.9", - "from": "pako@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "dev": true - }, "parse-glob": { "version": "3.0.4", "from": "parse-glob@3.0.4", @@ -3957,7 +3919,7 @@ }, "uglify-js": { "version": "2.7.5", - "from": "uglify-js@>=2.7.0 <2.8.0", + "from": "uglify-js@latest", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.5.tgz", "dev": true, "dependencies": { @@ -3993,12 +3955,6 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "dev": true }, - "uri-path": { - "version": "1.0.0", - "from": "uri-path@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/uri-path/-/uri-path-1.0.0.tgz", - "dev": true - }, "user-home": { "version": "2.0.0", "from": "user-home@>=2.0.0 <3.0.0", diff --git a/package.json b/package.json index f01c27ebac80..19267d698f34 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,8 @@ "postcss-docs": "postcss --config grunt/postcss.js --no-map --replace docs/assets/css/docs.min.css && postcss --config grunt/postcss.js --no-map --replace docs/examples/**/*.css", "scss-lint": "bundle exec scss-lint --config scss/.scss-lint.yml --exclude scss/_normalize.scss scss/*.scss", "scss-lint-docs": "bundle exec scss-lint --config scss/.scss-lint.yml --exclude docs/assets/scss/docs.scss docs/assets/scss/*.scss", + "uglify": "uglifyjs --compress warnings=false --mangle --comments '/^!/' --output dist/js/bootstrap.min.js dist/js/bootstrap.js", + "uglify-docs": "uglifyjs --compress warnings=false --mangle --comments '/^!/' --output docs/assets/js/docs.min.js docs/assets/js/vendor/*.js docs/assets/js/src/application.js", "update-shrinkwrap": "npm shrinkwrap --dev && shx mv ./npm-shrinkwrap.json ./grunt/npm-shrinkwrap.json", "test": "npm run eslint && npm run jscs && grunt test" }, @@ -62,7 +64,6 @@ "grunt-contrib-copy": "^1.0.0", "grunt-contrib-qunit": "^1.2.0", "grunt-contrib-sass": "^1.0.0", - "grunt-contrib-uglify": "^2.0.0", "grunt-contrib-watch": "^1.0.0", "grunt-exec": "^1.0.1", "grunt-html": "^8.0.2", @@ -78,7 +79,8 @@ "postcss-flexbugs-fixes": "^2.0.0", "shelljs": "^0.7.4", "shx": "^0.1.4", - "time-grunt": "^1.4.0" + "time-grunt": "^1.4.0", + "uglify-js": "^2.7.5" }, "engines": { "node": ">=4"