aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/bin/npm-data.mjs
diff options
context:
space:
mode:
Diffstat (limited to '.github/bin/npm-data.mjs')
-rw-r--r--.github/bin/npm-data.mjs14
1 files changed, 14 insertions, 0 deletions
diff --git a/.github/bin/npm-data.mjs b/.github/bin/npm-data.mjs
new file mode 100644
index 0000000..cf4700c
--- /dev/null
+++ b/.github/bin/npm-data.mjs
@@ -0,0 +1,14 @@
+export async function getPackageDataFromNPM() {
+ const resp = await fetch(`https://registry.npmjs.org/@csstools/normalize.css`);
+ if (resp.status === 404) {
+ throw new Error(`Failed to fetch package metadata for @csstools/normalize.css, status code: ${resp.status} ${resp.statusText}`);
+ }
+
+ if (!resp.ok) {
+ throw new Error(`Failed to fetch package metadata for @csstools/normalize.css, status code: ${resp.status} ${resp.statusText}`);
+ }
+
+ const data = await resp.json();
+
+ return data;
+}