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

119 lines
2.8 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
2025-05-31 18:41:00 +00:00
const github = "https://github.com/sst/opencode"
2025-07-07 20:13:24 +00:00
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-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({
2025-06-19 20:26:58 +00:00
title: "opencode",
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: "Dscord", href: config.discord },
2025-07-07 18:44:37 +00:00
],
2025-06-26 21:22:17 +00:00
head: [
{
tag: "link",
attrs: {
rel: "icon",
href: "/favicon.svg",
},
},
],
2025-05-31 18:41:00 +00:00
editLink: {
baseUrl: `${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: [
"docs",
"docs/config",
"docs/providers",
2025-07-09 19:46:53 +00:00
"docs/enterprise",
2025-07-09 15:12:28 +00:00
"docs/troubleshooting",
{
label: "Usage",
2025-07-31 21:38:48 +00:00
items: ["docs/cli", "docs/ide", "docs/share", "docs/github"],
},
{
label: "Configure",
items: [
"docs/rules",
"docs/agents",
"docs/models",
"docs/themes",
2025-08-04 23:52:03 +00:00
"docs/plugins",
"docs/keybinds",
2025-07-31 23:50:31 +00:00
"docs/formatters",
2025-08-04 23:52:03 +00:00
"docs/permissions",
2025-08-01 21:03:33 +00:00
"docs/lsp",
2025-08-04 23:52:03 +00:00
"docs/mcp-servers",
2025-07-31 21:38:48 +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",
},
plugins: [
theme({
2025-06-20 17:12:35 +00:00
headerLinks: config.headerLinks,
2025-05-31 18:41:00 +00:00
}),
],
}),
],
2025-07-09 15:01:42 +00:00
redirects: {
2025-07-09 23:55:06 +00:00
"/discord": "https://discord.gg/opencode",
2025-07-09 15:01:42 +00:00
},
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"])
},
},
}
}