Skip to content

Commit

Permalink
chore: fix update-specs script, use builtin fetch (#3528)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpencerWhitehead7 authored Nov 9, 2024
1 parent f66914e commit bd22323
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 97 deletions.
91 changes: 0 additions & 91 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 4 additions & 5 deletions test/update-specs.js
Original file line number Diff line number Diff line change
@@ -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));

Expand All @@ -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) => {
Expand Down

0 comments on commit bd22323

Please sign in to comment.