Skip to content

Commit 9228cfe

Browse files
committed
setup index
1 parent bd94a67 commit 9228cfe

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

registry.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ const resolveRecipe = async (fileName: string) => {
7979
const generateColors = async () => {
8080
const glob = new Glob('./packages/preset/src/colors/*.ts')
8181

82+
const index: { id: string }[] = []
83+
8284
for await (const path of glob.scan('.')) {
8385
const file = Bun.file(path)
8486
if (!file.name) continue
@@ -95,6 +97,10 @@ const generateColors = async () => {
9597
},
9698
]
9799

100+
index.push({
101+
id,
102+
})
103+
98104
Bun.write(
99105
`./website/public/registry/theme/colors/${id}.json`,
100106
JSON.stringify(
@@ -129,6 +135,15 @@ const generateColors = async () => {
129135
),
130136
)
131137
}
138+
139+
Bun.write(
140+
`./website/public/registry/theme/colors/index.json`,
141+
JSON.stringify(
142+
index.sort((a, b) => a.id.localeCompare(b.id)),
143+
null,
144+
2,
145+
),
146+
)
132147
}
133148

134149
const main = async () => {
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
[
2+
{
3+
"id": "amber"
4+
},
5+
{
6+
"id": "blue"
7+
},
8+
{
9+
"id": "bronze"
10+
},
11+
{
12+
"id": "brown"
13+
},
14+
{
15+
"id": "crimson"
16+
},
17+
{
18+
"id": "cyan"
19+
},
20+
{
21+
"id": "gold"
22+
},
23+
{
24+
"id": "grass"
25+
},
26+
{
27+
"id": "green"
28+
},
29+
{
30+
"id": "indigo"
31+
},
32+
{
33+
"id": "iris"
34+
},
35+
{
36+
"id": "jade"
37+
},
38+
{
39+
"id": "lime"
40+
},
41+
{
42+
"id": "mauve"
43+
},
44+
{
45+
"id": "mint"
46+
},
47+
{
48+
"id": "neutral"
49+
},
50+
{
51+
"id": "olive"
52+
},
53+
{
54+
"id": "orange"
55+
},
56+
{
57+
"id": "pink"
58+
},
59+
{
60+
"id": "plum"
61+
},
62+
{
63+
"id": "purple"
64+
},
65+
{
66+
"id": "red"
67+
},
68+
{
69+
"id": "ruby"
70+
},
71+
{
72+
"id": "sage"
73+
},
74+
{
75+
"id": "sand"
76+
},
77+
{
78+
"id": "sky"
79+
},
80+
{
81+
"id": "slate"
82+
},
83+
{
84+
"id": "teal"
85+
},
86+
{
87+
"id": "tomato"
88+
},
89+
{
90+
"id": "violet"
91+
},
92+
{
93+
"id": "yellow"
94+
}
95+
]

0 commit comments

Comments
 (0)