(specifiers: string[])
| 351 | } |
| 352 | |
| 353 | export async function checkDocs(specifiers: string[]) { |
| 354 | const { success, stderr } = await new Deno.Command(Deno.execPath(), { |
| 355 | args: ["doc", "--lint", ...specifiers], |
| 356 | stdin: "inherit", |
| 357 | stdout: "inherit", |
| 358 | stderr: "piped", |
| 359 | }).output(); |
| 360 | if (!success) { |
| 361 | throw new Error(new TextDecoder().decode(stderr)); |
| 362 | } |
| 363 | |
| 364 | await assertDocs(specifiers); |
| 365 | |
| 366 | if (diagnostics.length > 0) { |
| 367 | const errors = distinctBy(diagnostics, (e) => e.message + e.cause); |
| 368 | for (const error of errors) { |
| 369 | // deno-lint-ignore no-console |
| 370 | console.error( |
| 371 | `%c[error] %c${error.message} %cat ${error.cause}`, |
| 372 | "color: red", |
| 373 | "", |
| 374 | "color: gray", |
| 375 | ); |
| 376 | } |
| 377 | |
| 378 | // deno-lint-ignore no-console |
| 379 | console.log(`%c${errors.length} errors found`, "color: red"); |
| 380 | Deno.exit(1); |
| 381 | } |
| 382 | } |
no test coverage detected