Skip to content

Instantly share code, notes, and snippets.

@zbraniecki
Created December 3, 2020 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbraniecki/01c8875ff4fa446d9dc95e6f65d86a1b to your computer and use it in GitHub Desktop.
Save zbraniecki/01c8875ff4fa446d9dc95e6f65d86a1b to your computer and use it in GitHub Desktop.
file distribution of DTD files remaining
'use strict';
const execSync = require('child_process').execSync;
const fs = require('fs');
let data = fs.readFileSync('./gh-pages/data/M1/snapshot.json');
let snapshot = JSON.parse(data);
let dtdEntities = new Set();
for (let entry of snapshot.data) {
if (entry.type !== "dtd") {
continue;
}
dtdEntities.add(entry.id);
}
let files = {};
for (let id of dtdEntities) {
if (id == "brandShortName") {
continue;
}
let result = execSync(`rg "${id}" -g "*.dtd" ~/projects/mozilla-unified -l`).toString().trim();
console.log('====');
console.log(id);
console.log(result);
if (files[result]) {
files[result] += 1;
} else {
files[result] = 1;
}
}
for (let key in files) {
console.log(`${key}: ${files[key]}`);
}
console.log(Object.keys(files).length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment