opencode/packages/web/astro.config.mjs

119 lines
2.8 KiB
JavaScript
Raw Normal View History

2025-05-21 14:24:53 -04:00
// @ts-check
2025-05-31 14:41:00 -04:00
import { defineConfig } from "astro/config"
import starlight from "@astrojs/starlight"
import solidJs from "@astrojs/solid-js"
2025-06-07 23:46:53 -04:00
import cloudflare from "@astrojs/cloudflare"
2025-05-31 14:41:00 -04:00
import theme from "toolbeam-docs-theme"
2025-06-20 13:12:35 -04:00
import config from "./config.mjs"
2025-05-31 14:41:00 -04:00
import { rehypeHeadingIds } from "@astrojs/markdown-remark"
import rehypeAutolinkHeadings from "rehype-autolink-headings"
import { spawnSync } from "child_process"
2025-05-21 14:24:53 -04:00
2025-05-31 14:41:00 -04:00
const github = "https://github.com/sst/opencode"
2025-07-07 16:13:24 -04:00
2025-05-21 14:24:53 -04:00
// https://astro.build/config
export default defineConfig({
2025-07-07 16:36:52 -04:00
site: config.url,
2025-06-05 15:37:17 -04:00
output: "server",
2025-06-07 23:46:53 -04:00
adapter: cloudflare({
imageService: "passthrough",
}),
2025-05-31 14:41:00 -04:00
devToolbar: {
enabled: false,
},
server: {
host: "0.0.0.0",
},
2025-05-31 14:41:00 -04:00
markdown: {
rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],
2025-05-31 14:41:00 -04:00
},
build: {},
2025-05-31 14:41:00 -04:00
integrations: [
configSchema(),
2025-05-31 14:41:00 -04:00
solidJs(),
starlight({
2025-06-19 16:26:58 -04:00
title: "opencode",
2025-07-15 19:54:51 -04:00
lastUpdated: true,
2025-05-31 14:41:00 -04:00
expressiveCode: { themes: ["github-light", "github-dark"] },
2025-07-07 14:44:37 -04:00
social: [
{ icon: "github", label: "GitHub", href: config.github },
{ icon: "discord", label: "Dscord", href: config.discord },
2025-07-07 14:44:37 -04:00
],
2025-06-26 17:22:17 -04:00
head: [
{
tag: "link",
attrs: {
rel: "icon",
href: "/favicon.svg",
},
},
],
2025-05-31 14:41:00 -04:00
editLink: {
baseUrl: `${github}/edit/dev/packages/web/`,
2025-05-31 14:41:00 -04: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 15:46:53 -04:00
"docs/enterprise",
2025-07-09 10:12:28 -05:00
"docs/troubleshooting",
{
label: "Usage",
2025-07-31 17:38:48 -04:00
items: ["docs/cli", "docs/ide", "docs/share", "docs/github"],
},
{
label: "Configure",
items: [
"docs/rules",
"docs/agents",
"docs/models",
"docs/themes",
2025-08-04 19:52:03 -04:00
"docs/plugins",
"docs/keybinds",
2025-07-31 19:50:31 -04:00
"docs/formatters",
2025-08-04 19:52:03 -04:00
"docs/permissions",
2025-08-01 17:03:33 -04:00
"docs/lsp",
2025-08-04 19:52:03 -04:00
"docs/mcp-servers",
2025-07-31 17:38:48 -04:00
],
},
2025-05-31 14:41:00 -04:00
],
components: {
Hero: "./src/components/Hero.astro",
2025-06-27 20:03:17 -04:00
Head: "./src/components/Head.astro",
2025-05-31 14:41:00 -04:00
Header: "./src/components/Header.astro",
},
plugins: [
theme({
2025-06-20 13:12:35 -04:00
headerLinks: config.headerLinks,
2025-05-31 14:41:00 -04:00
}),
],
}),
],
2025-07-09 10:01:42 -05:00
redirects: {
2025-07-09 19:55:06 -04:00
"/discord": "https://discord.gg/opencode",
2025-07-09 10:01:42 -05:00
},
2025-05-31 14:41:00 -04:00
})
function configSchema() {
return {
name: "configSchema",
hooks: {
"astro:build:done": async () => {
console.log("generating config schema")
spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
},
},
}
}