-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
409 lines (393 loc) · 15.2 KB
/
Copy pathdocusaurus.config.ts
File metadata and controls
409 lines (393 loc) · 15.2 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
import fs from "node:fs";
import path from "node:path";
import type { Options, ThemeConfig } from "@docusaurus/preset-classic";
import type { Config, LoadContext, Plugin } from "@docusaurus/types";
import { themes as prismThemes } from "prism-react-renderer";
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
// Emit the raw markdown source alongside the built HTML so that appending
// `.md` to a doc URL (e.g. /mdx-integration.md) serves the plain markdown.
// Docusaurus only outputs HTML by default; this mirrors docs/**/*.{md,mdx}
// into the build output as .md files at the matching route path.
function rawMarkdownPlugin(context: LoadContext): Plugin {
return {
name: "raw-markdown",
async postBuild({ outDir }) {
const docsDir = path.join(context.siteDir, "docs");
const walk = (dir: string) => {
for (const entry of fs.readdirSync(dir, {
withFileTypes: true,
})) {
const src = path.join(dir, entry.name);
if (entry.isDirectory()) {
walk(src);
} else if (/\.mdx?$/.test(entry.name)) {
const rel = path
.relative(docsDir, src)
.replace(/\.mdx?$/, ".md");
const dest = path.join(outDir, rel);
fs.mkdirSync(path.dirname(dest), { recursive: true });
fs.copyFileSync(src, dest);
}
}
};
walk(docsDir);
},
};
}
const config: Config = {
title: "React Text Game",
tagline: "A powerful, reactive text-based game engine for React",
favicon: "img/favicon.svg",
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
future: {
v4: true, // Improve compatibility with the upcoming Docusaurus v4
},
// Markdown configuration
// Use "detect" to treat .md files as CommonMark and .mdx files as MDX
// This fixes issues with TypeDoc-generated API docs containing curly braces
markdown: {
format: "detect",
},
// Set the production url of your site here
url: "https://reacttextgame.dev",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "laruss", // Usually your GitHub org/user name.
projectName: "react-text-game", // Usually your repo name.
onBrokenLinks: "throw",
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},
headTags: [
// PNG favicon for better Google Search compatibility
{
tagName: "link",
attributes: {
rel: "icon",
type: "image/png",
sizes: "48x48",
href: "/img/favicon-48x48.png",
},
},
{
tagName: "link",
attributes: {
rel: "icon",
type: "image/png",
sizes: "192x192",
href: "/img/favicon-192x192.png",
},
},
// Apple touch icon
{
tagName: "link",
attributes: {
rel: "apple-touch-icon",
sizes: "192x192",
href: "/img/favicon-192x192.png",
},
},
// WebSite structured data with search functionality
{
tagName: "script",
attributes: {
type: "application/ld+json",
},
innerHTML: JSON.stringify({
"@context": "https://schema.org",
"@type": "WebSite",
name: "React Text Game",
url: "https://reacttextgame.dev/",
potentialAction: {
"@type": "SearchAction",
target: {
"@type": "EntryPoint",
urlTemplate:
"https://reacttextgame.dev/?q={search_term_string}",
},
"query-input": "required name=search_term_string",
},
}),
},
// SoftwareApplication structured data
{
tagName: "script",
attributes: {
type: "application/ld+json",
},
innerHTML: JSON.stringify({
"@context": "https://schema.org",
"@type": "SoftwareApplication",
name: "React Text Game",
applicationCategory: "DeveloperApplication",
operatingSystem: "Web Browser",
description:
"A powerful, reactive text-based game engine for React applications. Create interactive narrative experiences with support for story passages, interactive maps, and comprehensive state management.",
url: "https://reacttextgame.dev/",
author: {
"@type": "Person",
name: "laruss",
url: "https://github.com/laruss",
},
offers: {
"@type": "Offer",
price: "0",
priceCurrency: "USD",
},
programmingLanguage: ["TypeScript", "JavaScript"],
softwareVersion: "1.0.0",
keywords:
"react, text game, interactive fiction, narrative engine, game engine, typescript, valtio",
}),
},
],
plugins: [rawMarkdownPlugin],
presets: [
[
"classic",
{
docs: {
sidebarPath: "./sidebars.ts",
routeBasePath: "/",
editUrl:
"https://github.com/laruss/react-text-game/tree/main/apps/docs/",
},
blog: false,
theme: {
customCss: "./src/css/custom.css",
},
sitemap: {
lastmod: "date",
changefreq: null,
priority: null,
ignorePatterns: ["/tags/**"],
filename: "sitemap.xml",
},
} satisfies Options,
],
],
themeConfig: {
// Social card for link previews
image: "img/og-image.webp",
// Global metadata for SEO
metadata: [
{
name: "description",
content:
"React Text Game is a powerful, reactive text-based game engine for creating interactive narrative experiences, visual novels, and text adventures in React. Features include story passages, interactive maps, JSONPath-based save system, and Valtio state management.",
},
{
name: "keywords",
content:
"react, reactjs, typescript, text game, text adventure, interactive fiction, react text game, react text adventure, react interactive fiction, narrative engine, story engine, game engine, browser game, visual novel, twine alternative, ink alternative, choicescript, passages, save system, jsonpath, valtio, tailwindcss",
},
{ name: "author", content: "laruss" },
{ name: "twitter:card", content: "summary_large_image" },
{
name: "twitter:title",
content:
"React Text Game - Reactive Text-Based Game Engine for React",
},
{
name: "twitter:description",
content:
"Build interactive narrative experiences and text adventures in React with a powerful, type-safe game engine featuring reactive state management and flexible save system.",
},
{
name: "twitter:image",
content: "https://reacttextgame.dev/img/og-image.webp",
},
{ property: "og:type", content: "website" },
{
property: "og:title",
content:
"React Text Game - Reactive Text-Based Game Engine for React",
},
{
property: "og:description",
content:
"Build interactive narrative experiences and text adventures in React with a powerful, type-safe game engine featuring reactive state management and flexible save system.",
},
{
property: "og:url",
content: "https://reacttextgame.dev/",
},
{
property: "og:image",
content: "https://reacttextgame.dev/img/og-image.webp",
},
{ property: "og:image:width", content: "1200" },
{ property: "og:image:height", content: "630" },
{ property: "og:image:alt", content: "React Text Game Logo" },
{ property: "og:site_name", content: "React Text Game" },
],
colorMode: {
respectPrefersColorScheme: true,
},
navbar: {
title: "React Text Game",
logo: {
alt: "React Text Game Logo",
src: "img/logo.svg",
},
items: [
{
type: "docSidebar",
sidebarId: "docsSidebar",
position: "left",
label: "Docs",
},
{
type: "dropdown",
label: "Core API",
position: "left",
items: [
{ to: "/api/core/", label: "Overview" },
{ to: "/api/core/saves/", label: "Saves & Migrations" },
{ to: "/api/core/audio/", label: "Audio" },
{ to: "/api/core/clock/", label: "Clock" },
{ to: "/api/core/i18n/", label: "i18n" },
],
},
{
type: "dropdown",
label: "UI API",
position: "left",
items: [
{ to: "/api/ui/", label: "Overview" },
{ to: "/api/ui/i18n/", label: "i18n" },
],
},
{
type: "dropdown",
label: "MDX API",
position: "left",
items: [
{ to: "/api/mdx/", label: "Overview" },
{ to: "/api/mdx/plugin/", label: "Build Plugin" },
],
},
{
to: "/api/messenger/",
label: "Messenger API",
position: "left",
},
{
to: "/api/devtools/",
label: "Devtools API",
position: "left",
},
{
href: "https://github.com/laruss/react-text-game",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
title: "Documentation",
items: [
{
label: "Getting Started",
to: "/",
},
{
label: "Save Migrations",
to: "/migrations",
},
{
label: "Keep your saves valid",
to: "/keep-saves-valid",
},
{
label: "Core API",
to: "/api/core/",
},
{
label: "Saves & Migrations API",
to: "/api/core/saves/",
},
{
label: "Audio API",
to: "/api/core/audio/",
},
{
label: "Clock API",
to: "/api/core/clock/",
},
{
label: "UI API",
to: "/api/ui/",
},
{
label: "MDX API",
to: "/api/mdx/",
},
{
label: "Messenger API",
to: "/api/messenger/",
},
{
label: "Devtools API",
to: "/api/devtools/",
},
],
},
{
title: "Packages",
items: [
{
label: "@react-text-game/core",
href: "https://www.npmjs.com/package/@react-text-game/core",
},
{
label: "@react-text-game/ui",
href: "https://www.npmjs.com/package/@react-text-game/ui",
},
{
label: "@react-text-game/mdx",
href: "https://www.npmjs.com/package/@react-text-game/mdx",
},
{
label: "@react-text-game/messenger",
href: "https://www.npmjs.com/package/@react-text-game/messenger",
},
{
label: "@react-text-game/devtools",
href: "https://www.npmjs.com/package/@react-text-game/devtools",
},
],
},
{
title: "More",
items: [
{
label: "GitHub",
href: "https://github.com/laruss/react-text-game",
},
{
label: "Issues",
href: "https://github.com/laruss/react-text-game/issues",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} laruss. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies ThemeConfig,
};
export default config;