cloudaxe-opencode/packages/web/astro.config.mjs

145 lines
3.4 KiB
JavaScript
Raw Normal View History

2025-05-21 18:24:53 +00:00
// @ts-check
2025-05-31 18:41:00 +00:00
import { defineConfig } from "astro/config"
import starlight from "@astrojs/starlight"
import solidJs from "@astrojs/solid-js"
2025-06-08 03:46:53 +00:00
import cloudflare from "@astrojs/cloudflare"
2025-05-31 18:41:00 +00:00
import theme from "toolbeam-docs-theme"
2025-06-20 17:12:35 +00:00
import config from "./config.mjs"
2025-05-31 18:41:00 +00:00
import { rehypeHeadingIds } from "@astrojs/markdown-remark"
import rehypeAutolinkHeadings from "rehype-autolink-headings"
import { spawnSync } from "child_process"
2025-05-21 18:24:53 +00:00
// https://astro.build/config
export default defineConfig({
2025-07-07 20:36:52 +00:00
site: config.url,
2025-09-03 03:30:26 +00:00
base: "/docs",
2025-06-05 19:37:17 +00:00
output: "server",
2025-06-08 03:46:53 +00:00
adapter: cloudflare({
imageService: "passthrough",
}),
2025-05-31 18:41:00 +00:00
devToolbar: {
enabled: false,
},
server: {
host: "0.0.0.0",
},
2025-05-31 18:41:00 +00:00
markdown: {
rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],
2025-05-31 18:41:00 +00:00
},
build: {},
2025-05-31 18:41:00 +00:00
integrations: [
configSchema(),
2025-05-31 18:41:00 +00:00
solidJs(),
starlight({
title: "OpenCode",
2026-01-21 20:36:21 +00:00
favicon: "/favicon-v3.svg",
head: [
{
tag: "link",
attrs: {
rel: "icon",
2026-01-21 20:36:21 +00:00
href: "/favicon-v3.ico",
sizes: "32x32",
},
},
{
tag: "link",
attrs: {
rel: "icon",
type: "image/png",
2026-01-21 20:36:21 +00:00
href: "/favicon-96x96-v3.png",
sizes: "96x96",
},
},
{
tag: "link",
attrs: {
rel: "apple-touch-icon",
2026-01-21 20:36:21 +00:00
href: "/apple-touch-icon-v3.png",
sizes: "180x180",
},
},
],
2025-07-15 23:54:51 +00:00
lastUpdated: true,
2025-05-31 18:41:00 +00:00
expressiveCode: { themes: ["github-light", "github-dark"] },
2025-07-07 18:44:37 +00:00
social: [
{ icon: "github", label: "GitHub", href: config.github },
{ icon: "discord", label: "Discord", href: config.discord },
2025-07-07 18:44:37 +00:00
],
2025-05-31 18:41:00 +00:00
editLink: {
2025-08-19 21:21:43 +00:00
baseUrl: `${config.github}/edit/dev/packages/web/`,
2025-05-31 18:41:00 +00:00
},
markdown: {
headingLinks: false,
},
customCss: ["./src/styles/custom.css"],
logo: {
light: "./src/assets/logo-light.svg",
dark: "./src/assets/logo-dark.svg",
replacesTitle: true,
},
sidebar: [
2025-09-03 03:30:26 +00:00
"",
"config",
"providers",
2025-12-14 00:20:44 +00:00
"network",
2025-09-03 03:30:26 +00:00
"enterprise",
"troubleshooting",
"1-0",
{
label: "Usage",
2026-01-14 16:03:48 +00:00
items: ["tui", "cli", "web", "ide", "zen", "share", "github", "gitlab"],
},
{
label: "Configure",
items: [
2025-10-08 19:58:57 +00:00
"tools",
2025-09-03 03:30:26 +00:00
"rules",
"agents",
"models",
"themes",
"keybinds",
"commands",
"formatters",
"permissions",
"lsp",
"mcp-servers",
2025-10-27 05:56:00 +00:00
"acp",
"skills",
2025-10-27 21:48:17 +00:00
"custom-tools",
2025-07-31 21:38:48 +00:00
],
},
2025-08-19 21:21:43 +00:00
{
label: "Develop",
items: ["sdk", "server", "plugins", "ecosystem"],
2025-08-19 21:21:43 +00:00
},
2025-05-31 18:41:00 +00:00
],
components: {
Hero: "./src/components/Hero.astro",
2025-06-28 00:03:17 +00:00
Head: "./src/components/Head.astro",
2025-05-31 18:41:00 +00:00
Header: "./src/components/Header.astro",
2025-09-04 00:12:51 +00:00
SiteTitle: "./src/components/SiteTitle.astro",
2025-05-31 18:41:00 +00:00
},
plugins: [
theme({
2025-06-20 17:12:35 +00:00
headerLinks: config.headerLinks,
2025-05-31 18:41:00 +00:00
}),
],
}),
],
})
function configSchema() {
return {
name: "configSchema",
hooks: {
"astro:build:done": async () => {
console.log("generating config schema")
spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
},
},
}
}