From c32e8dca579985dd3ee434a07b1f7d39f79d51d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BC=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier-Muller?= Date: Mon, 15 Jun 2020 11:31:48 +0200 Subject: [PATCH 1/2] fix(jsii): excessive "exclude" in "tsconfig.json" 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 mathc 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. --- packages/jsii/lib/compiler.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/jsii/lib/compiler.ts b/packages/jsii/lib/compiler.ts index a7d445c2bf..dbc9720f19 100644 --- a/packages/jsii/lib/compiler.ts +++ b/packages/jsii/lib/compiler.ts @@ -289,8 +289,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')] : []), ], From 5f63dd61a2ff2ab9aad270741575cb029cf40a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BC=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier-Muller?= Date: Wed, 12 Aug 2020 14:55:48 +0200 Subject: [PATCH 2/2] add demonstration in @scope/jsii-calc-base-of-base --- packages/@scope/jsii-calc-base-of-base/package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/@scope/jsii-calc-base-of-base/package.json b/packages/@scope/jsii-calc-base-of-base/package.json index 8ebf4c8a96..eb8cf1ac5a 100644 --- a/packages/@scope/jsii-calc-base-of-base/package.json +++ b/packages/@scope/jsii-calc-base-of-base/package.json @@ -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", "test": "diff-test test/assembly.jsii .jsii", @@ -56,6 +56,10 @@ "module": "scope.jsii_calc_base_of_base" } }, + "tsc": { + "outDir": "./build", + "rootDir": "." + }, "versionFormat": "short" } }