-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfetchIconsNames.js
More file actions
33 lines (27 loc) · 775 Bytes
/
fetchIconsNames.js
File metadata and controls
33 lines (27 loc) · 775 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
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const iconsPath = path.join(__dirname, './node_modules/@phosphor-icons/core/assets');
const icons = {
regular: [],
thin: [],
light: [],
bold: [],
fill: [],
duotone: []
};
const readIcons = (type) => {
fs.readdirSync(path.join(iconsPath, type)).forEach(file => {
const iconName = file.split('.')[0];
icons[type].push(iconName);
});
}
readIcons('regular');
readIcons('thin');
readIcons('light');
readIcons('bold');
readIcons('fill');
readIcons('duotone');
fs.writeFileSync(path.join(__dirname, 'icons.json'), JSON.stringify(icons, null, 2));
console.log('icons.json created');