| 197 | // eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 198 | onTaskStart(projects, weight) {}, |
| 199 | async onTaskDone(projects, code, duration) { |
| 200 | if (code !== 0) process.exitCode = code; |
| 201 | |
| 202 | await Promise.all( |
| 203 | projects.map(async project => { |
| 204 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion |
| 205 | const { include: projectFiles } = JSON5.parse( |
| 206 | readFileSync(resolvePath(project, "tsconfig.json"), "utf8") |
| 207 | ) as { include?: string[] }; |
| 208 | if (!projectFiles) return; |
| 209 | const globPatterns = projectFiles |
| 210 | .filter(file => file.endsWith("*.ts")) |
| 211 | .map( |
| 212 | file => `${project}/${file.slice(0, -3)}*.d.ts`.replace(/\\/g, "/") // glob doesn't support \ on Windows |
| 213 | ); |
| 214 | const files = await glob(globPatterns); |
| 215 | for (const file of files) { |
| 216 | const out = joinPath( |
| 217 | process.cwd(), |
| 218 | "dts", |
| 219 | relativePath(process.cwd(), file) |
| 220 | ); |
| 221 | mkdirSync(dirname(out), { recursive: true }); |
| 222 | copyFileSync(file, out); |
| 223 | } |
| 224 | }) |
| 225 | ); |
| 226 | |
| 227 | done += projects.length; |
| 228 | if (!process.env.TSCHECK_SILENT) { |
| 229 | console.log( |
| 230 | `[${done}/${total}] ${projects.map(project => relativePath(process.cwd(), project)).join(" ")} took ${Math.round(duration) / 1e3}s` |
| 231 | ); |
| 232 | } |
| 233 | for (const project of projects) { |
| 234 | for (const dependent of projectToDependents.get(project) ?? []) { |
| 235 | const dependencies = projectToDependencies.get(dependent); |
| 236 | if (dependencies) { |
| 237 | dependencies.delete(project); |
| 238 | if (dependencies.size === 0) { |
| 239 | projectToDependencies.delete(dependent); |
| 240 | // @ts-expect-error run is defined on Pool |
| 241 | if (!projects.includes(dependent)) this.run(dependent); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | }, |
| 247 | onTaskError(projects, code = 1) { |
| 248 | console.error("ERROR", projects); |
| 249 | process.exitCode = code; |