astro.config.mjs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. lastUpdated: true,
  35. expressiveCode: { themes: ["github-light", "github-dark"] },
  36. social: [
  37. { icon: "github", label: "GitHub", href: config.github },
  38. { icon: "discord", label: "Dscord", href: config.discord },
  39. ],
  40. head: [
  41. {
  42. tag: "link",
  43. attrs: {
  44. rel: "icon",
  45. href: "/favicon.svg",
  46. },
  47. },
  48. ],
  49. editLink: {
  50. baseUrl: `${github}/edit/dev/packages/web/`,
  51. },
  52. markdown: {
  53. headingLinks: false,
  54. },
  55. customCss: ["./src/styles/custom.css"],
  56. logo: {
  57. light: "./src/assets/logo-light.svg",
  58. dark: "./src/assets/logo-dark.svg",
  59. replacesTitle: true,
  60. },
  61. sidebar: [
  62. "docs",
  63. "docs/cli",
  64. "docs/share",
  65. "docs/modes",
  66. "docs/rules",
  67. "docs/config",
  68. "docs/models",
  69. "docs/themes",
  70. "docs/keybinds",
  71. "docs/enterprise",
  72. "docs/mcp-servers",
  73. "docs/troubleshooting",
  74. ],
  75. components: {
  76. Hero: "./src/components/Hero.astro",
  77. Head: "./src/components/Head.astro",
  78. Header: "./src/components/Header.astro",
  79. },
  80. plugins: [
  81. theme({
  82. headerLinks: config.headerLinks,
  83. }),
  84. ],
  85. }),
  86. ],
  87. redirects: {
  88. "/discord": "https://discord.gg/opencode",
  89. },
  90. })
  91. function configSchema() {
  92. return {
  93. name: "configSchema",
  94. hooks: {
  95. "astro:build:done": async () => {
  96. console.log("generating config schema")
  97. spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
  98. },
  99. },
  100. }
  101. }