-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathconfig.ts
79 lines (76 loc) · 1.87 KB
/
config.ts
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
import { z, defineCollection } from "astro:content";
import { author } from "../shared";
export const categories = [
"drawing",
"color",
"ui",
"math",
"physics",
"algorithms",
"3d",
"ai-ml-cv",
"animation",
"shaders",
"language",
"hardware",
"sound",
"data",
"teaching",
"networking",
"export",
"utils",
] as const;
export const categoryNames: { [key in (typeof categories)[number]]: string } = {
drawing: "Drawing",
color: "Color",
ui: "User Interface",
math: "Math",
physics: "Physics",
algorithms: "Algorithms",
"3d": "3D",
"ai-ml-cv": "AI, ML, and CV",
animation: "Animation",
shaders: "Shaders",
language: "Language",
hardware: "Hardware",
sound: "Sound",
data: "Data",
teaching: "Teaching",
networking: "Networking",
export: "Export",
utils: "Utilities",
};
/**
* Content collection for the Libraries section of the site.
*/
export const librariesCollection = defineCollection({
type: "data",
schema: ({ image }) =>
z.object({
// Name of the library
name: z.string(),
// Description of the library
description: z.string(),
// Which category the library falls in
category: z.enum(categories),
// Url to the source of the library (for example: on GitHub)
sourceUrl: z.string().url(),
// Url to a website for the library
websiteUrl: z.string().url().optional(),
// 1500x1000
featuredImage: image().refine(
(img) => img.width >= 1500 && img.height >= 1000,
{
message: "Featured image must be 1500x1000",
},
),
featuredImageAlt: z.string(),
author: author()
.transform((val) => [val])
.or(z.array(author())),
// What license is the library licensed with?
license: z.string().optional(),
npm: z.string().optional(),
npmFilePath: z.string().optional(),
}),
});