(specifiers: string[])
| 419 | } |
| 420 | |
| 421 | export async function checkDocs(specifiers: string[]) { |
| 422 | const { success, stderr } = await new Deno.Command(Deno.execPath(), { |
| 423 | args: ["doc", "--lint", ...specifiers], |
| 424 | stdin: "inherit", |
| 425 | stdout: "inherit", |
| 426 | stderr: "piped", |
| 427 | }).output(); |
| 428 | if (!success) { |
| 429 | throw new Error(new TextDecoder().decode(stderr)); |
| 430 | } |
| 431 | |
| 432 | await assertDocs(specifiers); |
| 433 | |
| 434 | if (diagnostics.length > 0) { |
| 435 | const errors = distinctBy(diagnostics, (e) => e.message + e.cause); |
| 436 | for (const error of errors) { |
| 437 | // deno-lint-ignore no-console |
| 438 | console.error( |
| 439 | `%c[error] %c${error.message} %cat ${error.cause}`, |
| 440 | "color: red", |
| 441 | "", |
| 442 | "color: gray", |
| 443 | ); |
| 444 | } |
| 445 | |
| 446 | // deno-lint-ignore no-console |
| 447 | console.log(`%c${errors.length} errors found`, "color: red"); |
| 448 | Deno.exit(1); |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | if (import.meta.main) { |
| 453 | const specifiers = (await getEntrypoints()) |
no test coverage detected