Skip to content

Commit 8e9cbef

Browse files
authored
Merge pull request #594 from saschanaz/fetch-each
Allow fetching each spec
2 parents ffee233 + 0cfea23 commit 8e9cbef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/fetcher.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from "path";
33
import fetch from "node-fetch";
44
import { JSDOM } from "jsdom";
55

6-
fetchIDLs();
6+
fetchIDLs(process.argv.slice(2));
77

88
interface IDLSource {
99
url: string;
@@ -19,8 +19,9 @@ const idlSelector = [
1919

2020
const cssPropSelector = "dfn.css[data-dfn-type=property]";
2121

22-
async function fetchIDLs() {
23-
const idlSources = require("../inputfiles/idlSources.json") as IDLSource[];
22+
async function fetchIDLs(filter: string[]) {
23+
const idlSources = (require("../inputfiles/idlSources.json") as IDLSource[])
24+
.filter(source => !filter.length || filter.includes(source.title));
2425
await Promise.all(idlSources.map(async source => {
2526
const { idl, comments } = await fetchIDL(source);
2627
fs.writeFileSync(path.join(__dirname, `../inputfiles/idl/${source.title}.widl`), idl + '\n');

0 commit comments

Comments
 (0)