-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
137 lines (118 loc) · 3.98 KB
/
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
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
const fs = require("fs");
const pkg = require("./package.json");
const { cleanDir, generateFromFolder } = require("svg-to-svelte");
const options = { clean: true };
async function build() {
const lib = await generateFromFolder(
"node_modules/@atlaskit/icon/svgs",
"lib",
options
);
const bitbucket = await generateFromFolder(
"node_modules/@atlaskit/icon/svgs/bitbucket",
"bitbucket",
options
);
const editor = await generateFromFolder(
"node_modules/@atlaskit/icon/svgs/editor",
"editor",
options
);
const emoji = await generateFromFolder(
"node_modules/@atlaskit/icon/svgs/emoji",
"emoji",
options
);
const hipchat = await generateFromFolder(
"node_modules/@atlaskit/icon/svgs/hipchat",
"hipchat",
options
);
const jira = await generateFromFolder(
"node_modules/@atlaskit/icon/svgs/jira",
"jira",
options
);
const mediaServices = await generateFromFolder(
"node_modules/@atlaskit/icon/svgs/media-services",
"media-services",
options
);
await cleanDir("docs");
const docs = [
"# docs",
`> ${lib.moduleNames.length} Library icons from @atlaskit/icon@${pkg.devDependencies["@atlaskit/icon"]}.\n`,
`> ${bitbucket.moduleNames.length} Bitbucket icons from @atlaskit/icon@${pkg.devDependencies["@atlaskit/icon"]}.\n`,
`> ${editor.moduleNames.length} Editor icons from @atlaskit/icon@${pkg.devDependencies["@atlaskit/icon"]}.\n`,
`> ${emoji.moduleNames.length} Emoji icons from @atlaskit/icon@${pkg.devDependencies["@atlaskit/icon"]}.\n`,
`> ${hipchat.moduleNames.length} HipChat icons from @atlaskit/icon@${pkg.devDependencies["@atlaskit/icon"]}.\n`,
`> ${jira.moduleNames.length} JIRA icons from @atlaskit/icon@${pkg.devDependencies["@atlaskit/icon"]}.\n`,
`> ${mediaServices.moduleNames.length} Media Services icons from @atlaskit/icon@${pkg.devDependencies["@atlaskit/icon"]}.\n`,
"## Usage",
"### Library icons",
"```html",
`<script>
import Icon from "svelte-atlaskit-icons/lib/{ModuleName}";
</script>
<Icon />`,
"```",
"#### List of Library icons by `ModuleName`",
lib.moduleNames.map((moduleName) => `- ${moduleName}`).join("\n"),
"### Bitbucket icons",
"```html",
`<script>
import Icon from "svelte-atlaskit-icons/bitbucket/{ModuleName}";
</script>
<Icon />`,
"```",
"#### List of Bitbucket icons by `ModuleName`",
bitbucket.moduleNames.map((moduleName) => `- ${moduleName}`).join("\n"),
"### Editor icons",
"```html",
`<script>
import Icon from "svelte-atlaskit-icons/editor/{ModuleName}";
</script>
<Icon />`,
"```",
"#### List of Editor icons by `ModuleName`",
editor.moduleNames.map((moduleName) => `- ${moduleName}`).join("\n"),
"### Emoji icons",
"```html",
`<script>
import Icon from "svelte-atlaskit-icons/emoji/{ModuleName}";
</script>
<Icon />`,
"```",
"#### List of Emoji icons by `ModuleName`",
emoji.moduleNames.map((moduleName) => `- ${moduleName}`).join("\n"),
"### HipChat icons",
"```html",
`<script>
import Icon from "svelte-atlaskit-icons/hipchat/{ModuleName}";
</script>
<Icon />`,
"```",
"#### List of HipChat icons by `ModuleName`",
hipchat.moduleNames.map((moduleName) => `- ${moduleName}`).join("\n"),
"### JIRA icons",
"```html",
`<script>
import Icon from "svelte-atlaskit-icons/jira/{ModuleName}";
</script>
<Icon />`,
"```",
"#### List of JIRA icons by `ModuleName`",
jira.moduleNames.map((moduleName) => `- ${moduleName}`).join("\n"),
"### Media Services icons",
"```html",
`<script>
import Icon from "svelte-atlaskit-icons/media-services/{ModuleName}";
</script>
<Icon />`,
"```",
"#### List of Media Services icons by `ModuleName`",
mediaServices.moduleNames.map((moduleName) => `- ${moduleName}`).join("\n"),
];
fs.writeFileSync("docs/README.md", docs.join("\n"));
}
build();