Skip to content

Commit

Permalink
fix(jsii): excessive "exclude" in "tsconfig.json" (#1736)
Browse files Browse the repository at this point in the history
In cases where both `jsii.tsc.outDir` and `jsii.tsc.rootDir` are set, and `rootDir` happens to be a parent directory of `outDir`, the generated `exclude` would match all files from `rootDir`, resulting in an empty input set.

This makes sure to not emit an `exclude` declaration for `outDir` in this case, so that input files do not get excluded.



---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
  • Loading branch information
RomainMuller committed Feb 15, 2021
1 parent bfb2c71 commit ecffb9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/@scope/jsii-calc-base-of-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"engines": {
"node": ">= 10.3.0"
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "build/lib/index.js",
"types": "build/lib/index.d.ts",
"scripts": {
"build": "jsii --project-references && jsii-rosetta",
"pacmak": "jsii-pacmak",
Expand Down Expand Up @@ -58,6 +58,10 @@
"module": "scope.jsii_calc_base_of_base"
}
},
"tsc": {
"outDir": "./build",
"rootDir": "."
},
"versionFormat": "short",
"metadata": {
"jsii": {
Expand Down
8 changes: 6 additions & 2 deletions packages/jsii/lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,12 @@ export class Compiler implements Emitter {
],
exclude: [
'node_modules',
...pi.excludeTypescript,
...(pi.tsc?.outDir != null
...(pi.excludeTypescript ?? []),
...(pi.tsc?.outDir != null &&
(pi.tsc?.rootDir == null ||
path
.resolve(pi.tsc.outDir)
.startsWith(path.resolve(pi.tsc.rootDir) + path.sep))
? [path.join(pi.tsc.outDir, '**', '*.ts')]
: []),
],
Expand Down

0 comments on commit ecffb9f

Please sign in to comment.