-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.js
28 lines (22 loc) · 898 Bytes
/
build.js
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
import * as fs from "fs/promises";
import { generateFromFolder } from "svg-to-svelte";
const options = { clean: true };
async function build() {
await generateFromFolder(
"node_modules/heroicons/solid",
"src/lib/solid",
options
);
let index = await fs.readFile("src/lib/solid/index.js", { encoding: "utf-8" });
index = index.replace(/export { (\w+) }/g, "export { $1 as $1Icon }").replace(/from ".\/(\w+)";/g, 'from "./$1/index.js";');
await fs.writeFile("src/lib/solid/index.js", index);
await generateFromFolder(
"node_modules/heroicons/outline",
"src/lib/outline",
options
);
index = await fs.readFile("src/lib/outline/index.js", { encoding: "utf-8" });
index = index.replace(/export { (\w+) }/g, "export { $1 as $1Icon }").replace(/from ".\/(\w+)";/g, 'from "./$1/index.js";');
await fs.writeFile("src/lib/outline/index.js", index);
}
build();