-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathresource-verify-missing.js
More file actions
40 lines (32 loc) · 961 Bytes
/
resource-verify-missing.js
File metadata and controls
40 lines (32 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { join } from 'path';
import { readdir, readFile } from 'fs/promises';
const mappingFile = process.argv[2];
const mapsRoot = process.argv[3];
const mapping = JSON.parse(await readFile(mappingFile, { encoding: 'utf8' }));
const mapped = [];
for(const map of mapping) {
if(map.name instanceof Array) {
mapped.push(...map.name);
} else {
mapped.push(map.name);
}
}
const maps = [];
for(const mapName of await readdir(mapsRoot)) {
const mapPath = join(mapsRoot, mapName);
for(const themeName of await readdir(mapPath)) {
const themePath = join(mapPath, themeName);
const map = JSON.parse(await readFile(themePath));
const key = `${map.name}/${map.theme}`;
maps.push(key);
if(!mapped.includes(key)) {
console.log(`Not mapped: ${key}`);
}
}
}
for(const map of mapped) {
if(!maps.includes(map)) {
console.log(`No map JSON: ${map}`);
}
}
console.log(`Mapped: ${mapped.length} / ${maps.length}`);