From 9ce5b7ca0c0e21d956a5d663f4108a63e2061ab9 Mon Sep 17 00:00:00 2001 From: mmso Date: Mon, 14 Jan 2019 22:26:49 +0100 Subject: [PATCH] Upgrade to terser-js --- Gruntfile.js | 28 ++++++++++++++++++++-------- package.json | 3 ++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 0cac98b9..8b8b3d2d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -135,17 +135,28 @@ module.exports = function(grunt) { }] } }, - uglify: { + terser: { openpgp: { files: { 'dist/openpgp.min.js' : ['dist/openpgp.js'], 'dist/openpgp.worker.min.js' : ['dist/openpgp.worker.js'] + }, + options: { + safari10: true + }, + } + }, + header: { + openpgp: { + options: { + text: '/*! OpenPGP.js v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %> - ' + + 'this is LGPL licensed code, see LICENSE/our website <%= pkg.homepage %> for more information. */' + }, + files: { + 'dist/openpgp.min.js': 'dist/openpgp.min.js', + 'dist/openpgp.worker.min.js': 'dist/openpgp.worker.min.js' } - }, - options: { - banner: '/*! OpenPGP.js v<%= pkg.version %> - ' + - '<%= grunt.template.today("yyyy-mm-dd") %> - ' + - 'this is LGPL licensed code, see LICENSE/our website <%= pkg.homepage %> for more information. */' } }, jsbeautifier: { @@ -257,7 +268,8 @@ module.exports = function(grunt) { // Load the plugin(s) grunt.loadNpmTasks('grunt-browserify'); - grunt.loadNpmTasks('grunt-contrib-uglify-es'); + grunt.loadNpmTasks('grunt-terser'); + grunt.loadNpmTasks('grunt-header'); grunt.loadNpmTasks('grunt-text-replace'); grunt.loadNpmTasks('grunt-jsbeautifier'); grunt.loadNpmTasks('grunt-jsdoc'); @@ -305,7 +317,7 @@ module.exports = function(grunt) { // Build tasks grunt.registerTask('version', ['replace:openpgp']); grunt.registerTask('replace_min', ['replace:openpgp_min', 'replace:worker_min']); - grunt.registerTask('build', ['browserify:openpgp', 'browserify:worker', 'version', 'uglify', 'replace_min']); + grunt.registerTask('build', ['browserify:openpgp', 'browserify:worker', 'version', 'terser', 'header', 'replace_min']); grunt.registerTask('documentation', ['jsdoc']); grunt.registerTask('default', ['build']); // Test/Dev tasks diff --git a/package.json b/package.json index 3256e949..41883f15 100644 --- a/package.json +++ b/package.json @@ -55,13 +55,14 @@ "grunt-contrib-clean": "~1.1.0", "grunt-contrib-connect": "~1.0.2", "grunt-contrib-copy": "~1.0.0", - "grunt-contrib-uglify-es": "^3.3.0", "grunt-contrib-watch": "^1.1.0", + "grunt-header": "^1.1.0", "grunt-jsbeautifier": "^0.2.13", "grunt-jsdoc": "^2.2.1", "grunt-mocha-istanbul": "^5.0.2", "grunt-mocha-test": "^0.13.3", "grunt-saucelabs": "9.0.0", + "grunt-terser": "^0.1.0", "grunt-text-replace": "~0.4.0", "gruntify-eslint": "^4.0.0", "istanbul": "^0.4.5",