agregar indice al reporte
This commit is contained in:
parent
30b41a6811
commit
679cc3e3f2
1 changed files with 15 additions and 13 deletions
12
src/index.ts
12
src/index.ts
|
@ -12,6 +12,7 @@ import {
|
|||
h2,
|
||||
ol,
|
||||
basicElement,
|
||||
a,
|
||||
} from "@nulo/html.js";
|
||||
|
||||
const { argv } = process;
|
||||
|
@ -156,7 +157,9 @@ await recurseDirectory(reports, dirPath);
|
|||
const totalThings = [...reports.entries()].flatMap(([name, r]) =>
|
||||
r.things.map((t) => ({ ...t, fileName: name }))
|
||||
);
|
||||
const kinds = new Set(totalThings.map((t) => t.type));
|
||||
const kinds = [...new Set(totalThings.map((t) => t.type))].sort((a, b) =>
|
||||
["link-http", "link-no-href"].includes(b) ? -1 : 0
|
||||
);
|
||||
console.log(
|
||||
`Finished with ${Object.keys(reports).length} files read, ${
|
||||
totalThings.length
|
||||
|
@ -202,10 +205,9 @@ const html = render(
|
|||
`${linkHttp} links to HTTP sites, which is not a real concern unless it's a key part of the site's navigation.`
|
||||
)
|
||||
),
|
||||
...[...kinds]
|
||||
.sort((a, b) => (b === "link-http" ? -1 : 0))
|
||||
.flatMap((kind) => [
|
||||
h2(kind),
|
||||
ul(...kinds.map((k) => li(a({ href: "#" + k }, k)))),
|
||||
...kinds.flatMap((kind) => [
|
||||
h2({ id: kind }, kind),
|
||||
ol(
|
||||
...totalThings
|
||||
.filter((t) => t.type === kind)
|
||||
|
|
Loading…
Reference in a new issue