-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew.js
More file actions
62 lines (49 loc) · 1.56 KB
/
Copy pathnew.js
File metadata and controls
62 lines (49 loc) · 1.56 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const fs = require("fs");
const components = JSON.parse(
fs.readFileSync("./data/components_old.json", "utf8")
);
components.forEach((component) => {
const imagePath = `./data/images/${component.key}.png`;
if (fs.existsSync(imagePath)) {
fs.rmSync(imagePath);
console.log(`Removed ${imagePath}`);
}
});
// const replacements = JSON.parse(
// fs.readFileSync("./replacements.json", "utf-8")
// );
// const pairs = JSON.parse(fs.readFileSync("./pairs.json", "utf-8"));
// const newPairs = [];
// pairs.forEach((pair) => {
// const newPair = [];
// if (pair[0] in replacements) {
// console.log(`${pair[0]} -> ${replacements[pair[0]]}`);
// newPair.push(replacements[pair[0]]);
// }
// if (pair[1] in replacements) {
// console.log(`${pair[1]} -> ${replacements[pair[1]]}`);
// newPair.push(replacements[pair[1]]);
// }
// if (newPair.length === 2) {
// newPairs.push(newPair);
// }
// });
// fs.writeFileSync("./pairs_new.json", JSON.stringify(newPairs, null, 4));
// const oldC = JSON.parse(fs.readFileSync("./data/components_old.json", "utf-8"));
// const newC = JSON.parse(fs.readFileSync("./data/components.json", "utf-8"));
// const dict = {};
// const notFound = [];
// oldC.forEach((o) => {
// newC.forEach((n) => {
// if (
// `${o.name}|${o.platform}|${o.variant}` ===
// `${n.name}|${n.platform}|${n.variant}`
// ) {
// dict[o.key] = n.key;
// }
// });
// if (!dict[o.key]) {
// notFound.push(o);
// }
// });
// fs.writeFileSync('./replacements.json', JSON.stringify(dict, null, 2));