opencode_offline/packages/web/astro.config.mjs

117 lines
2.8 KiB
JavaScript
Raw Normal View History

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