Improve the typestest
target in the Gulpfile
This commit: - moves the preparation work to a new `typestest-pre` target similar to how the other targets work; - moves the `TYPESTEST_DIR` definition to the top of the file like we did for all other directory variables; - renames the `TYPES_BUILD_DIR` variable to `TYPES_DIR` since it's shorter and the naming scheme then corresponds to the other directory variables; - switches to `const`/template strings in the types targets where needed; - converts the `if (err !== null)` check to `if (err)` similar to other targets.
This commit is contained in:
parent
9989879458
commit
7e759c6e2b
47
gulpfile.js
47
gulpfile.js
@ -63,7 +63,8 @@ var GH_PAGES_DIR = BUILD_DIR + "gh-pages/";
|
|||||||
var SRC_DIR = "src/";
|
var SRC_DIR = "src/";
|
||||||
var LIB_DIR = BUILD_DIR + "lib/";
|
var LIB_DIR = BUILD_DIR + "lib/";
|
||||||
var DIST_DIR = BUILD_DIR + "dist/";
|
var DIST_DIR = BUILD_DIR + "dist/";
|
||||||
var TYPES_BUILD_DIR = BUILD_DIR + "types/";
|
var TYPES_DIR = BUILD_DIR + "types/";
|
||||||
|
var TYPESTEST_DIR = BUILD_DIR + "typestest/";
|
||||||
var COMMON_WEB_FILES = ["web/images/*.{png,svg,gif,cur}", "web/debugger.js"];
|
var COMMON_WEB_FILES = ["web/images/*.{png,svg,gif,cur}", "web/debugger.js"];
|
||||||
var MOZCENTRAL_DIFF_FILE = "mozcentral.diff";
|
var MOZCENTRAL_DIFF_FILE = "mozcentral.diff";
|
||||||
|
|
||||||
@ -1143,12 +1144,12 @@ gulp.task("jsdoc", function (done) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("types", function (done) {
|
gulp.task("types", function (done) {
|
||||||
console.log("### Generating typescript definitions using tsc");
|
console.log("### Generating TypeScript definitions using `tsc`");
|
||||||
var args = [
|
const args = [
|
||||||
"target ES2020",
|
"target ES2020",
|
||||||
"allowJS",
|
"allowJS",
|
||||||
"declaration",
|
"declaration",
|
||||||
`outDir ${TYPES_BUILD_DIR}`,
|
`outDir ${TYPES_DIR}`,
|
||||||
"strict",
|
"strict",
|
||||||
"esModuleInterop",
|
"esModuleInterop",
|
||||||
"forceConsistentCasingInFileNames",
|
"forceConsistentCasingInFileNames",
|
||||||
@ -1353,16 +1354,9 @@ gulp.task(
|
|||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"typestest",
|
"typestest-pre",
|
||||||
gulp.series(
|
gulp.series("testing-pre", "generic", "types", function () {
|
||||||
"testing-pre",
|
const [packageJsonSrc] = packageBowerJson();
|
||||||
"generic",
|
|
||||||
"types",
|
|
||||||
|
|
||||||
function () {
|
|
||||||
var packageJsonSrc = packageBowerJson()[0];
|
|
||||||
var TYPESTEST_DIR = BUILD_DIR + "typestest/";
|
|
||||||
|
|
||||||
return merge([
|
return merge([
|
||||||
packageJsonSrc.pipe(gulp.dest(TYPESTEST_DIR)),
|
packageJsonSrc.pipe(gulp.dest(TYPESTEST_DIR)),
|
||||||
gulp
|
gulp
|
||||||
@ -1372,20 +1366,21 @@ gulp.task(
|
|||||||
SRC_DIR + "pdf.worker.entry.js",
|
SRC_DIR + "pdf.worker.entry.js",
|
||||||
])
|
])
|
||||||
.pipe(gulp.dest(TYPESTEST_DIR + "build/")),
|
.pipe(gulp.dest(TYPESTEST_DIR + "build/")),
|
||||||
gulp
|
gulp.src(TYPES_DIR + "**/**").pipe(gulp.dest(TYPESTEST_DIR + "build/")),
|
||||||
.src(TYPES_BUILD_DIR + "**/**")
|
|
||||||
.pipe(gulp.dest(TYPESTEST_DIR + "build/")),
|
|
||||||
]);
|
]);
|
||||||
},
|
})
|
||||||
function (done) {
|
);
|
||||||
exec(`node_modules/.bin/tsc -p test/types`, function (err, stdout) {
|
|
||||||
if (err !== null) {
|
gulp.task(
|
||||||
console.log("couldn't compile typescript test: " + stdout);
|
"typestest",
|
||||||
|
gulp.series("typestest-pre", function (done) {
|
||||||
|
exec("node_modules/.bin/tsc -p test/types", function (err, stdout) {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Couldn't compile TypeScript test: ${stdout}`);
|
||||||
}
|
}
|
||||||
done(err);
|
done(err);
|
||||||
});
|
});
|
||||||
}
|
})
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task("baseline", function (done) {
|
gulp.task("baseline", function (done) {
|
||||||
@ -1752,9 +1747,7 @@ gulp.task(
|
|||||||
gulp
|
gulp
|
||||||
.src(LIB_DIR + "**/*", { base: LIB_DIR })
|
.src(LIB_DIR + "**/*", { base: LIB_DIR })
|
||||||
.pipe(gulp.dest(DIST_DIR + "lib/")),
|
.pipe(gulp.dest(DIST_DIR + "lib/")),
|
||||||
gulp
|
gulp.src(TYPES_DIR + "**/**").pipe(gulp.dest(DIST_DIR + "build/")),
|
||||||
.src(TYPES_BUILD_DIR + "**/**")
|
|
||||||
.pipe(gulp.dest(DIST_DIR + "build/")),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user