|
| 1 | +diff --git a/node_modules/@jqassistant/ts-lce/dist/src/core/utils/project.utils.js b/node_modules/@jqassistant/ts-lce/dist/src/core/utils/project.utils.js |
| 2 | +index d1c33c4..672e6a1 100644 |
| 3 | +--- a/node_modules/@jqassistant/ts-lce/dist/src/core/utils/project.utils.js |
| 4 | ++++ b/node_modules/@jqassistant/ts-lce/dist/src/core/utils/project.utils.js |
| 5 | +@@ -35,7 +35,7 @@ class ProjectUtils { |
| 6 | + const projectRoot = dirsToScan[0]; |
| 7 | + const tsConfigPath = path_1.default.join(projectRoot, "tsconfig.json"); |
| 8 | + if (fs_1.default.existsSync(tsConfigPath)) { |
| 9 | +- result.push(...this.getProjectInfo(projectRoot)); |
| 10 | ++ result.push(...this.getProjectInfo(projectRoot, 'tsconfig.json')); |
| 11 | + } |
| 12 | + else { |
| 13 | + // add all subdirectories as potential project candidates |
| 14 | +@@ -61,13 +61,19 @@ class ProjectUtils { |
| 15 | + } |
| 16 | + }); |
| 17 | + } |
| 18 | +- static getProjectInfo(projectPath) { |
| 19 | ++ static getConfigFileName(rawConfigPath) { |
| 20 | ++ const pathIsADirectory = fs_1.default.statSync(rawConfigPath).isDirectory(); |
| 21 | ++ const defaultConfigFileName = 'tsconfig.json'; |
| 22 | ++ return pathIsADirectory? path_1.default.join(rawConfigPath, defaultConfigFileName) : rawConfigPath; |
| 23 | ++ } |
| 24 | ++ static getProjectInfo(projectPath, configFileName) { |
| 25 | + const result = []; |
| 26 | +- const tsConfig = this.parseTsConfig(projectPath); |
| 27 | ++ const tsConfig = this.parseTsConfig(projectPath, configFileName); |
| 28 | + const subProjectPaths = []; |
| 29 | + if (tsConfig.projectReferences) { |
| 30 | + for (const ref of tsConfig.projectReferences) { |
| 31 | +- const subProjectInfos = this.getProjectInfo(ref.path); |
| 32 | ++ const referencedConfigFileName = this.getConfigFileName(ref.path); |
| 33 | ++ const subProjectInfos = this.getProjectInfo(path_1.default.dirname(referencedConfigFileName), path_1.default.basename(referencedConfigFileName)); |
| 34 | + subProjectPaths.push(...subProjectInfos.map(spi => spi.projectPath.replace(/\\/g, "/"))); |
| 35 | + result.push(...subProjectInfos); |
| 36 | + } |
| 37 | +@@ -85,10 +91,10 @@ class ProjectUtils { |
| 38 | + }); |
| 39 | + return result; |
| 40 | + } |
| 41 | +- static parseTsConfig(projectRoot) { |
| 42 | +- const tsConfigPath = path_1.default.join(projectRoot, "tsconfig.json"); |
| 43 | ++ static parseTsConfig(projectRoot, configFile) { |
| 44 | ++ const tsConfigPath = path_1.default.join(projectRoot, configFile); |
| 45 | + const configFileText = fs_1.default.readFileSync(tsConfigPath, 'utf8'); |
| 46 | +- const configFileSourceFile = (0, typescript_1.createSourceFile)('tsconfig.json', configFileText, typescript_1.ScriptTarget.JSON); |
| 47 | ++ const configFileSourceFile = (0, typescript_1.createSourceFile)(configFile, configFileText, typescript_1.ScriptTarget.JSON); |
| 48 | + // Parse the tsconfig.json |
| 49 | + const parsedCommandLine = (0, typescript_1.parseJsonSourceFileConfigFileContent)(configFileSourceFile, typescript_1.sys, path_1.default.dirname(tsConfigPath)); |
| 50 | + // explicitly set rootDir option to default value, if not set manually |
0 commit comments