mirror of
https://github.com/sst/opencode.git
synced 2025-08-04 13:30:52 +00:00
ci: generate config schema as part of build
Some checks are pending
deploy / deploy (push) Waiting to run
Some checks are pending
deploy / deploy (push) Waiting to run
This commit is contained in:
parent
8e9e383219
commit
5c626e0a2f
2 changed files with 18 additions and 1 deletions
|
@ -4,6 +4,8 @@ import "zod-openapi/extend"
|
|||
import { Config } from "../src/config/config"
|
||||
import { zodToJsonSchema } from "zod-to-json-schema"
|
||||
|
||||
const file = process.argv[2]
|
||||
|
||||
const result = zodToJsonSchema(Config.Info, {
|
||||
/**
|
||||
* We'll use the `default` values of the field as the only value in `examples`.
|
||||
|
@ -30,4 +32,4 @@ const result = zodToJsonSchema(Config.Info, {
|
|||
return jsonSchema
|
||||
},
|
||||
})
|
||||
await Bun.write("config.schema.json", JSON.stringify(result, null, 2))
|
||||
await Bun.write(file, JSON.stringify(result, null, 2))
|
||||
|
|
|
@ -7,6 +7,7 @@ import theme from "toolbeam-docs-theme"
|
|||
import config from "./config.mjs"
|
||||
import { rehypeHeadingIds } from "@astrojs/markdown-remark"
|
||||
import rehypeAutolinkHeadings from "rehype-autolink-headings"
|
||||
import { spawnSync } from "child_process"
|
||||
|
||||
const github = "https://github.com/sst/opencode"
|
||||
|
||||
|
@ -26,7 +27,9 @@ export default defineConfig({
|
|||
markdown: {
|
||||
rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],
|
||||
},
|
||||
build: {},
|
||||
integrations: [
|
||||
configSchema(),
|
||||
solidJs(),
|
||||
starlight({
|
||||
title: "opencode",
|
||||
|
@ -83,3 +86,15 @@ export default defineConfig({
|
|||
"/discord": "https://discord.com/invite/opencode",
|
||||
},
|
||||
})
|
||||
|
||||
function configSchema() {
|
||||
return {
|
||||
name: "configSchema",
|
||||
hooks: {
|
||||
"astro:build:done": async () => {
|
||||
console.log("generating config schema")
|
||||
spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue