Skip to content

Commit

Permalink
Fix the gulp types task to run on Windows, and place the TypeScript…
Browse files Browse the repository at this point in the history
… 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.)
  • Loading branch information
Snuffleupagus committed Aug 4, 2020
1 parent e68ac05 commit 930e4e6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ gulp.task("types", function (done) {
"forceConsistentCasingInFileNames",
"emitDeclarationOnly",
].join(" --");
exec(`node_modules/.bin/tsc --${args} src/pdf.js`, done);
exec(`"node_modules/.bin/tsc" --${args} src/pdf.js`, done);
});

function buildLib(defines, dir) {
Expand Down Expand Up @@ -1630,17 +1630,19 @@ gulp.task(

function packageBowerJson() {
var VERSION = getVersionJSON().version;

var DIST_NAME = "pdfjs-dist";
var DIST_DESCRIPTION = "Generic build of Mozilla's PDF.js library.";
var DIST_KEYWORDS = ["Mozilla", "pdf", "pdf.js"];
var DIST_HOMEPAGE = "http://mozilla.github.io/pdf.js/";
var DIST_BUGS_URL = "https://github.com/mozilla/pdf.js/issues";
var DIST_LICENSE = "Apache-2.0";

var npmManifest = {
name: DIST_NAME,
version: VERSION,
main: "build/pdf.js",
types: "build/pdf.d.ts",
types: "types/pdf.d.ts",
description: DIST_DESCRIPTION,
keywords: DIST_KEYWORDS,
homepage: DIST_HOMEPAGE,
Expand All @@ -1660,6 +1662,7 @@ function packageBowerJson() {
url: DIST_REPO_URL,
},
};

var bowerManifest = {
name: DIST_NAME,
version: VERSION,
Expand Down Expand Up @@ -1753,8 +1756,8 @@ gulp.task(
.src(LIB_DIR + "**/*", { base: LIB_DIR })
.pipe(gulp.dest(DIST_DIR + "lib/")),
gulp
.src(TYPES_BUILD_DIR + "**/**")
.pipe(gulp.dest(DIST_DIR + "build/")),
.src(TYPES_BUILD_DIR + "**/*", { base: TYPES_BUILD_DIR })
.pipe(gulp.dest(DIST_DIR + "types/")),
]);
}
)
Expand Down

0 comments on commit 930e4e6

Please sign in to comment.