[NewUI-flat] Fix gulp build (#2975)
* Only run uglify when building for prod; set environment when building for prod; use gulp-uglify-es. * Revert change of dist script.
This commit is contained in:
parent
a4fd4f013f
commit
77eb7b2db6
30
gulpfile.js
30
gulpfile.js
|
@ -23,7 +23,7 @@ var sass = require('gulp-sass')
|
||||||
var autoprefixer = require('gulp-autoprefixer')
|
var autoprefixer = require('gulp-autoprefixer')
|
||||||
var gulpStylelint = require('gulp-stylelint')
|
var gulpStylelint = require('gulp-stylelint')
|
||||||
var stylefmt = require('gulp-stylefmt')
|
var stylefmt = require('gulp-stylefmt')
|
||||||
var uglify = require('gulp-uglify')
|
var uglify = require('gulp-uglify-es').default
|
||||||
var babel = require('gulp-babel')
|
var babel = require('gulp-babel')
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,8 +234,18 @@ var jsDevStrings = jsFiles.map(jsFile => `dev:js:${jsFile}`)
|
||||||
var jsBuildStrings = jsFiles.map(jsFile => `build:js:${jsFile}`)
|
var jsBuildStrings = jsFiles.map(jsFile => `build:js:${jsFile}`)
|
||||||
|
|
||||||
jsFiles.forEach((jsFile) => {
|
jsFiles.forEach((jsFile) => {
|
||||||
gulp.task(`dev:js:${jsFile}`, bundleTask({ watch: true, label: jsFile, filename: `${jsFile}.js` }))
|
gulp.task(`dev:js:${jsFile}`, bundleTask({
|
||||||
gulp.task(`build:js:${jsFile}`, bundleTask({ watch: false, label: jsFile, filename: `${jsFile}.js` }))
|
watch: true,
|
||||||
|
label: jsFile,
|
||||||
|
filename: `${jsFile}.js`,
|
||||||
|
isBuild: false
|
||||||
|
}))
|
||||||
|
gulp.task(`build:js:${jsFile}`, bundleTask({
|
||||||
|
watch: false,
|
||||||
|
label: jsFile,
|
||||||
|
filename: `${jsFile}.js`,
|
||||||
|
isBuild: true
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
// inpage must be built before all other scripts:
|
// inpage must be built before all other scripts:
|
||||||
|
@ -269,12 +279,18 @@ gulp.task('zip:edge', zipTask('edge'))
|
||||||
gulp.task('zip:opera', zipTask('opera'))
|
gulp.task('zip:opera', zipTask('opera'))
|
||||||
gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox', 'zip:edge', 'zip:opera'))
|
gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox', 'zip:edge', 'zip:opera'))
|
||||||
|
|
||||||
|
// set env var for production
|
||||||
|
gulp.task('apply-prod-environment', function(done) {
|
||||||
|
process.env.NODE_ENV = 'production'
|
||||||
|
done()
|
||||||
|
});
|
||||||
|
|
||||||
// high level tasks
|
// high level tasks
|
||||||
|
|
||||||
gulp.task('dev', gulp.series('build:scss', 'dev:js', 'copy', gulp.parallel('watch:scss', 'copy:watch', 'dev:reload')))
|
gulp.task('dev', gulp.series('build:scss', 'dev:js', 'copy', gulp.parallel('watch:scss', 'copy:watch', 'dev:reload')))
|
||||||
|
|
||||||
gulp.task('build', gulp.series('clean', 'build:scss', gulp.parallel('build:js', 'copy')))
|
gulp.task('build', gulp.series('clean', 'build:scss', gulp.parallel('build:js', 'copy')))
|
||||||
gulp.task('dist', gulp.series('build', 'zip'))
|
gulp.task('dist', gulp.series('apply-prod-environment', 'build', 'zip'))
|
||||||
|
|
||||||
// task generators
|
// task generators
|
||||||
|
|
||||||
|
@ -367,7 +383,6 @@ function bundleTask(opts) {
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// convert bundle stream to gulp vinyl stream
|
// convert bundle stream to gulp vinyl stream
|
||||||
.pipe(source(opts.filename))
|
.pipe(source(opts.filename))
|
||||||
// inject variables into bundle
|
// inject variables into bundle
|
||||||
|
@ -378,10 +393,7 @@ function bundleTask(opts) {
|
||||||
// loads map from browserify file
|
// loads map from browserify file
|
||||||
.pipe(gulpif(debug, sourcemaps.init({ loadMaps: true })))
|
.pipe(gulpif(debug, sourcemaps.init({ loadMaps: true })))
|
||||||
// Minification
|
// Minification
|
||||||
.pipe(babel({
|
.pipe(gulpif(opts.isBuild, uglify()))
|
||||||
presets: ['env']
|
|
||||||
}))
|
|
||||||
.pipe(uglify())
|
|
||||||
// writes .map file
|
// writes .map file
|
||||||
.pipe(gulpif(debug, sourcemaps.write('./')))
|
.pipe(gulpif(debug, sourcemaps.write('./')))
|
||||||
// write completed bundles
|
// write completed bundles
|
||||||
|
|
|
@ -200,7 +200,7 @@
|
||||||
"fs-promise": "^2.0.3",
|
"fs-promise": "^2.0.3",
|
||||||
"gulp": "github:gulpjs/gulp#4.0",
|
"gulp": "github:gulpjs/gulp#4.0",
|
||||||
"gulp-babel": "^7.0.0",
|
"gulp-babel": "^7.0.0",
|
||||||
"gulp-if": "^2.0.1",
|
"gulp-if": "^2.0.2",
|
||||||
"gulp-json-editor": "^2.2.1",
|
"gulp-json-editor": "^2.2.1",
|
||||||
"gulp-livereload": "^3.8.1",
|
"gulp-livereload": "^3.8.1",
|
||||||
"gulp-replace": "^0.6.1",
|
"gulp-replace": "^0.6.1",
|
||||||
|
@ -208,6 +208,7 @@
|
||||||
"gulp-stylefmt": "^1.1.0",
|
"gulp-stylefmt": "^1.1.0",
|
||||||
"gulp-stylelint": "^4.0.0",
|
"gulp-stylelint": "^4.0.0",
|
||||||
"gulp-uglify": "^3.0.0",
|
"gulp-uglify": "^3.0.0",
|
||||||
|
"gulp-uglify-es": "^1.0.0",
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-util": "^3.0.7",
|
||||||
"gulp-watch": "^4.3.5",
|
"gulp-watch": "^4.3.5",
|
||||||
"gulp-zip": "^4.0.0",
|
"gulp-zip": "^4.0.0",
|
||||||
|
|
71
yarn.lock
71
yarn.lock
|
@ -221,6 +221,12 @@ ansi-colors@^1.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
ansi-wrap "^0.1.0"
|
ansi-wrap "^0.1.0"
|
||||||
|
|
||||||
|
ansi-cyan@^0.1.1:
|
||||||
|
version "0.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873"
|
||||||
|
dependencies:
|
||||||
|
ansi-wrap "0.1.0"
|
||||||
|
|
||||||
ansi-escapes@^3.0.0:
|
ansi-escapes@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92"
|
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92"
|
||||||
|
@ -231,6 +237,12 @@ ansi-gray@^0.1.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
ansi-wrap "0.1.0"
|
ansi-wrap "0.1.0"
|
||||||
|
|
||||||
|
ansi-red@^0.1.1:
|
||||||
|
version "0.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c"
|
||||||
|
dependencies:
|
||||||
|
ansi-wrap "0.1.0"
|
||||||
|
|
||||||
ansi-regex@^0.2.0, ansi-regex@^0.2.1:
|
ansi-regex@^0.2.0, ansi-regex@^0.2.1:
|
||||||
version "0.2.1"
|
version "0.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9"
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9"
|
||||||
|
@ -313,6 +325,13 @@ argparse@^1.0.7:
|
||||||
dependencies:
|
dependencies:
|
||||||
sprintf-js "~1.0.2"
|
sprintf-js "~1.0.2"
|
||||||
|
|
||||||
|
arr-diff@^1.0.1:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a"
|
||||||
|
dependencies:
|
||||||
|
arr-flatten "^1.0.1"
|
||||||
|
array-slice "^0.2.3"
|
||||||
|
|
||||||
arr-diff@^2.0.0:
|
arr-diff@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
|
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
|
||||||
|
@ -339,6 +358,10 @@ arr-map@^2.0.0, arr-map@^2.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
make-iterator "^1.0.0"
|
make-iterator "^1.0.0"
|
||||||
|
|
||||||
|
arr-union@^2.0.1:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-2.1.0.tgz#20f9eab5ec70f5c7d215b1077b1c39161d292c7d"
|
||||||
|
|
||||||
arr-union@^3.1.0:
|
arr-union@^3.1.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
|
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
|
||||||
|
@ -4233,6 +4256,12 @@ express@^4.10.7, express@^4.15.5:
|
||||||
utils-merge "1.0.1"
|
utils-merge "1.0.1"
|
||||||
vary "~1.1.2"
|
vary "~1.1.2"
|
||||||
|
|
||||||
|
extend-shallow@^1.1.2:
|
||||||
|
version "1.1.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-1.1.4.tgz#19d6bf94dfc09d76ba711f39b872d21ff4dd9071"
|
||||||
|
dependencies:
|
||||||
|
kind-of "^1.1.0"
|
||||||
|
|
||||||
extend-shallow@^2.0.1:
|
extend-shallow@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
|
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
|
||||||
|
@ -4318,7 +4347,7 @@ falafel@^2.1.0:
|
||||||
isarray "0.0.1"
|
isarray "0.0.1"
|
||||||
object-keys "^1.0.6"
|
object-keys "^1.0.6"
|
||||||
|
|
||||||
fancy-log@^1.1.0:
|
fancy-log@^1.1.0, fancy-log@^1.3.2:
|
||||||
version "1.3.2"
|
version "1.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.2.tgz#f41125e3d84f2e7d89a43d06d958c8f78be16be1"
|
resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.2.tgz#f41125e3d84f2e7d89a43d06d958c8f78be16be1"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -5049,7 +5078,7 @@ gulp-eslint@^4.0.0:
|
||||||
eslint "^4.0.0"
|
eslint "^4.0.0"
|
||||||
gulp-util "^3.0.8"
|
gulp-util "^3.0.8"
|
||||||
|
|
||||||
gulp-if@^2.0.1:
|
gulp-if@^2.0.2:
|
||||||
version "2.0.2"
|
version "2.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/gulp-if/-/gulp-if-2.0.2.tgz#a497b7e7573005041caa2bc8b7dda3c80444d629"
|
resolved "https://registry.yarnpkg.com/gulp-if/-/gulp-if-2.0.2.tgz#a497b7e7573005041caa2bc8b7dda3c80444d629"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -5141,6 +5170,16 @@ gulp-stylelint@^4.0.0:
|
||||||
stylelint "^8.0.0"
|
stylelint "^8.0.0"
|
||||||
through2 "^2.0.3"
|
through2 "^2.0.3"
|
||||||
|
|
||||||
|
gulp-uglify-es@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/gulp-uglify-es/-/gulp-uglify-es-1.0.0.tgz#80b2f8e2fa7211c1706c597f08bbf620c870e545"
|
||||||
|
dependencies:
|
||||||
|
o-stream "^0.2.2"
|
||||||
|
plugin-error "^0.1.2"
|
||||||
|
uglify-es "^3.2.0"
|
||||||
|
vinyl "^2.1.0"
|
||||||
|
vinyl-sourcemaps-apply "^0.2.1"
|
||||||
|
|
||||||
gulp-uglify@^3.0.0:
|
gulp-uglify@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.0.tgz#0df0331d72a0d302e3e37e109485dddf33c6d1ca"
|
resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.0.tgz#0df0331d72a0d302e3e37e109485dddf33c6d1ca"
|
||||||
|
@ -6447,6 +6486,10 @@ keccakjs@^0.2.0:
|
||||||
browserify-sha3 "^0.0.1"
|
browserify-sha3 "^0.0.1"
|
||||||
sha3 "^1.1.0"
|
sha3 "^1.1.0"
|
||||||
|
|
||||||
|
kind-of@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44"
|
||||||
|
|
||||||
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.1.0, kind-of@^3.2.0:
|
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.1.0, kind-of@^3.2.0:
|
||||||
version "3.2.2"
|
version "3.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
|
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
|
||||||
|
@ -7723,6 +7766,10 @@ nyc@^11.0.3:
|
||||||
yargs "^10.0.3"
|
yargs "^10.0.3"
|
||||||
yargs-parser "^8.0.0"
|
yargs-parser "^8.0.0"
|
||||||
|
|
||||||
|
o-stream@^0.2.2:
|
||||||
|
version "0.2.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/o-stream/-/o-stream-0.2.2.tgz#7fe03af870b8f9537af33b312b381b3034ab410f"
|
||||||
|
|
||||||
oauth-sign@~0.8.1, oauth-sign@~0.8.2:
|
oauth-sign@~0.8.1, oauth-sign@~0.8.2:
|
||||||
version "0.8.2"
|
version "0.8.2"
|
||||||
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"
|
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"
|
||||||
|
@ -8260,6 +8307,16 @@ plucker@0.0.0:
|
||||||
version "0.0.0"
|
version "0.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/plucker/-/plucker-0.0.0.tgz#2ffa24e03ab2cffa4e75adc1df70f25623c45d09"
|
resolved "https://registry.yarnpkg.com/plucker/-/plucker-0.0.0.tgz#2ffa24e03ab2cffa4e75adc1df70f25623c45d09"
|
||||||
|
|
||||||
|
plugin-error@^0.1.2:
|
||||||
|
version "0.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-0.1.2.tgz#3b9bb3335ccf00f425e07437e19276967da47ace"
|
||||||
|
dependencies:
|
||||||
|
ansi-cyan "^0.1.1"
|
||||||
|
ansi-red "^0.1.1"
|
||||||
|
arr-diff "^1.0.1"
|
||||||
|
arr-union "^2.0.1"
|
||||||
|
extend-shallow "^1.1.2"
|
||||||
|
|
||||||
plur@^2.0.0, plur@^2.1.0, plur@^2.1.2:
|
plur@^2.0.0, plur@^2.1.0, plur@^2.1.2:
|
||||||
version "2.1.2"
|
version "2.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/plur/-/plur-2.1.2.tgz#7482452c1a0f508e3e344eaec312c91c29dc655a"
|
resolved "https://registry.yarnpkg.com/plur/-/plur-2.1.2.tgz#7482452c1a0f508e3e344eaec312c91c29dc655a"
|
||||||
|
@ -10862,6 +10919,13 @@ uglify-es@^3.0.15:
|
||||||
commander "~2.12.1"
|
commander "~2.12.1"
|
||||||
source-map "~0.6.1"
|
source-map "~0.6.1"
|
||||||
|
|
||||||
|
uglify-es@^3.2.0:
|
||||||
|
version "3.3.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.7.tgz#d1249af668666aba7cb1163e277455be9eb393cf"
|
||||||
|
dependencies:
|
||||||
|
commander "~2.13.0"
|
||||||
|
source-map "~0.6.1"
|
||||||
|
|
||||||
uglify-js@^2.6, uglify-js@^2.8.27:
|
uglify-js@^2.6, uglify-js@^2.8.27:
|
||||||
version "2.8.29"
|
version "2.8.29"
|
||||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"
|
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"
|
||||||
|
@ -10876,7 +10940,6 @@ uglify-js@^3.0.5:
|
||||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.7.tgz#28463e7c7451f89061d2b235e30925bf5625e14d"
|
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.7.tgz#28463e7c7451f89061d2b235e30925bf5625e14d"
|
||||||
dependencies:
|
dependencies:
|
||||||
commander "~2.13.0"
|
commander "~2.13.0"
|
||||||
source-map "~0.6.1"
|
|
||||||
|
|
||||||
uglify-to-browserify@~1.0.0:
|
uglify-to-browserify@~1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
|
@ -11198,7 +11261,7 @@ vinyl-sourcemap@^1.1.0:
|
||||||
remove-bom-buffer "^3.0.0"
|
remove-bom-buffer "^3.0.0"
|
||||||
vinyl "^2.0.0"
|
vinyl "^2.0.0"
|
||||||
|
|
||||||
vinyl-sourcemaps-apply@^0.2.0:
|
vinyl-sourcemaps-apply@^0.2.0, vinyl-sourcemaps-apply@^0.2.1:
|
||||||
version "0.2.1"
|
version "0.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705"
|
resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Reference in New Issue