@uxf/icons-generator 11.15.0 → 11.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/icons-gen.js +0 -0
- package/package.json +2 -2
- package/scripts/generate-fa-pro-types.js +27 -0
- package/src/fa-pro-types.d.ts +1 -1
- package/src/scripts/cli.js +1 -1
- package/src/utils/_getConfig.js +1 -1
- package/bin/icons-gen.ts +0 -12
package/bin/icons-gen.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/icons-generator",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.21.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"author": "",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"bin": {
|
|
26
|
-
"icons-gen": "./bin/icons-gen.
|
|
26
|
+
"icons-gen": "./bin/icons-gen.js"
|
|
27
27
|
},
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://gitlab.com/uxf-npm/icons-generator/issues"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const readdirSync = require("fs").readdirSync;
|
|
2
|
+
const writeFileSync = require("fs").writeFileSync;
|
|
3
|
+
|
|
4
|
+
const getFaProIconNamesType = () => {
|
|
5
|
+
const dir = readdirSync(__dirname + "/../../../node_modules/@fortawesome/fontawesome-pro/svgs/");
|
|
6
|
+
|
|
7
|
+
if (!dir.length) {
|
|
8
|
+
throw new Error("You need to install @fortawesome/fontawesome-pro first!");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let names = [];
|
|
12
|
+
|
|
13
|
+
for (const namespace of dir) {
|
|
14
|
+
const icons = readdirSync(__dirname + `/../../../node_modules/@fortawesome/fontawesome-pro/svgs/${namespace}`);
|
|
15
|
+
|
|
16
|
+
for (const icon of icons) {
|
|
17
|
+
const iconName = icon.replace(/\.svg$/, "");
|
|
18
|
+
|
|
19
|
+
names.push(`"${namespace}.${iconName}"`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
writeFileSync(__dirname + "/../src/fa-pro-types.ts", `export type FaProIconName = ${names.join(" | ")};\n`);
|
|
24
|
+
console.log(`Great, generated ${names.length} FA Pro icon names!`);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
getFaProIconNamesType();
|