Skip to content

Commit 2bc6046

Browse files
committed
-
1 parent d6385ab commit 2bc6046

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

.github/workflows/update-core-deps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515
- name: Update MDN Data
16-
working-directory: ./inputfiles/mdn
16+
working-directory: ./inputfiles
1717
run: |
1818
curl -fL 'https://developer.mozilla.org/en-US/metadata.json' \
1919
| jq '{ data: [ .[]
@@ -22,7 +22,7 @@ jobs:
2222
| (startswith("/en-us/docs/web/api/") or startswith("/en-us/docs/webassembly/reference/javascript_interface/")))
2323
)
2424
| { mdn_url, pageType, summary } ] }' \
25-
> mdnData.json
25+
> mdn.json
2626
2727
- uses: actions/setup-node@v4
2828
with:
File renamed without changes.

src/build/mdn-comments.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
import { readFile } from "fs/promises";
2-
const inputFile = new URL("../../inputfiles/mdn/mdnData.json", import.meta.url);
1+
import mdn from "../../inputfiles/mdn.json" with { type: "json" };
32

4-
interface MetaDataEntry {
5-
mdn_url: string;
6-
pageType: string;
7-
summary: string;
8-
}
9-
interface MetaData {
10-
data: MetaDataEntry[];
11-
}
123
// These are the subdirectory prefixes we care about for slugs
134
const subdirectories = [
145
"web/api/",
@@ -66,10 +57,8 @@ export async function generateDescriptions(): Promise<{
6657
interfaces: { interface: Record<string, any> };
6758
}> {
6859
const results: Record<string, any> = {};
69-
const content = await readFile(new URL(inputFile), "utf8");
70-
const metadata: MetaData = JSON.parse(content);
7160
// metadata is an array of objects, each with at least: slug, page-type, summary
72-
for (const entry of metadata.data) {
61+
for (const entry of mdn.data) {
7362
const mdnUrl = entry.mdn_url.split("/en-US/docs/")[1];
7463
const slugArr = extractSlug(mdnUrl);
7564
const path = paths[entry.pageType];

0 commit comments

Comments
 (0)