mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #3830 from MetaMask/build-perf
build - use uglifyify and gulp-multi-process for better performance
This commit is contained in:
commit
91c08a7282
29
gulpfile.js
29
gulpfile.js
@ -28,8 +28,14 @@ const uglify = require('gulp-uglify-es').default
|
||||
const babel = require('gulp-babel')
|
||||
const debug = require('gulp-debug')
|
||||
const pify = require('pify')
|
||||
const gulpMultiProcess = require('gulp-multi-process')
|
||||
const endOfStream = pify(require('end-of-stream'))
|
||||
|
||||
function gulpParallel (...args) {
|
||||
return function spawnGulpChildProcess(cb) {
|
||||
return gulpMultiProcess(args, cb, true)
|
||||
}
|
||||
}
|
||||
|
||||
const browserPlatforms = [
|
||||
'firefox',
|
||||
@ -420,7 +426,7 @@ gulp.task('build',
|
||||
gulp.series(
|
||||
'clean',
|
||||
'build:scss',
|
||||
gulp.parallel(
|
||||
gulpParallel(
|
||||
'build:extension:js',
|
||||
'build:mascara:js',
|
||||
'copy'
|
||||
@ -478,6 +484,16 @@ function generateBundler(opts, performBundle) {
|
||||
|
||||
let bundler = browserify(browserifyOpts)
|
||||
|
||||
// Minification
|
||||
if (opts.minifyBuild) {
|
||||
bundler.transform('uglifyify', {
|
||||
global: true,
|
||||
mangle: {
|
||||
reserved: [ 'MetamaskInpageProvider' ]
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if (opts.watch) {
|
||||
bundler = watchify(bundler)
|
||||
// on any file update, re-runs the bundler
|
||||
@ -546,7 +562,6 @@ function bundleTask(opts) {
|
||||
// buffer file contents (?)
|
||||
.pipe(buffer())
|
||||
|
||||
|
||||
// Initialize Source Maps
|
||||
if (opts.buildSourceMaps) {
|
||||
buildStream = buildStream
|
||||
@ -554,16 +569,6 @@ function bundleTask(opts) {
|
||||
.pipe(sourcemaps.init({ loadMaps: true }))
|
||||
}
|
||||
|
||||
// Minification
|
||||
if (opts.minifyBuild) {
|
||||
buildStream = buildStream
|
||||
.pipe(uglify({
|
||||
mangle: {
|
||||
reserved: [ 'MetamaskInpageProvider' ]
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
||||
// Finalize Source Maps (writes .map file)
|
||||
if (opts.buildSourceMaps) {
|
||||
buildStream = buildStream
|
||||
|
68
package-lock.json
generated
68
package-lock.json
generated
@ -919,6 +919,65 @@
|
||||
"async-done": "1.2.4"
|
||||
}
|
||||
},
|
||||
"async.queue": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.queue/-/async.queue-0.5.2.tgz",
|
||||
"integrity": "sha1-jV2QgS4UgQZrwJBOjMFxKxfDvXw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async.util.queue": "0.5.2"
|
||||
}
|
||||
},
|
||||
"async.util.arrayeach": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.arrayeach/-/async.util.arrayeach-0.5.2.tgz",
|
||||
"integrity": "sha1-WMTpgCjVXWm/sFrrOvROClVagpw=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.isarray": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.isarray/-/async.util.isarray-0.5.2.tgz",
|
||||
"integrity": "sha1-5i2sjyY29lh13PdSHC0k0N+yu98=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.map": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.map/-/async.util.map-0.5.2.tgz",
|
||||
"integrity": "sha1-5YjvhuCzq18CfZevTWg10FXKadY=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.noop": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.noop/-/async.util.noop-0.5.2.tgz",
|
||||
"integrity": "sha1-vdYrl8sKo/YLWGrRSEaGmJdeWLk=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.onlyonce": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.onlyonce/-/async.util.onlyonce-0.5.2.tgz",
|
||||
"integrity": "sha1-uOb8AErckjFk154y8oE+5GXCT/I=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.queue": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.queue/-/async.util.queue-0.5.2.tgz",
|
||||
"integrity": "sha1-V/Zavho83yc9MavSirlUJfgiLuU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async.util.arrayeach": "0.5.2",
|
||||
"async.util.isarray": "0.5.2",
|
||||
"async.util.map": "0.5.2",
|
||||
"async.util.noop": "0.5.2",
|
||||
"async.util.onlyonce": "0.5.2",
|
||||
"async.util.setimmediate": "0.5.2"
|
||||
}
|
||||
},
|
||||
"async.util.setimmediate": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.setimmediate/-/async.util.setimmediate-0.5.2.tgz",
|
||||
"integrity": "sha1-KBLrq/KlgCd1jUvHeT0cz68QJV8=",
|
||||
"dev": true
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
@ -9290,6 +9349,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"gulp-multi-process": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-multi-process/-/gulp-multi-process-1.3.1.tgz",
|
||||
"integrity": "sha512-okxYy3mxUkekM0RNjkBg8OPuzpnD2yXMAdnGOaQPSJ2wzBdE9R9pkTV+tzPZ65ORK7b57YUc6s+gROA4+EIOLg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async.queue": "0.5.2"
|
||||
}
|
||||
},
|
||||
"gulp-replace": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-0.6.1.tgz",
|
||||
|
@ -229,6 +229,7 @@
|
||||
"gulp-eslint": "^4.0.0",
|
||||
"gulp-json-editor": "^2.2.1",
|
||||
"gulp-livereload": "^3.8.1",
|
||||
"gulp-multi-process": "^1.3.1",
|
||||
"gulp-replace": "^0.6.1",
|
||||
"gulp-sourcemaps": "^2.6.0",
|
||||
"gulp-stylefmt": "^1.1.0",
|
||||
@ -272,7 +273,7 @@
|
||||
"stylelint-config-standard": "^18.2.0",
|
||||
"tape": "^4.5.1",
|
||||
"testem": "^2.0.0",
|
||||
"uglifyify": "^4.0.2",
|
||||
"uglifyify": "^4.0.5",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"vinyl-source-stream": "^2.0.0",
|
||||
"watchify": "^3.9.0"
|
||||
|
Loading…
Reference in New Issue
Block a user