-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
34 lines (28 loc) · 812 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
29
30
31
32
33
34
const fs = require("fs");
const pkg = require("./package.json");
const { cleanDir, generateFromFolder } = require("svg-to-svelte");
async function build() {
const { moduleNames } = await generateFromFolder(
"node_modules/@leafygreen-ui/icon/src/glyphs",
"lib",
{
clean: true,
}
);
await cleanDir("docs");
const docs = [
"# docs",
`> ${moduleNames.length} icons from @leafygreen-ui/icon@${pkg.devDependencies["@leafygreen-ui/icon"]}.`,
"## Usage",
"```html",
`<script>
import Icon from "svelte-leafygreen-icons/lib/{ModuleName}";
</script>
<Icon />`,
"```",
"## List of icons by `ModuleName`",
moduleNames.map((moduleName) => `- ${moduleName}`).join("\n"),
];
fs.writeFileSync("docs/README.md", docs.join("\n"));
}
build();