mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Merge pull request #11869 from Snuffleupagus/gulpfile-cleanup
Various smaller clean-up in `gulpfile.js`
This commit is contained in:
commit
2711f4bc8c
1 changed files with 21 additions and 19 deletions
40
gulpfile.js
40
gulpfile.js
|
@ -296,10 +296,7 @@ function replaceJSRootName(amdName, jsName) {
|
|||
);
|
||||
}
|
||||
|
||||
function createBundle(defines) {
|
||||
console.log();
|
||||
console.log("### Bundling files into pdf.js");
|
||||
|
||||
function createMainBundle(defines) {
|
||||
var mainAMDName = "pdfjs-dist/build/pdf";
|
||||
var mainOutputName = "pdf.js";
|
||||
|
||||
|
@ -309,12 +306,14 @@ function createBundle(defines) {
|
|||
libraryTarget: "umd",
|
||||
umdNamedDefine: true,
|
||||
});
|
||||
var mainOutput = gulp
|
||||
return gulp
|
||||
.src("./src/pdf.js")
|
||||
.pipe(webpack2Stream(mainFileConfig))
|
||||
.pipe(replaceWebpackRequire())
|
||||
.pipe(replaceJSRootName(mainAMDName, "pdfjsLib"));
|
||||
}
|
||||
|
||||
function createWorkerBundle(defines) {
|
||||
var workerAMDName = "pdfjs-dist/build/pdf.worker";
|
||||
var workerOutputName = "pdf.worker.js";
|
||||
|
||||
|
@ -324,13 +323,11 @@ function createBundle(defines) {
|
|||
libraryTarget: "umd",
|
||||
umdNamedDefine: true,
|
||||
});
|
||||
|
||||
var workerOutput = gulp
|
||||
return gulp
|
||||
.src("./src/pdf.worker.js")
|
||||
.pipe(webpack2Stream(workerFileConfig))
|
||||
.pipe(replaceWebpackRequire())
|
||||
.pipe(replaceJSRootName(workerAMDName, "pdfjsWorker"));
|
||||
return merge([mainOutput, workerOutput]);
|
||||
}
|
||||
|
||||
function createWebBundle(defines) {
|
||||
|
@ -677,13 +674,6 @@ gulp.task("cmaps", function (done) {
|
|||
done();
|
||||
});
|
||||
|
||||
gulp.task(
|
||||
"bundle",
|
||||
gulp.series("buildnumber", function () {
|
||||
return createBundle(DEFINES).pipe(gulp.dest(BUILD_DIR));
|
||||
})
|
||||
);
|
||||
|
||||
function preprocessCSS(source, mode, defines, cleanup) {
|
||||
var outName = getTempFile("~preprocess", ".css");
|
||||
builder.preprocessCSS(mode, source, outName);
|
||||
|
@ -713,7 +703,8 @@ function buildGeneric(defines, dir) {
|
|||
rimraf.sync(dir);
|
||||
|
||||
return merge([
|
||||
createBundle(defines).pipe(gulp.dest(dir + "build")),
|
||||
createMainBundle(defines).pipe(gulp.dest(dir + "build")),
|
||||
createWorkerBundle(defines).pipe(gulp.dest(dir + "build")),
|
||||
createWebBundle(defines).pipe(gulp.dest(dir + "web")),
|
||||
gulp.src(COMMON_WEB_FILES, { base: "web/" }).pipe(gulp.dest(dir + "web")),
|
||||
gulp.src("LICENSE").pipe(gulp.dest(dir)),
|
||||
|
@ -847,7 +838,8 @@ gulp.task(
|
|||
rimraf.sync(MINIFIED_DIR);
|
||||
|
||||
return merge([
|
||||
createBundle(defines).pipe(gulp.dest(MINIFIED_DIR + "build")),
|
||||
createMainBundle(defines).pipe(gulp.dest(MINIFIED_DIR + "build")),
|
||||
createWorkerBundle(defines).pipe(gulp.dest(MINIFIED_DIR + "build")),
|
||||
createWebBundle(defines).pipe(gulp.dest(MINIFIED_DIR + "web")),
|
||||
createImageDecodersBundle(
|
||||
builder.merge(defines, { IMAGE_DECODERS: true })
|
||||
|
@ -1007,7 +999,12 @@ gulp.task(
|
|||
];
|
||||
|
||||
return merge([
|
||||
createBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + "build")),
|
||||
createMainBundle(defines).pipe(
|
||||
gulp.dest(MOZCENTRAL_CONTENT_DIR + "build")
|
||||
),
|
||||
createWorkerBundle(defines).pipe(
|
||||
gulp.dest(MOZCENTRAL_CONTENT_DIR + "build")
|
||||
),
|
||||
createWebBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + "web")),
|
||||
gulp
|
||||
.src(MOZCENTRAL_COMMON_WEB_FILES, { base: "web/" })
|
||||
|
@ -1062,7 +1059,12 @@ gulp.task(
|
|||
var version = getVersionJSON().version;
|
||||
|
||||
return merge([
|
||||
createBundle(defines).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + "build")),
|
||||
createMainBundle(defines).pipe(
|
||||
gulp.dest(CHROME_BUILD_CONTENT_DIR + "build")
|
||||
),
|
||||
createWorkerBundle(defines).pipe(
|
||||
gulp.dest(CHROME_BUILD_CONTENT_DIR + "build")
|
||||
),
|
||||
createWebBundle(defines).pipe(
|
||||
gulp.dest(CHROME_BUILD_CONTENT_DIR + "web")
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue