@zpress/config 0.3.0 → 0.5.0
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/README.md +9 -398
- package/dist/index.d.ts +1064 -974
- package/dist/index.mjs +112 -56
- package/package.json +6 -6
- package/schemas/schema.json +306 -202
package/dist/index.mjs
CHANGED
|
@@ -74,25 +74,20 @@ const titleConfigSchema = z.union([
|
|
|
74
74
|
transform: titleTransformSchema.optional()
|
|
75
75
|
}).strict()
|
|
76
76
|
]);
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
frontmatter: frontmatterSchema.optional(),
|
|
90
|
-
recursive: z.boolean().optional(),
|
|
91
|
-
indexFile: z.string().optional()
|
|
92
|
-
}).strict();
|
|
77
|
+
const includeSchema = z.union([
|
|
78
|
+
z.string(),
|
|
79
|
+
z.array(z.string())
|
|
80
|
+
]);
|
|
81
|
+
const iconIdSchema = z.string().refine((v)=>v.includes(':'));
|
|
82
|
+
const iconConfigSchema = z.union([
|
|
83
|
+
iconIdSchema,
|
|
84
|
+
z.object({
|
|
85
|
+
id: iconIdSchema,
|
|
86
|
+
color: z.string()
|
|
87
|
+
}).strict()
|
|
88
|
+
]);
|
|
93
89
|
const cardConfigSchema = z.object({
|
|
94
|
-
icon:
|
|
95
|
-
iconColor: z.string().optional(),
|
|
90
|
+
icon: iconConfigSchema.optional(),
|
|
96
91
|
scope: z.string().optional(),
|
|
97
92
|
description: z.string().optional(),
|
|
98
93
|
tags: z.array(z.string()).optional(),
|
|
@@ -103,22 +98,15 @@ const cardConfigSchema = z.object({
|
|
|
103
98
|
}).strict();
|
|
104
99
|
const entrySchema = z.lazy(()=>z.object({
|
|
105
100
|
title: titleConfigSchema,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
description: z.string().optional(),
|
|
102
|
+
path: z.string().optional(),
|
|
103
|
+
include: includeSchema.optional(),
|
|
109
104
|
content: z.union([
|
|
110
105
|
z.string(),
|
|
111
106
|
contentFnSchema
|
|
112
107
|
]).optional(),
|
|
113
108
|
items: z.array(entrySchema).optional(),
|
|
114
|
-
landing: z.
|
|
115
|
-
z["enum"]([
|
|
116
|
-
'auto',
|
|
117
|
-
'cards',
|
|
118
|
-
'overview'
|
|
119
|
-
]),
|
|
120
|
-
z.literal(false)
|
|
121
|
-
]).optional(),
|
|
109
|
+
landing: z.boolean().optional(),
|
|
122
110
|
collapsible: z.boolean().optional(),
|
|
123
111
|
exclude: z.array(z.string()).optional(),
|
|
124
112
|
hidden: z.boolean().optional(),
|
|
@@ -132,22 +120,14 @@ const entrySchema = z.lazy(()=>z.object({
|
|
|
132
120
|
sortFnSchema
|
|
133
121
|
]).optional(),
|
|
134
122
|
recursive: z.boolean().optional(),
|
|
135
|
-
|
|
136
|
-
icon:
|
|
137
|
-
iconColor: z.string().optional(),
|
|
123
|
+
entryFile: z.string().optional(),
|
|
124
|
+
icon: iconConfigSchema.optional(),
|
|
138
125
|
card: cardConfigSchema.optional(),
|
|
139
|
-
|
|
140
|
-
titleFrom: z["enum"]([
|
|
141
|
-
'filename',
|
|
142
|
-
'heading',
|
|
143
|
-
'frontmatter',
|
|
144
|
-
'auto'
|
|
145
|
-
]).optional(),
|
|
146
|
-
titleTransform: titleTransformSchema.optional()
|
|
126
|
+
standalone: z.boolean().optional()
|
|
147
127
|
}).strict());
|
|
148
128
|
const openapiConfigSchema = z.object({
|
|
149
129
|
spec: z.string(),
|
|
150
|
-
|
|
130
|
+
path: z.string(),
|
|
151
131
|
title: z.string().optional(),
|
|
152
132
|
sidebarLayout: z["enum"]([
|
|
153
133
|
'method-path',
|
|
@@ -156,23 +136,34 @@ const openapiConfigSchema = z.object({
|
|
|
156
136
|
}).strict();
|
|
157
137
|
const workspaceItemSchema = z.object({
|
|
158
138
|
title: titleConfigSchema,
|
|
159
|
-
icon:
|
|
160
|
-
iconColor: z.string().optional(),
|
|
139
|
+
icon: iconConfigSchema.optional(),
|
|
161
140
|
description: z.string(),
|
|
162
141
|
tags: z.array(z.string()).optional(),
|
|
163
142
|
badge: z.object({
|
|
164
143
|
src: z.string(),
|
|
165
144
|
alt: z.string()
|
|
166
145
|
}).strict().optional(),
|
|
167
|
-
|
|
168
|
-
|
|
146
|
+
path: z.string(),
|
|
147
|
+
include: includeSchema.optional(),
|
|
169
148
|
items: z.array(entrySchema).optional(),
|
|
149
|
+
sort: z.union([
|
|
150
|
+
z["enum"]([
|
|
151
|
+
'default',
|
|
152
|
+
'alpha',
|
|
153
|
+
'filename'
|
|
154
|
+
]),
|
|
155
|
+
sortFnSchema
|
|
156
|
+
]).optional(),
|
|
157
|
+
exclude: z.array(z.string()).optional(),
|
|
158
|
+
recursive: z.boolean().optional(),
|
|
159
|
+
entryFile: z.string().optional(),
|
|
160
|
+
frontmatter: frontmatterSchema.optional(),
|
|
170
161
|
openapi: openapiConfigSchema.optional()
|
|
171
162
|
}).strict();
|
|
172
163
|
const workspaceGroupSchema = z.object({
|
|
173
164
|
title: titleConfigSchema,
|
|
174
|
-
description: z.string(),
|
|
175
|
-
icon:
|
|
165
|
+
description: z.string().optional(),
|
|
166
|
+
icon: iconIdSchema,
|
|
176
167
|
items: z.array(workspaceItemSchema).min(1),
|
|
177
168
|
link: z.string().optional()
|
|
178
169
|
}).strict();
|
|
@@ -180,7 +171,7 @@ const featureSchema = z.object({
|
|
|
180
171
|
title: titleConfigSchema,
|
|
181
172
|
description: z.string(),
|
|
182
173
|
link: z.string().optional(),
|
|
183
|
-
icon:
|
|
174
|
+
icon: iconConfigSchema.optional()
|
|
184
175
|
}).strict();
|
|
185
176
|
const themeColorsSchema = z.object({
|
|
186
177
|
brand: z.string().optional(),
|
|
@@ -212,18 +203,39 @@ const themeConfigSchema = z.object({
|
|
|
212
203
|
const sidebarLinkSchema = z.object({
|
|
213
204
|
text: z.string(),
|
|
214
205
|
link: z.string(),
|
|
215
|
-
icon:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
206
|
+
icon: iconConfigSchema.optional(),
|
|
207
|
+
style: z["enum"]([
|
|
208
|
+
'brand',
|
|
209
|
+
'alt',
|
|
210
|
+
'ghost'
|
|
211
|
+
]).optional(),
|
|
212
|
+
shape: z["enum"]([
|
|
213
|
+
'square',
|
|
214
|
+
'rounded',
|
|
215
|
+
'circle'
|
|
221
216
|
]).optional()
|
|
222
217
|
}).strict();
|
|
223
218
|
const sidebarConfigSchema = z.object({
|
|
224
219
|
above: z.array(sidebarLinkSchema).optional(),
|
|
225
220
|
below: z.array(sidebarLinkSchema).optional()
|
|
226
221
|
}).strict();
|
|
222
|
+
const truncateConfigSchema = z.object({
|
|
223
|
+
title: z.number().int().min(1).optional(),
|
|
224
|
+
description: z.number().int().min(1).optional()
|
|
225
|
+
}).strict();
|
|
226
|
+
const homeGridConfigSchema = z.object({
|
|
227
|
+
columns: z.union([
|
|
228
|
+
z.literal(1),
|
|
229
|
+
z.literal(2),
|
|
230
|
+
z.literal(3),
|
|
231
|
+
z.literal(4)
|
|
232
|
+
]).optional(),
|
|
233
|
+
truncate: truncateConfigSchema.optional()
|
|
234
|
+
}).strict();
|
|
235
|
+
const homeConfigSchema = z.object({
|
|
236
|
+
features: homeGridConfigSchema.optional(),
|
|
237
|
+
workspaces: homeGridConfigSchema.optional()
|
|
238
|
+
}).strict();
|
|
227
239
|
const heroActionSchema = z.object({
|
|
228
240
|
theme: z["enum"]([
|
|
229
241
|
'brand',
|
|
@@ -232,11 +244,51 @@ const heroActionSchema = z.object({
|
|
|
232
244
|
text: z.string(),
|
|
233
245
|
link: z.string()
|
|
234
246
|
}).strict();
|
|
247
|
+
const socialLinkSchema = z.object({
|
|
248
|
+
icon: z.union([
|
|
249
|
+
z["enum"]([
|
|
250
|
+
'lark',
|
|
251
|
+
'discord',
|
|
252
|
+
'facebook',
|
|
253
|
+
'github',
|
|
254
|
+
'instagram',
|
|
255
|
+
'linkedin',
|
|
256
|
+
'slack',
|
|
257
|
+
'x',
|
|
258
|
+
'youtube',
|
|
259
|
+
'wechat',
|
|
260
|
+
'qq',
|
|
261
|
+
'juejin',
|
|
262
|
+
'zhihu',
|
|
263
|
+
'bilibili',
|
|
264
|
+
'weibo',
|
|
265
|
+
'gitlab',
|
|
266
|
+
'X',
|
|
267
|
+
'bluesky',
|
|
268
|
+
'npm'
|
|
269
|
+
]),
|
|
270
|
+
z.object({
|
|
271
|
+
svg: z.string()
|
|
272
|
+
}).strict()
|
|
273
|
+
]),
|
|
274
|
+
mode: z["enum"]([
|
|
275
|
+
'link',
|
|
276
|
+
'text',
|
|
277
|
+
'img',
|
|
278
|
+
'dom'
|
|
279
|
+
]),
|
|
280
|
+
content: z.string()
|
|
281
|
+
}).strict();
|
|
282
|
+
const footerConfigSchema = z.object({
|
|
283
|
+
message: z.string().optional(),
|
|
284
|
+
copyright: z.string().optional(),
|
|
285
|
+
socials: z.boolean().optional()
|
|
286
|
+
}).strict();
|
|
235
287
|
const zpressConfigSchema = z.object({
|
|
236
288
|
title: z.string().optional(),
|
|
237
289
|
description: z.string().optional(),
|
|
238
290
|
theme: themeConfigSchema.optional(),
|
|
239
|
-
icon:
|
|
291
|
+
icon: iconIdSchema.optional(),
|
|
240
292
|
tagline: z.string().optional(),
|
|
241
293
|
apps: z.array(workspaceItemSchema).optional(),
|
|
242
294
|
packages: z.array(workspaceItemSchema).optional(),
|
|
@@ -249,7 +301,11 @@ const zpressConfigSchema = z.object({
|
|
|
249
301
|
z.literal('auto'),
|
|
250
302
|
z.array(navItemSchema)
|
|
251
303
|
]).optional(),
|
|
252
|
-
exclude: z.array(z.string()).optional()
|
|
304
|
+
exclude: z.array(z.string()).optional(),
|
|
305
|
+
home: homeConfigSchema.optional(),
|
|
306
|
+
socialLinks: z.array(socialLinkSchema).optional(),
|
|
307
|
+
footer: footerConfigSchema.optional(),
|
|
308
|
+
openapi: openapiConfigSchema.optional()
|
|
253
309
|
}).strict();
|
|
254
310
|
const pathsSchema = z.object({
|
|
255
311
|
repoRoot: z.string(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zpress/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Configuration loading and validation for zpress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"c12": "4.0.0-beta.4",
|
|
39
39
|
"es-toolkit": "^1.45.1",
|
|
40
40
|
"ts-pattern": "^5.9.0",
|
|
41
|
-
"type-fest": "^5.
|
|
41
|
+
"type-fest": "^5.5.0",
|
|
42
42
|
"zod": "^4.3.6",
|
|
43
|
-
"@zpress/theme": "0.3.
|
|
43
|
+
"@zpress/theme": "0.3.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@rslib/core": "^0.20.0",
|
|
47
47
|
"@types/node": "^25.5.0",
|
|
48
48
|
"tsx": "^4.21.0",
|
|
49
|
-
"typescript": "^
|
|
50
|
-
"vitest": "^4.1.
|
|
49
|
+
"typescript": "^6.0.2",
|
|
50
|
+
"vitest": "^4.1.1",
|
|
51
51
|
"zod-to-json-schema": "^3.25.1"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"build": "rslib build",
|
|
58
58
|
"dev": "rslib build --watch --no-clean",
|
|
59
59
|
"test": "vitest run",
|
|
60
|
-
"typecheck": "
|
|
60
|
+
"typecheck": "tsgo --noEmit",
|
|
61
61
|
"generate:schema": "tsx scripts/generate-schema.ts"
|
|
62
62
|
}
|
|
63
63
|
}
|