Skip minifying standalone (#9094)

Also remove unused dependency on uglify js. gulp-uglify uses its own version.
This commit is contained in:
Daniel Tschinder 2018-11-28 12:36:24 -08:00 committed by GitHub
parent 3fda01b185
commit 559d649994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 5 deletions

View File

@ -115,7 +115,7 @@ prepublish-build:
rm -rf packages/babel-runtime/helpers rm -rf packages/babel-runtime/helpers
rm -rf packages/babel-runtime-corejs2/helpers rm -rf packages/babel-runtime-corejs2/helpers
rm -rf packages/babel-runtime-corejs2/core-js rm -rf packages/babel-runtime-corejs2/core-js
BABEL_ENV=production make build-dist BABEL_ENV=production IS_PUBLISH=true make build-dist
make clone-license make clone-license
prepublish: prepublish:

View File

@ -63,7 +63,6 @@
"rollup-stream": "^1.24.1", "rollup-stream": "^1.24.1",
"test262-stream": "^1.2.0", "test262-stream": "^1.2.0",
"through2": "^2.0.0", "through2": "^2.0.0",
"uglify-js": "^2.4.16",
"vinyl-buffer": "^1.0.1", "vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0", "vinyl-source-stream": "^2.0.0",
"webpack": "^3.4.1", "webpack": "^3.4.1",

View File

@ -13,6 +13,9 @@
const path = require("path"); const path = require("path");
const pump = require("pump"); const pump = require("pump");
const chalk = require("chalk");
const through = require("through2");
const gutil = require("gulp-util");
const rename = require("gulp-rename"); const rename = require("gulp-rename");
const RootMostResolvePlugin = require("webpack-dependency-suite") const RootMostResolvePlugin = require("webpack-dependency-suite")
.RootMostResolvePlugin; .RootMostResolvePlugin;
@ -94,6 +97,30 @@ function webpackBuild(opts) {
});*/ });*/
} }
function logUglify() {
return through.obj(function(file, enc, callback) {
gutil.log(
`Minifying '${chalk.cyan(
path.relative(path.join(__dirname, ".."), file.path)
)}'...`
);
callback(null, file);
});
}
function logNoUglify() {
return through.obj(function(file, enc, callback) {
gutil.log(
chalk.yellow(
`Skipped minification of '${chalk.cyan(
path.relative(path.join(__dirname, ".."), file.path)
)}' because not publishing`
)
);
callback(null, file);
});
}
function registerStandalonePackageTask( function registerStandalonePackageTask(
gulp, gulp,
name, name,
@ -116,8 +143,9 @@ function registerStandalonePackageTask(
}), }),
gulp.dest(standalonePath), gulp.dest(standalonePath),
].concat( ].concat(
// Minification is super slow, so we skip it in CI. // Minification is super slow, so we skip it unless we are publishing
process.env.CI ? [] : uglify(), process.env.IS_PUBLISH ? logUglify() : logNoUglify(),
process.env.IS_PUBLISH ? uglify() : [],
rename({ extname: ".min.js" }), rename({ extname: ".min.js" }),
gulp.dest(standalonePath) gulp.dest(standalonePath)
), ),

View File

@ -9357,7 +9357,7 @@ uglify-js@3.3.x, uglify-js@^3.0.5:
commander "~2.14.1" commander "~2.14.1"
source-map "~0.6.1" source-map "~0.6.1"
uglify-js@^2.4.16, uglify-js@^2.6, uglify-js@^2.8.29: uglify-js@^2.6, uglify-js@^2.8.29:
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"
integrity sha1-KcVzMUgFe7Th913zW3qcty5qWd0= integrity sha1-KcVzMUgFe7Th913zW3qcty5qWd0=