Skip to content

Commit 063b0f3

Browse files
committed
Update logic a bit more
1 parent ee538b9 commit 063b0f3

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

src/components/ProductReleaseNotes.astro

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ if (!page) {
1616
}
1717
1818
if (
19-
!page.data.release_notes_file_name &&
20-
!page.data.release_notes_product_area_name
19+
!page.data.release_notes_file_name
2120
) {
2221
throw new Error(
23-
`[ProductReleaseNotes] ${Astro.params.slug} does not have a 'release_notes_file_name' or 'changaelog_product_area_name' frontmatter property.`,
22+
`[ProductReleaseNotes] ${Astro.params.slug} does not have a 'release_notes_file_name' frontmatter property.`,
2423
);
2524
}
2625
@@ -34,37 +33,22 @@ if (
3433
}
3534
3635
const name =
37-
page.data.release_notes_product_area_name ??
3836
page.data.release_notes_file_name?.[0];
3937
4038
let releaseNotes;
4139
42-
if (page.data.release_notes_product_area_name) {
40+
if (name === "api-deprecations") {
41+
const opts = {
42+
deprecationsOnly: true,
43+
};
44+
({ releaseNotes } = await getReleaseNotes(opts));
45+
} else {
4346
const opts = {
4447
filter: (entry: CollectionEntry<"release-notes">) => {
45-
return entry.data.productArea === name;
48+
return entry.id === name;
4649
},
4750
};
4851
({ releaseNotes } = await getReleaseNotes(opts));
49-
} else {
50-
if (name === "wrangler") {
51-
const opts = {
52-
wranglerOnly: true,
53-
};
54-
({ releaseNotes } = await getReleaseNotes(opts));
55-
} else if (name === "api-deprecations") {
56-
const opts = {
57-
deprecationsOnly: true,
58-
};
59-
({ releaseNotes } = await getReleaseNotes(opts));
60-
} else {
61-
const opts = {
62-
filter: (entry: CollectionEntry<"release-notes">) => {
63-
return entry.id === name;
64-
},
65-
};
66-
({ releaseNotes } = await getReleaseNotes(opts));
67-
}
6852
}
6953
7054
if (!releaseNotes) {

src/util/release-notes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { getCollection } from "astro:content";
22

33
export async function getReleaseNotes(opts?: {
44
filter?: Parameters<typeof getCollection<"release-notes">>[1];
5-
wranglerOnly?: boolean;
65
deprecationsOnly?: boolean;
76
}) {
87
let releaseNotes;

0 commit comments

Comments
 (0)