Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Script to produce confluence.md
Browse files Browse the repository at this point in the history
For #917
  • Loading branch information
foolip committed Jan 29, 2021
1 parent 105635d commit ff389aa
Show file tree
Hide file tree
Showing 4 changed files with 9,175 additions and 0 deletions.
26 changes: 26 additions & 0 deletions confluence.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const fs = require('fs');
const parse = require('csv-parse/lib/sync');
const tests = require('./tests.json');

const rows = parse(fs.readFileSync('./confluence_24ddcd3e1.csv'), {
columns: true
});

// https://stackoverflow.com/a/17572910
function isUpperCase(str) {
return str === str.toUpperCase();
}

for (const row of rows) {
const {api, chrome, firefox, safari} = row;
const [iface, member] = api.split('#');
const confluenceUrl = `https://web-confluence.appspot.com/#!/catalog?q=%22${iface}%23${member}%22`;
let bcdPath = `api.${iface}.${member}`;
let mdnUrl = `https://developer.mozilla.org/en-US/docs/Web/API/${iface}/${member}`;
if (iface === 'Window' && isUpperCase(member[0])) {
bcdPath = `api.${member}`;
mdnUrl = `https://developer.mozilla.org/en-US/docs/Web/API/${member}`;
}
const check = bcdPath in tests ? 'x' : ' ';
console.log(`- [${check}] ${api} ([Confluence](${confluenceUrl}), [MDN](${mdnUrl}))`);
}
Loading

0 comments on commit ff389aa

Please sign in to comment.