( pkg: TsPackageInfo, hasOverrides: boolean, hasScripts: boolean )
| 257 | } |
| 258 | |
| 259 | function buildTSConfig( |
| 260 | pkg: TsPackageInfo, |
| 261 | hasOverrides: boolean, |
| 262 | hasScripts: boolean |
| 263 | ) { |
| 264 | const paths: Record<string, string[]> = {}; |
| 265 | const referencePaths = new Set(); |
| 266 | |
| 267 | for (const name of pkg.dependencies) { |
| 268 | // @ts-expect-error name must be a key in tsPkgs |
| 269 | const { relative, subExports } = tsPkgs.get(name); |
| 270 | for (const [subExport, subExportPath] of subExports) { |
| 271 | paths[name + subExport] = ["../../" + relative.slice(2) + subExportPath]; |
| 272 | } |
| 273 | referencePaths.add("../../" + projectsFolders.get(name).slice(2)); |
| 274 | } |
| 275 | |
| 276 | return { |
| 277 | extends: [ |
| 278 | "../../tsconfig.base.json", |
| 279 | "../../tsconfig.paths.json", |
| 280 | hasOverrides && "./tsconfig.overrides.json", |
| 281 | ].filter(Boolean), |
| 282 | include: [ |
| 283 | "./src/**/*.ts", |
| 284 | "./src/**/*.cts", |
| 285 | pkg.name === "@babel/register" && "./src/**/*.mts", |
| 286 | pkg.name === "@babel/standalone" && "./types.d.ts", |
| 287 | hasScripts && "./scripts/**/*.ts", |
| 288 | "../../lib/globals.d.ts", |
| 289 | "../../scripts/repo-utils/*.d.ts", |
| 290 | ].filter(Boolean), |
| 291 | references: Array.from(referencePaths, path => ({ path })), |
| 292 | }; |
| 293 | } |
| 294 | |
| 295 | maybeWriteFile( |
| 296 | new URL("tsconfig.paths.json", rootURL), |
no test coverage detected