()
| 106 | * @returns The config object |
| 107 | */ |
| 108 | export const parseTypeScriptConfigFiles = () => { |
| 109 | const rwPaths = getPaths() |
| 110 | |
| 111 | const parseConfigFile = (basePath: string) => { |
| 112 | let configPath = path.join(basePath, 'tsconfig.json') |
| 113 | if (!fs.existsSync(configPath)) { |
| 114 | configPath = path.join(basePath, 'jsconfig.json') |
| 115 | if (!fs.existsSync(configPath)) { |
| 116 | return null |
| 117 | } |
| 118 | } |
| 119 | return parseConfigFileTextToJson( |
| 120 | configPath, |
| 121 | fs.readFileSync(configPath, 'utf-8'), |
| 122 | ) |
| 123 | } |
| 124 | const apiConfig = parseConfigFile(rwPaths.api.base) |
| 125 | const webConfig = parseConfigFile(rwPaths.web.base) |
| 126 | |
| 127 | return { |
| 128 | api: apiConfig?.config ?? null, |
| 129 | web: webConfig?.config ?? null, |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | type CompilerOptionsForPaths = { |
| 134 | compilerOptions: { baseUrl: string; paths: Record<string, string[]> } |
no test coverage detected