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
4 changed files with 32 additions and 5 deletions

View File

@@ -13,6 +13,9 @@
const path = require("path");
const pump = require("pump");
const chalk = require("chalk");
const through = require("through2");
const gutil = require("gulp-util");
const rename = require("gulp-rename");
const RootMostResolvePlugin = require("webpack-dependency-suite")
.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(
gulp,
name,
@@ -116,8 +143,9 @@ function registerStandalonePackageTask(
}),
gulp.dest(standalonePath),
].concat(
// Minification is super slow, so we skip it in CI.
process.env.CI ? [] : uglify(),
// Minification is super slow, so we skip it unless we are publishing
process.env.IS_PUBLISH ? logUglify() : logNoUglify(),
process.env.IS_PUBLISH ? uglify() : [],
rename({ extname: ".min.js" }),
gulp.dest(standalonePath)
),