Skip to content

Commit 6a8d70c

Browse files
Typst manifesto (SchemaStore#4662)
* json * rename * tests, catalog and no strict * fix: - author, license and description not required but specified on each's description - description guidelines - simpler version - authors email - simpler compiler version - invalid test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 893b800 commit 6a8d70c

File tree

10 files changed

+333
-0
lines changed

10 files changed

+333
-0
lines changed

src/api/json/catalog.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5577,6 +5577,12 @@
55775577
"fileMatch": ["**/sites/*/config.yaml", "**/sites/*/config.yml"],
55785578
"url": "https://json.schemastore.org/typo3.json"
55795579
},
5580+
{
5581+
"name": "Typst Manifest",
5582+
"description": "Typst package manifest file (typst.toml)",
5583+
"fileMatch": ["typst.toml"],
5584+
"url": "https://json.schemastore.org/typst.json"
5585+
},
55805586
{
55815587
"name": "typos.toml",
55825588
"description": "typos configuration file",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#:schema ../../schemas/json/typst.json
2+
# Fails because package.authors is not an array
3+
[package]
4+
name = "wrong-authors"
5+
version = "0.1.0"
6+
entrypoint = "lib.typ"
7+
authors = "Just Me" # INVALID TYPE (should be array)
8+
license = "MIT"
9+
description = "Authors should be a list."
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#:schema ../../schemas/json/typst.json
2+
# Fails because package.version is missing
3+
[package]
4+
name = "missing-version"
5+
# version = "0.1.0" # MISSING
6+
entrypoint = "lib.typ"
7+
authors = ["Incomplete Author"]
8+
license = "MIT"
9+
description = "This package is missing a version."
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#:schema ../../schemas/json/typst.json
2+
# Fails because package.name contains uppercase characters
3+
[package]
4+
name = "Invalid-Name" # INVALID PATTERN
5+
version = "0.1.0"
6+
entrypoint = "lib.typ"
7+
authors = ["Rule Breaker"]
8+
license = "MIT"
9+
description = "This package has an invalid name."
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#:schema ../../schemas/json/typst.json
2+
# Fails because package.version is not a valid SemVer string
3+
[package]
4+
name = "bad-version"
5+
version = "1.2" # INVALID PATTERN (missing patch)
6+
entrypoint = "lib.typ"
7+
authors = ["Version Violator"]
8+
license = "MIT"
9+
description = "This package has an invalid version format."

src/schema-validation.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
"tsoa.json",
207207
"typings.json",
208208
"typingsrc.json",
209+
"typst.json",
209210
"typo3.json",
210211
"ubuntu-server-autoinstall.json",
211212
"utam-page-object.json",

src/schemas/json/typst.json

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://json.schemastore.org/typst.json",
4+
"title": "Typst Package Manifest",
5+
"description": "Schema for typst.toml package manifest files, used by the Typst package manager and universe.",
6+
"type": "object",
7+
"required": ["package"],
8+
"properties": {
9+
"package": {
10+
"type": "object",
11+
"description": "Contains metadata about the package.",
12+
"required": ["name", "version", "entrypoint"],
13+
"properties": {
14+
"name": {
15+
"type": "string",
16+
"description": "The package's identifier in its namespace. Should use kebab-case if it contains multiple words. Should not contain 'typst'. See https://github.com/typst/packages/tree/main?tab=readme-ov-file#submission-guidelines for detailed requirements.",
17+
"pattern": "^[a-z0-9][a-z0-9\\-]*$",
18+
"examples": ["my-package", "example", "uni-stuttgart-template"]
19+
},
20+
"version": {
21+
"type": "string",
22+
"description": "The package's version as a full major-minor-patch triple (following SemVer, no pre-release or build tags). See https://semver.org/",
23+
"pattern": "^\\d+\\.\\d+\\.\\d+$",
24+
"examples": ["1.0.0", "0.2.1"]
25+
},
26+
"entrypoint": {
27+
"type": "string",
28+
"description": "The path to the main Typst file (relative to the package root) that is evaluated when the package is imported.",
29+
"examples": ["lib.typ", "src/main.typ"]
30+
},
31+
"authors": {
32+
"type": "array",
33+
"description": "A list of the package's authors. Each author can provide an email address (<[email protected]>), homepage (<https://example.com>), or GitHub handle (<@typst>) in angle brackets. Required for Typst Universe submission.",
34+
"items": {
35+
"type": "string"
36+
},
37+
"minItems": 1,
38+
"examples": [
39+
["Jane Doe <[email protected]>", "John Doe <@johndoe>"],
40+
["Typst GmbH <https://typst.app>"]
41+
]
42+
},
43+
"license": {
44+
"type": "string",
45+
"description": "The package's license. Must contain a valid SPDX 2.3 expression describing one or multiple licenses that are either OSI-approved (https://opensource.org/licenses/) or CC-BY-4.0, CC-BY-SA-4.0, or CC0-1.0. See https://spdx.dev/learn/handling-license-info/. Required for Typst Universe submission.",
46+
"examples": [
47+
"MIT",
48+
"Apache-2.0",
49+
"GPL-3.0-or-later",
50+
"MIT OR Apache-2.0",
51+
"CC-BY-SA-4.0"
52+
]
53+
},
54+
"description": {
55+
"type": "string",
56+
"description": "A short, clear description of the package (one sentence recommended). Required for Typst Universe submission."
57+
},
58+
"homepage": {
59+
"type": "string",
60+
"description": "A URL to the package's web presence (e.g., documentation website).",
61+
"format": "uri",
62+
"examples": ["https://example.com/my-package-docs"]
63+
},
64+
"repository": {
65+
"type": "string",
66+
"description": "A URL to the repository where this package is developed (e.g., GitHub, GitLab). Used if homepage is not set.",
67+
"format": "uri",
68+
"examples": ["https://github.com/user/my-package"]
69+
},
70+
"keywords": {
71+
"type": "array",
72+
"description": "An array of search keywords for the package.",
73+
"items": {
74+
"type": "string"
75+
},
76+
"uniqueItems": true,
77+
"examples": [
78+
["chart", "plot", "data visualization"],
79+
["ieee", "template", "paper"]
80+
]
81+
},
82+
"categories": {
83+
"type": "array",
84+
"description": "An array with up to three categories from the official list to help users discover the package.",
85+
"items": {
86+
"type": "string",
87+
"enum": [
88+
"components",
89+
"visualization",
90+
"model",
91+
"layout",
92+
"text",
93+
"languages",
94+
"scripting",
95+
"integration",
96+
"utility",
97+
"fun",
98+
"book",
99+
"report",
100+
"paper",
101+
"thesis",
102+
"poster",
103+
"flyer",
104+
"presentation",
105+
"cv",
106+
"office"
107+
]
108+
},
109+
"maxItems": 3,
110+
"uniqueItems": true,
111+
"examples": [
112+
["visualization", "components"],
113+
["paper", "layout"]
114+
]
115+
},
116+
"disciplines": {
117+
"type": "array",
118+
"description": "An array of disciplines from the official list defining the target audience. Should be empty if generally applicable.",
119+
"items": {
120+
"type": "string",
121+
"enum": [
122+
"agriculture",
123+
"anthropology",
124+
"archaeology",
125+
"architecture",
126+
"biology",
127+
"business",
128+
"chemistry",
129+
"communication",
130+
"computer-science",
131+
"design",
132+
"drawing",
133+
"economics",
134+
"education",
135+
"engineering",
136+
"fashion",
137+
"film",
138+
"geography",
139+
"geology",
140+
"history",
141+
"journalism",
142+
"law",
143+
"linguistics",
144+
"literature",
145+
"mathematics",
146+
"medicine",
147+
"music",
148+
"painting",
149+
"philosophy",
150+
"photography",
151+
"physics",
152+
"politics",
153+
"psychology",
154+
"sociology",
155+
"theater",
156+
"theology",
157+
"transportation"
158+
]
159+
},
160+
"uniqueItems": true,
161+
"examples": [["computer-science", "mathematics"], ["physics"]]
162+
},
163+
"compiler": {
164+
"type": "string",
165+
"description": "The minimum Typst compiler version required for this package to work (SemVer format). Partial versions like '0' or '0.13' are supported. Pre-release tags are not supported.",
166+
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){0,2}$",
167+
"examples": ["0", "0.13", "0.8.0", "1.0.0"]
168+
},
169+
"exclude": {
170+
"type": "array",
171+
"description": "An array of globs specifying files (relative to package root) that should not be part of the published bundle. Do not exclude README or LICENSE.",
172+
"items": {
173+
"type": "string"
174+
},
175+
"examples": [["docs/", "*.pdf", "images/draft*.png"]]
176+
}
177+
},
178+
"additionalProperties": false
179+
},
180+
"template": {
181+
"type": "object",
182+
"description": "If present, declares this package as a template.",
183+
"required": ["path", "entrypoint", "thumbnail"],
184+
"properties": {
185+
"path": {
186+
"type": "string",
187+
"description": "The directory within the package (relative to package root) containing files to be copied into the user's new project directory.",
188+
"examples": ["template", "skeleton"]
189+
},
190+
"entrypoint": {
191+
"type": "string",
192+
"description": "Path relative to the template 'path' directory pointing to the main file to be compiled after initialization.",
193+
"examples": ["main.typ", "report.typ"]
194+
},
195+
"thumbnail": {
196+
"type": "string",
197+
"description": "Path relative to the package root pointing to a PNG or lossless WebP thumbnail (min 1080px on longer edge, max 3MB) depicting the initialized template.",
198+
"pattern": "\\.(png|PNG|webp|WEBP)$",
199+
"examples": ["thumbnail.png", "preview.webp"]
200+
}
201+
},
202+
"additionalProperties": false
203+
},
204+
"tool": {
205+
"type": "object",
206+
"description": "Namespace for third-party tools to store their own configuration.",
207+
"additionalProperties": true
208+
}
209+
},
210+
"additionalProperties": false,
211+
"allOf": [
212+
{
213+
"if": {
214+
"required": ["template"]
215+
},
216+
"then": {
217+
"properties": {
218+
"package": {
219+
"required": [
220+
"name",
221+
"version",
222+
"entrypoint",
223+
"authors",
224+
"license",
225+
"description",
226+
"categories"
227+
],
228+
"properties": {
229+
"categories": {
230+
"minItems": 1
231+
}
232+
}
233+
}
234+
}
235+
}
236+
}
237+
]
238+
}

src/test/typst/full-package.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#:schema ../../schemas/json/typst.json
2+
# A package using many optional fields
3+
[package]
4+
name = "my-feature-rich-package"
5+
version = "1.2.3"
6+
entrypoint = "src/main.typ"
7+
authors = ["Dev One <@dev1>", "Dev Two <https://example.com/dev2>"]
8+
license = "Apache-2.0 OR MIT"
9+
description = "A package demonstrating most of the available fields."
10+
homepage = "https://example.com/my-package"
11+
repository = "https://github.com/user/my-feature-rich-package"
12+
keywords = ["utility", "example", "testing"]
13+
categories = ["utility", "scripting"]
14+
disciplines = ["computer-science"]
15+
compiler = "0.11"
16+
exclude = ["docs/", "*.pdf", "images/logo.png"]
17+
18+
# No template section
19+
20+
[tool.my-formatter]
21+
line-width = 80
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#:schema ../../schemas/json/typst.json
2+
# A minimal valid package manifest
3+
[package]
4+
name = "my-basic-pkg"
5+
version = "0.1.0"
6+
entrypoint = "lib.typ"
7+
authors = ["Example Author <[email protected]>"]
8+
license = "MIT"
9+
description = "This is a minimal but valid package."
10+
11+
# No template section
12+
# No tool section

src/test/typst/valid-template.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#:schema ../../schemas/json/typst.json
2+
# A valid template package manifest
3+
[package]
4+
name = "simple-report-template"
5+
version = "0.2.0"
6+
entrypoint = "lib.typ" # Package entrypoint (for potential imports)
7+
authors = ["Template Creator <https://example.com>"]
8+
license = "CC0-1.0" # License suitable for template content
9+
description = "A simple report template."
10+
# Template requires at least one category
11+
categories = ["report"]
12+
keywords = ["template", "report", "academic"]
13+
disciplines = ["education"]
14+
compiler = "0.10.0"
15+
16+
[template]
17+
path = "template_files"
18+
entrypoint = "main.typ" # Relative to template_files/
19+
thumbnail = "assets/thumbnail.png" # Relative to package root

0 commit comments

Comments
 (0)