Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 027e587

Browse files
authored
Merge pull request #943 from microsoft/hellyzh/updatedependency
update dependencies
2 parents 39d13d0 + 0137e4e commit 027e587

10 files changed

+4362
-4979
lines changed

gulpfile.js

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
const gulp = require("gulp");
22
const eslint = require('gulp-eslint');
33
const tslint = require("gulp-tslint");
4-
const gutil = require("gulp-util");
4+
const PluginError = require('plugin-error');
5+
const log = require('fancy-log');
56
const ts = require("gulp-typescript");
67
const sourcemaps = require("gulp-sourcemaps");
78
const webpack = require("webpack");
8-
const runSequence = require('run-sequence');
99
const del = require('del');
10-
1110
const fs = require("fs");
1211
const fsp = require('fs-plus');
1312
const path = require("path");
1413
const childProcess = require("child_process");
14+
const argv = require('minimist')(process.argv.slice(2));
1515

1616
//...
1717
gulp.task("tslint", () => {
@@ -30,33 +30,35 @@ gulp.task("eslint", () => {
3030
gulp.task("html-webpack", (done) => {
3131
const config = require("./src/views/webpack.config.js");
3232
config.context = `${__dirname}/src/views`;
33+
config.mode = argv.mode ? argv.mode : 'production';
3334
return webpack(config, (err, stats) => {
3435
const statsJson = stats.toJson();
3536
if (err || (statsJson.errors && statsJson.errors.length)) {
3637
statsJson.errors.forEach(webpackError => {
37-
gutil.log(gutil.colors.red(`Error (webpack): ${webpackError}`));
38+
log.error(`Error (webpack): ${webpackError}`);
3839
});
3940

40-
throw new gutil.PluginError('webpack', JSON.stringify(err || statsJson.errors));
41+
throw new PluginError('webpack', JSON.stringify(err || statsJson.errors));
4142
}
42-
gutil.log('[webpack]', stats.toString());
43+
log('[webpack]', stats.toString());
4344
done();
4445
});
4546
});
4647

4748
gulp.task("node_modules-webpack", (done) => {
4849
const config = require("./webpack.config.js");
4950
config.context = `${__dirname}`;
51+
config.mode = argv.mode ? argv.mode : 'production';
5052
return webpack(config, (err, stats) => {
5153
const statsJson = stats.toJson();
5254
if (err || (statsJson.errors && statsJson.errors.length)) {
5355
statsJson.errors.forEach(webpackError => {
54-
gutil.log(gutil.colors.red(`Error (webpack): ${webpackError}`));
56+
log.error(`Error (webpack): ${webpackError}`);
5557
});
5658

57-
throw new gutil.PluginError('webpack', JSON.stringify(err || statsJson.errors));
59+
throw new PluginError('webpack', JSON.stringify(err || statsJson.errors));
5860
}
59-
gutil.log('[webpack]', stats.toString());
61+
log('[webpack]', stats.toString());
6062
done();
6163
});
6264
});
@@ -92,7 +94,8 @@ gulp.task("genAikey", (done) => {
9294
fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2) + "\n");
9395
done();
9496
} else {
95-
gutil.log("Skipping genAiKey");
97+
log("Skipping genAiKey");
98+
done();
9699
}
97100
});
98101

@@ -124,35 +127,31 @@ gulp.task("test", (done) => {
124127
});
125128

126129
child.stdout.on("data", (data) => {
127-
gutil.log(data.toString().trim());
130+
log(data.toString().trim());
128131
});
129132

130133
child.stderr.on("data", (data) => {
131-
gutil.log(gutil.colors.red(data.toString().trim()));
134+
log.error(data.toString().trim());
132135
});
133136

134137
child.on("error", (error) => {
135-
gutil.log(gutil.colors.red(error));
138+
log.error(error);
136139
});
137140

138141
child.on("exit", (code) => {
139142
restoreExtensionDependencies();
140143
if (code === 0) {
141144
done();
142145
} else {
143-
gutil.log("exit code: " + code);
146+
log.error("exit code: " + code);
144147
done(code);
145148
}
146149
});
147150
});
148151

149-
gulp.task("build", (done) => {
150-
return runSequence("clean", "ts-compile", "html-webpack", "node_modules-webpack", "copyVendor", done);
151-
});
152+
gulp.task("build", gulp.series("clean", "ts-compile", "html-webpack", "node_modules-webpack", "copyVendor"));
152153

153-
gulp.task("build_without_view", (done) => {
154-
return runSequence("clean", "ts-compile", done);
155-
});
154+
gulp.task("build_without_view", gulp.series("clean", "ts-compile"));
156155

157156
gulp.task("watch", () => {
158157
gulp.watch(["./src/**/*", "./test/**/*", "!./src/views/**/*"], ["ts-compile"]);

0 commit comments

Comments
 (0)