From e55cfc01baf015154ec5d4914e07398a2da61956 Mon Sep 17 00:00:00 2001 From: Tanguy Le Barzic Date: Fri, 2 Oct 2015 19:03:34 +0200 Subject: [PATCH] Add support for exclude in tsconfig. Please note that contrary to https://github.com/Microsoft/TypeScript/pull/3188, this support globs. --- dist/main/tsconfig/tsconfig.js | 3 +++ lib/main/tsconfig/tsconfig.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dist/main/tsconfig/tsconfig.js b/dist/main/tsconfig/tsconfig.js index 715c0d6f7..a49f2553f 100644 --- a/dist/main/tsconfig/tsconfig.js +++ b/dist/main/tsconfig/tsconfig.js @@ -212,6 +212,9 @@ function getProjectSync(pathOrSrcFile) { var cwdPath = path.relative(process.cwd(), path.dirname(projectFile)); if (!projectSpec.files && !projectSpec.filesGlob) { var toExpand = invisibleFilesGlob; + if (projectSpec.exclude) { + toExpand = toExpand.concat(projectSpec.exclude.map(function (exclude) { return '!' + exclude; })); + } } if (projectSpec.filesGlob) { var toExpand = projectSpec.filesGlob; diff --git a/lib/main/tsconfig/tsconfig.ts b/lib/main/tsconfig/tsconfig.ts index f582c0c81..51384d049 100644 --- a/lib/main/tsconfig/tsconfig.ts +++ b/lib/main/tsconfig/tsconfig.ts @@ -118,6 +118,7 @@ interface UsefulFromPackageJson { */ interface TypeScriptProjectRawSpecification { compilerOptions?: CompilerOptions; + exclude?: string[]; // optional: An array of 'glob / minimatch / RegExp' patterns to specify directories / files to exclude files?: string[]; // optional: paths to files filesGlob?: string[]; // optional: An array of 'glob / minimatch / RegExp' patterns to specify source files formatCodeOptions?: formatting.FormatCodeOptions; // optional: formatting options @@ -384,6 +385,9 @@ export function getProjectSync(pathOrSrcFile: string): TypeScriptProjectFileDeta var cwdPath = path.relative(process.cwd(), path.dirname(projectFile)); if (!projectSpec.files && !projectSpec.filesGlob) { // If there is no files and no filesGlob, we create an invisible one. var toExpand = invisibleFilesGlob; + if(projectSpec.exclude){ + toExpand = toExpand.concat(projectSpec.exclude.map((exclude) => '!' + exclude)); + } } if (projectSpec.filesGlob) { // If there is a files glob we will use that var toExpand = projectSpec.filesGlob