Skip to content

Commit 3965430

Browse files
committed
Fix the gulp types task to run on Windows, and place the TypeScript definitions correctly in pdfjs-dist
- Fix the `gulp types` task to run on Windows. Currently this fails, and the solution was to "borrow" the same formatting as used in the `gulp jsdoc` task. - Place the TypeScript definitions in their own `types` directory, when building `pdfjs-dist`. These should *not* be cluttering the main `build` directory, especially since the generated TypeScript definitions consists of *multiple folders*. (Only if the TypeScript definitions would be concatenated into *a single file*, would placing them directly in `pdfjs-dist/build` be acceptable.)
1 parent e68ac05 commit 3965430

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

gulpfile.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ gulp.task("types", function (done) {
11541154
"forceConsistentCasingInFileNames",
11551155
"emitDeclarationOnly",
11561156
].join(" --");
1157-
exec(`node_modules/.bin/tsc --${args} src/pdf.js`, done);
1157+
exec(`"node_modules/.bin/tsc" --${args} src/pdf.js`, done);
11581158
});
11591159

11601160
function buildLib(defines, dir) {
@@ -1373,8 +1373,8 @@ gulp.task(
13731373
])
13741374
.pipe(gulp.dest(TYPESTEST_DIR + "build/")),
13751375
gulp
1376-
.src(TYPES_BUILD_DIR + "**/**")
1377-
.pipe(gulp.dest(TYPESTEST_DIR + "build/")),
1376+
.src(TYPES_BUILD_DIR + "**/*", { base: TYPES_BUILD_DIR })
1377+
.pipe(gulp.dest(TYPESTEST_DIR + "types/")),
13781378
]);
13791379
},
13801380
function (done) {
@@ -1630,17 +1630,19 @@ gulp.task(
16301630

16311631
function packageBowerJson() {
16321632
var VERSION = getVersionJSON().version;
1633+
16331634
var DIST_NAME = "pdfjs-dist";
16341635
var DIST_DESCRIPTION = "Generic build of Mozilla's PDF.js library.";
16351636
var DIST_KEYWORDS = ["Mozilla", "pdf", "pdf.js"];
16361637
var DIST_HOMEPAGE = "http://mozilla.github.io/pdf.js/";
16371638
var DIST_BUGS_URL = "https://github.com/mozilla/pdf.js/issues";
16381639
var DIST_LICENSE = "Apache-2.0";
1640+
16391641
var npmManifest = {
16401642
name: DIST_NAME,
16411643
version: VERSION,
16421644
main: "build/pdf.js",
1643-
types: "build/pdf.d.ts",
1645+
types: "types/pdf.d.ts",
16441646
description: DIST_DESCRIPTION,
16451647
keywords: DIST_KEYWORDS,
16461648
homepage: DIST_HOMEPAGE,
@@ -1660,6 +1662,7 @@ function packageBowerJson() {
16601662
url: DIST_REPO_URL,
16611663
},
16621664
};
1665+
16631666
var bowerManifest = {
16641667
name: DIST_NAME,
16651668
version: VERSION,
@@ -1753,8 +1756,8 @@ gulp.task(
17531756
.src(LIB_DIR + "**/*", { base: LIB_DIR })
17541757
.pipe(gulp.dest(DIST_DIR + "lib/")),
17551758
gulp
1756-
.src(TYPES_BUILD_DIR + "**/**")
1757-
.pipe(gulp.dest(DIST_DIR + "build/")),
1759+
.src(TYPES_BUILD_DIR + "**/*", { base: TYPES_BUILD_DIR })
1760+
.pipe(gulp.dest(DIST_DIR + "types/")),
17581761
]);
17591762
}
17601763
)

0 commit comments

Comments
 (0)