Merge pull request #47 from Serraniel/feature/#46-replace-gulp-uglify-es-with-terser

Feature/#46 replace gulp uglify es with terser
This commit is contained in:
kaffem 2020-09-14 01:16:43 +02:00 committed by GitHub
commit 60ab9c2203
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 34 deletions

View file

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

54
package-lock.json generated
View file

@ -5772,17 +5772,45 @@
}
}
},
"gulp-uglify-es": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/gulp-uglify-es/-/gulp-uglify-es-2.0.0.tgz",
"integrity": "sha512-00KkawzjWdjPo1YfD1FXKijVxZkyr6YSwJ2cJQgD1fNKFZCFPNjGc5sTyzyW8tZns8FmZafgHMrg7LUDNvIQ5A==",
"gulp-terser": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/gulp-terser/-/gulp-terser-1.4.0.tgz",
"integrity": "sha512-7df9leJna3WOmj76tYHxjpn7BSU+vmKVjVSd6bz3uLEyrzCfZI97KPhRcIabrSNzs0UY/UXTt+JwkxPw3sF85w==",
"dev": true,
"requires": {
"o-stream": "^0.2.2",
"is-promise": "^4.0.0",
"plugin-error": "^1.0.1",
"terser": "^4.3.9",
"vinyl": "^2.2.0",
"terser": ">=4",
"through2": "^4.0.2",
"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": {
@ -7796,12 +7824,6 @@
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"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": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
@ -10607,9 +10629,9 @@
}
},
"terser": {
"version": "4.8.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
"integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==",
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.3.1.tgz",
"integrity": "sha512-yD80f4hdwCWTH5mojzxe1q8bN1oJbsK/vfJGLcPZM/fl+/jItIVNKhFIHqqR71OipFWMLgj3Kc+GIp6CeIqfnA==",
"dev": true,
"requires": {
"commander": "^2.20.0",

View file

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