Skip to content

Commit a4008e3

Browse files
committed
Merge pull request #637 from Dashlane/feature/377-tsconfig-exclude
Add support for exclude in tsconfig.
2 parents c725985 + e55cfc0 commit a4008e3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

dist/main/tsconfig/tsconfig.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ function getProjectSync(pathOrSrcFile) {
212212
var cwdPath = path.relative(process.cwd(), path.dirname(projectFile));
213213
if (!projectSpec.files && !projectSpec.filesGlob) {
214214
var toExpand = invisibleFilesGlob;
215+
if (projectSpec.exclude) {
216+
toExpand = toExpand.concat(projectSpec.exclude.map(function (exclude) { return '!' + exclude; }));
217+
}
215218
}
216219
if (projectSpec.filesGlob) {
217220
var toExpand = projectSpec.filesGlob;

lib/main/tsconfig/tsconfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ interface UsefulFromPackageJson {
118118
*/
119119
interface TypeScriptProjectRawSpecification {
120120
compilerOptions?: CompilerOptions;
121+
exclude?: string[]; // optional: An array of 'glob / minimatch / RegExp' patterns to specify directories / files to exclude
121122
files?: string[]; // optional: paths to files
122123
filesGlob?: string[]; // optional: An array of 'glob / minimatch / RegExp' patterns to specify source files
123124
formatCodeOptions?: formatting.FormatCodeOptions; // optional: formatting options
@@ -384,6 +385,9 @@ export function getProjectSync(pathOrSrcFile: string): TypeScriptProjectFileDeta
384385
var cwdPath = path.relative(process.cwd(), path.dirname(projectFile));
385386
if (!projectSpec.files && !projectSpec.filesGlob) { // If there is no files and no filesGlob, we create an invisible one.
386387
var toExpand = invisibleFilesGlob;
388+
if(projectSpec.exclude){
389+
toExpand = toExpand.concat(projectSpec.exclude.map((exclude) => '!' + exclude));
390+
}
387391
}
388392
if (projectSpec.filesGlob) { // If there is a files glob we will use that
389393
var toExpand = projectSpec.filesGlob

0 commit comments

Comments
 (0)