Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 1x 6x 6x 12x 6x 6x 6x 13x 6x 12x 12x 6x 6x | /** Every changelog, the one picked and the release metrics beside them; `ready` settles on load. */
export const useChangelogs = () => {
const list = useAsyncData(
"changelogs",
() =>
queryCollection("docs")
.where("path", "LIKE", "%/CHANGELOG")
.select("path", "title")
.all(),
{ default: () => [] },
);
const changelogs = list.data;
const selected = ref<string | null>(null);
watchEffect(() => {
if (selected.value === null) selected.value = changelogs.value[0]?.path ?? null;
});
const content = useAsyncData(
() => `changelog-${selected.value ?? "none"}`,
() =>
selected.value === null
? Promise.resolve(null)
: queryCollection("docs").path(selected.value).first(),
{ watch: [selected] },
);
const metrics = metricsArtifact();
return {
changelogs,
selected,
page: content.data,
projects: metrics?.projects ?? [],
sinceRelease: metrics?.commitsSinceLastRelease ?? null,
conventional: metrics?.conventionalCommitRate ?? null,
ready: Promise.all([list, content]),
};
};
|