From bbf11a5783801d5a711235f1357a1d2f68d83be4 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Thu, 31 Aug 2023 12:41:25 +0200 Subject: [PATCH] Migrate the typescript options to a config file Some configurations settings like `paths` cannot be provided through CLI arguments but only in a configuration file. And when using a configuration file, only a few options (like `--outDir` can still be provided) through the CLI. --- gulpfile.mjs | 13 +------------ tsconfig.json | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 tsconfig.json diff --git a/gulpfile.mjs b/gulpfile.mjs index 311c0ba9d..2eae8336a 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -1549,19 +1549,8 @@ gulp.task("jsdoc", function (done) { gulp.task("types", function (done) { console.log("### Generating TypeScript definitions using `tsc`"); - const args = [ - "target ESNext", - "allowJS", - "declaration", - `outDir ${TYPES_DIR}`, - "strict", - "esModuleInterop", - "forceConsistentCasingInFileNames", - "emitDeclarationOnly", - "moduleResolution node", - ].join(" --"); exec( - `"node_modules/.bin/tsc" --${args} src/pdf.js web/pdf_viewer.component.js`, + `"node_modules/.bin/tsc" --outDir ${TYPES_DIR} --project .`, done ); }); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..346bcd2cc --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ESNext", + "allowJs": true, + "declaration": true, + "strict": true, + "emitDeclarationOnly": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "node" + }, + "files": [ + "src/pdf.js", + "web/pdf_viewer.component.js" + ] +}