Feature/#46 replace gulp uglify es with terser #47

Merged
Serraniel merged 3 commits from feature/#46-replace-gulp-uglify-es-with-terser into develop 2020-09-14 01:16:43 +02:00
3 changed files with 57 additions and 34 deletions

View file

@ -1,7 +1,7 @@
const gulp = require('gulp'); const gulp = require('gulp');
const cssnano = require('cssnano') const cssnano = require('cssnano')
const gulpLoadPlugins = require('gulp-load-plugins') const gulpLoadPlugins = require('gulp-load-plugins')
const uglify = require('gulp-uglify-es').default; const terser = require('terser');
const del = require('del'); const del = require('del');
const browserify = require('browserify'); const browserify = require('browserify');
const babelify = require('babelify'); const babelify = require('babelify');
@ -118,7 +118,7 @@ gulp.task('scripts', () => {
.pipe(source('app.js')) .pipe(source('app.js'))
.pipe(buffer()) .pipe(buffer())
.pipe($.if(isDev, $.sourcemaps.init({ loadMaps: true }))) .pipe($.if(isDev, $.sourcemaps.init({ loadMaps: true })))
.pipe(uglify({ compress: { drop_console: isProd, drop_debugger: isProd } })) .pipe($.terser({ compress: { drop_console: isProd, drop_debugger: isProd } }))
.pipe($.rename({ suffix: '.min' })) .pipe($.rename({ suffix: '.min' }))
.pipe($.size({ .pipe($.size({
showFiles: true, showFiles: true,
@ -205,19 +205,19 @@ gulp.task('dist:chrome', (done) => {
return merge( return merge(
// copy images // copy images
gulp.src(`${tmp.images}/**/*`) gulp.src(`${tmp.images}/**/*`)
.pipe(gulp.dest(dist.chrome.images)), .pipe(gulp.dest(dist.chrome.images)),
// copy scripts // copy scripts
gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`) gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`)
.pipe(gulp.dest(dist.chrome.scripts)), .pipe(gulp.dest(dist.chrome.scripts)),
// copy styles // copy styles
gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`) gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`)
.pipe(gulp.dest(dist.chrome.styles)), .pipe(gulp.dest(dist.chrome.styles)),
gulp.src(`${tmp.manifests}/chrome*`) gulp.src(`${tmp.manifests}/chrome*`)
.pipe($.rename('manifest.json')) .pipe($.rename('manifest.json'))
.pipe(gulp.dest(dist.chrome.root)) .pipe(gulp.dest(dist.chrome.root))
); );
}) })
@ -225,19 +225,19 @@ gulp.task('dist:firefox', (done) => {
return merge( return merge(
// copy images // copy images
gulp.src(`${tmp.images}/**/*`) gulp.src(`${tmp.images}/**/*`)
.pipe(gulp.dest(dist.firefox.images)), .pipe(gulp.dest(dist.firefox.images)),
// copy scripts // copy scripts
gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`) gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`)
.pipe(gulp.dest(dist.firefox.scripts)), .pipe(gulp.dest(dist.firefox.scripts)),
// copy styles // copy styles
gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`) gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`)
.pipe(gulp.dest(dist.firefox.styles)), .pipe(gulp.dest(dist.firefox.styles)),
gulp.src(`${tmp.manifests}/firefox*`) gulp.src(`${tmp.manifests}/firefox*`)
.pipe($.rename('manifest.json')) .pipe($.rename('manifest.json'))
.pipe(gulp.dest(dist.firefox.root)) .pipe(gulp.dest(dist.firefox.root))
); );
}) })
@ -245,19 +245,19 @@ gulp.task('dist:opera', (done) => {
return merge( return merge(
// copy images // copy images
gulp.src(`${tmp.images}/**/*`) gulp.src(`${tmp.images}/**/*`)
.pipe(gulp.dest(dist.opera.images)), .pipe(gulp.dest(dist.opera.images)),
// copy scripts // copy scripts
gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`) gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`)
.pipe(gulp.dest(dist.opera.scripts)), .pipe(gulp.dest(dist.opera.scripts)),
// copy styles // copy styles
gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`) gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`)
.pipe(gulp.dest(dist.opera.styles)), .pipe(gulp.dest(dist.opera.styles)),
gulp.src(`${tmp.manifests}/opera*`) gulp.src(`${tmp.manifests}/opera*`)
.pipe($.rename('manifest.json')) .pipe($.rename('manifest.json'))
.pipe(gulp.dest(dist.opera.root)) .pipe(gulp.dest(dist.opera.root))
); );
}) })

54
package-lock.json generated
View file

@ -5772,17 +5772,45 @@
} }
} }
}, },
"gulp-uglify-es": { "gulp-terser": {
"version": "2.0.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/gulp-uglify-es/-/gulp-uglify-es-2.0.0.tgz", "resolved": "https://registry.npmjs.org/gulp-terser/-/gulp-terser-1.4.0.tgz",
"integrity": "sha512-00KkawzjWdjPo1YfD1FXKijVxZkyr6YSwJ2cJQgD1fNKFZCFPNjGc5sTyzyW8tZns8FmZafgHMrg7LUDNvIQ5A==", "integrity": "sha512-7df9leJna3WOmj76tYHxjpn7BSU+vmKVjVSd6bz3uLEyrzCfZI97KPhRcIabrSNzs0UY/UXTt+JwkxPw3sF85w==",
"dev": true, "dev": true,
"requires": { "requires": {
"o-stream": "^0.2.2", "is-promise": "^4.0.0",
"plugin-error": "^1.0.1", "plugin-error": "^1.0.1",
"terser": "^4.3.9", "terser": ">=4",
"vinyl": "^2.2.0", "through2": "^4.0.2",
"vinyl-sourcemaps-apply": "^0.2.1" "vinyl-sourcemaps-apply": "^0.2.1"
},
"dependencies": {
"is-promise": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
"dev": true
},
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"dev": true,
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
},
"through2": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
"integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==",
"dev": true,
"requires": {
"readable-stream": "3"
}
}
} }
}, },
"gulp-zip": { "gulp-zip": {
@ -7796,12 +7824,6 @@
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true "dev": true
}, },
"o-stream": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/o-stream/-/o-stream-0.2.2.tgz",
"integrity": "sha512-V3j76KU3g/Gyl8rpdi2z72rn5zguMvTCQgAXfBe3pxEefKqXmOUOD7mvx/mNjykdxGqDVfpSoo8r+WdrkWg/1Q==",
"dev": true
},
"oauth-sign": { "oauth-sign": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
@ -10606,9 +10628,9 @@
} }
}, },
"terser": { "terser": {
"version": "4.8.0", "version": "5.3.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.1.tgz",
"integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", "integrity": "sha512-yD80f4hdwCWTH5mojzxe1q8bN1oJbsK/vfJGLcPZM/fl+/jItIVNKhFIHqqR71OipFWMLgj3Kc+GIp6CeIqfnA==",
"dev": true, "dev": true,
"requires": { "requires": {
"commander": "^2.20.0", "commander": "^2.20.0",

View file

@ -61,10 +61,11 @@
"gulp-sass": "^4.1.0", "gulp-sass": "^4.1.0",
"gulp-size": "^3.0.0", "gulp-size": "^3.0.0",
"gulp-sourcemaps": "^2.6.5", "gulp-sourcemaps": "^2.6.5",
"gulp-uglify-es": "^2.0.0", "gulp-terser": "^1.4.0",
"gulp-zip": "^5.0.2", "gulp-zip": "^5.0.2",
"merge-stream": "^2.0.0", "merge-stream": "^2.0.0",
"sass": "^1.26.10", "sass": "^1.26.10",
"terser": "^5.3.1",
"vinyl-buffer": "^1.0.1", "vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0" "vinyl-source-stream": "^2.0.0"
} }