chore: fix update-specs script, use builtin fetch (#3528)
Some checks are pending
Tests / UnitTests (18) (push) Waiting to run
Tests / UnitTests (latest) (push) Waiting to run
Tests / UnitTests (lts/*) (push) Waiting to run
Tests / OtherTests (push) Waiting to run
Tests / Release (push) Blocked by required conditions

This commit is contained in:
Spencer Whitehead 2024-11-09 13:40:25 -05:00 committed by GitHub
parent f66914efbd
commit bd22323c09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 4 additions and 97 deletions

91
package-lock.json generated
View File

@ -31,7 +31,6 @@
"markdown-it": "14.1.0",
"marked-highlight": "^2.2.0",
"marked-man": "^2.1.0",
"node-fetch": "^3.3.2",
"recheck": "^4.4.5",
"rollup": "^4.24.4",
"semantic-release": "^24.2.0",
@ -2507,15 +2506,6 @@
"url": "https://github.com/sponsors/fb55"
}
},
"node_modules/data-uri-to-buffer": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
"dev": true,
"engines": {
"node": ">= 12"
}
},
"node_modules/debug": {
"version": "4.3.5",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz",
@ -3287,29 +3277,6 @@
"reusify": "^1.0.4"
}
},
"node_modules/fetch-blob": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "paypal",
"url": "https://paypal.me/jimmywarting"
}
],
"dependencies": {
"node-domexception": "^1.0.0",
"web-streams-polyfill": "^3.0.3"
},
"engines": {
"node": "^12.20 || >= 14.13"
}
},
"node_modules/fflate": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz",
@ -3418,18 +3385,6 @@
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
"dev": true
},
"node_modules/formdata-polyfill": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
"dev": true,
"dependencies": {
"fetch-blob": "^3.1.2"
},
"engines": {
"node": ">=12.20.0"
}
},
"node_modules/from2": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
@ -4485,25 +4440,6 @@
"integrity": "sha512-EZSPZB70jiVsivaBLYDCyntd5eH8NTSMOn3rB+HxwdmKThGELLdYv8qVIMWvZEFy9w8ZZpW9h9OB32l1rGtj7g==",
"dev": true
},
"node_modules/node-domexception": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "github",
"url": "https://paypal.me/jimmywarting"
}
],
"engines": {
"node": ">=10.5.0"
}
},
"node_modules/node-emoji": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.1.3.tgz",
@ -4519,24 +4455,6 @@
"node": ">=18"
}
},
"node_modules/node-fetch": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
"dev": true,
"dependencies": {
"data-uri-to-buffer": "^4.0.0",
"fetch-blob": "^3.1.4",
"formdata-polyfill": "^4.0.10"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-fetch"
}
},
"node_modules/normalize-package-data": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz",
@ -8974,15 +8892,6 @@
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
"node_modules/web-streams-polyfill": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
"dev": true,
"engines": {
"node": ">= 8"
}
},
"node_modules/whatwg-encoding": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",

View File

@ -72,7 +72,6 @@
"markdown-it": "14.1.0",
"marked-highlight": "^2.2.0",
"marked-man": "^2.1.0",
"node-fetch": "^3.3.2",
"recheck": "^4.4.5",
"rollup": "^4.24.4",
"semantic-release": "^24.2.0",

View File

@ -1,10 +1,9 @@
import fetch from 'node-fetch';
import { load } from 'cheerio';
import { Marked } from '../lib/marked.esm.js';
import { htmlIsEqual } from '@markedjs/testutils';
import { readdirSync, unlinkSync, writeFileSync } from 'node:fs';
import { join, resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { load } from 'cheerio';
import { htmlIsEqual } from '@markedjs/testutils';
import { Marked } from '../lib/marked.esm.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
@ -18,7 +17,7 @@ async function updateCommonmark(dir, options) {
try {
const res = await fetch('https://raw.githubusercontent.com/commonmark/commonmark.js/master/package.json');
const pkg = await res.json();
const version = pkg.version.replace(/^(\d+\.\d+).*$/, '$1');
const { version } = pkg;
const res2 = await fetch(`https://spec.commonmark.org/${version}/spec.json`);
const json = await res2.json();
const specs = await Promise.all(json.map(async(spec) => {