astro.config.mjs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // @ts-check
  2. import { defineConfig } from "astro/config"
  3. import starlight from "@astrojs/starlight"
  4. import solidJs from "@astrojs/solid-js"
  5. import cloudflare from "@astrojs/cloudflare"
  6. import theme from "toolbeam-docs-theme"
  7. import config from "./config.mjs"
  8. import { rehypeHeadingIds } from "@astrojs/markdown-remark"
  9. import rehypeAutolinkHeadings from "rehype-autolink-headings"
  10. import { spawnSync } from "child_process"
  11. const github = "https://github.com/sst/opencode"
  12. // https://astro.build/config
  13. export default defineConfig({
  14. site: config.url,
  15. output: "server",
  16. adapter: cloudflare({
  17. imageService: "passthrough",
  18. }),
  19. devToolbar: {
  20. enabled: false,
  21. },
  22. server: {
  23. host: "0.0.0.0",
  24. },
  25. markdown: {
  26. rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],
  27. },
  28. build: {},
  29. integrations: [
  30. configSchema(),
  31. solidJs(),
  32. starlight({
  33. title: "opencode",
  34. expressiveCode: { themes: ["github-light", "github-dark"] },
  35. social: [
  36. { icon: "github", label: "GitHub", href: config.github },
  37. { icon: "discord", label: "Dscord", href: config.discord },
  38. ],
  39. head: [
  40. {
  41. tag: "link",
  42. attrs: {
  43. rel: "icon",
  44. href: "/favicon.svg",
  45. },
  46. },
  47. ],
  48. editLink: {
  49. baseUrl: `${github}/edit/dev/packages/web/`,
  50. },
  51. markdown: {
  52. headingLinks: false,
  53. },
  54. customCss: ["./src/styles/custom.css"],
  55. logo: {
  56. light: "./src/assets/logo-light.svg",
  57. dark: "./src/assets/logo-dark.svg",
  58. replacesTitle: true,
  59. },
  60. sidebar: [
  61. "docs",
  62. "docs/cli",
  63. "docs/rules",
  64. "docs/share",
  65. "docs/config",
  66. "docs/models",
  67. "docs/themes",
  68. "docs/keybinds",
  69. "docs/enterprise",
  70. "docs/mcp-servers",
  71. "docs/troubleshooting",
  72. ],
  73. components: {
  74. Hero: "./src/components/Hero.astro",
  75. Head: "./src/components/Head.astro",
  76. Header: "./src/components/Header.astro",
  77. },
  78. plugins: [
  79. theme({
  80. headerLinks: config.headerLinks,
  81. }),
  82. ],
  83. }),
  84. ],
  85. redirects: {
  86. "/discord": "https://discord.gg/opencode",
  87. },
  88. })
  89. function configSchema() {
  90. return {
  91. name: "configSchema",
  92. hooks: {
  93. "astro:build:done": async () => {
  94. console.log("generating config schema")
  95. spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
  96. },
  97. },
  98. }
  99. }