Skip to content

Commit 35c6069

Browse files
committed
feat: fetch mdn-browser-compat-data from a remote source
1 parent 7dc817a commit 35c6069

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ FROM node:14-slim
22

33
WORKDIR /app
44

5-
# Install dependencies, but don't generate lock files as we want to always fetch
6-
# the lastest @mdn/browser-compat-data package.
75
COPY package.json ./
8-
RUN npm install --no-package-lock && \
9-
npm cache clear --force
6+
RUN npm install --no-package-lock; \
7+
npm cache clean --force
108

119
# copy sources
1210
COPY update_remote_settings_records.mjs ./
1311
COPY ./version.json ./
1412

1513
# set CMD
16-
CMD ["npm", "run", "ingest"]
14+
CMD ["node", "update_remote_settings_records.mjs"]

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"ingest": "node update_remote_settings_records.mjs"
66
},
77
"devDependencies": {
8-
"@mdn/browser-compat-data": "latest",
98
"btoa": "1.2.1",
10-
"node-fetch": "^3.2.0"
9+
"node-fetch": "^3.2.10"
1110
}
12-
}
11+
}

update_remote_settings_records.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
import fetch from "node-fetch";
1818
import btoa from "btoa";
1919

20-
// Use the legacy wrapper to support all Node 12+ versions.
21-
// If we only support Node 16+, can be updated to:
22-
// import bcd from '@mdn/browser-compat-data' assert { type: 'json' };
2320
// See https://github.com/mdn/browser-compat-data.
24-
import compatData from "@mdn/browser-compat-data/forLegacyNode";
21+
const response = await fetch("https://unpkg.com/@mdn/browser-compat-data/data.json");
22+
const compatData = await response.json();
2523

2624
const SUCCESS_RET_VALUE = 0;
2725
const FAILURE_RET_VALUE = 1;

0 commit comments

Comments
 (0)