mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 17:01:37 +03:00
chore(www): stop committing copies of the OpenAPI spec (#58593)
This commit is contained in:
committed by
GitHub
Unverified
parent
43f7997bfa
commit
8521baf8b0
@@ -1,5 +1,11 @@
|
||||
packages/core/migration/**/snapshot.json linguist-generated
|
||||
packages/core/src/database/migration.gen.ts linguist-generated
|
||||
packages/core/src/models-dev/snapshot.txt linguist-generated
|
||||
packages/core/src/database/schema.gen.ts linguist-generated
|
||||
packages/desktop/src/main/storage/migration.gen.ts linguist-generated
|
||||
packages/protocol/openapi.json linguist-generated
|
||||
packages/client/src/promise/generated/** linguist-generated
|
||||
packages/client/src/effect/generated/** linguist-generated
|
||||
packages/client/src/effect/api/** linguist-generated
|
||||
packages/core/src/**/*.txt text eol=lf
|
||||
packages/httpapi-codegen/test/generated/*.ts text eol=lf
|
||||
|
||||
@@ -138,11 +138,6 @@ jobs:
|
||||
working-directory: packages/protocol
|
||||
run: bun run check:generated
|
||||
|
||||
- name: Check generated documentation
|
||||
if: runner.os == 'Linux'
|
||||
working-directory: services/www
|
||||
run: bun run check:generated
|
||||
|
||||
build:
|
||||
name: build (${{ matrix.settings.name }})
|
||||
strategy:
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
dist/
|
||||
node_modules/
|
||||
public/cli.json
|
||||
public/openapi.json
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
- Only `base` in `astro.config.ts` should know the deployment subpath. Use `import.meta.env.BASE_URL` everywhere else.
|
||||
- The documentation feature is self-contained under `src/docs/` and renders through the thin route in `src/pages/docs/`.
|
||||
- Do not add a documentation frontend framework; this package owns the UI directly.
|
||||
- Keep the installer route dynamic and `public/openapi.json` generated from `packages/protocol/openapi.json`.
|
||||
- Keep the installer route dynamic. The API reference imports `packages/protocol/openapi.json` directly, and `bun run generate` copies it to the gitignored `public/openapi.json`.
|
||||
|
||||
## Local development
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
|
||||
## Validation
|
||||
|
||||
- Run `bun typecheck`, `bun run check:generated`, and `bun run build` from this package after changes.
|
||||
- Run `bun typecheck` and `bun run build` from this package after changes.
|
||||
- Treat validation and build errors as blockers.
|
||||
|
||||
@@ -5,7 +5,7 @@ The standard Astro website for OpenCode. The only deployment-specific path is th
|
||||
- `src/pages/` owns website routes.
|
||||
- `src/docs/` is the self-contained documentation feature rendered under `/docs`.
|
||||
- `/install` proxies the current installer.
|
||||
- `/openapi.json` serves the generated OpenAPI specification.
|
||||
- `/openapi.json` serves `packages/protocol/openapi.json`, copied into `public/` by `bun run generate` before `dev` and `build`.
|
||||
|
||||
The deployment currently sets `base: "/v2"`. The `v2.opencode.ai` alias is handled by a Cloudflare Redirect Rule outside this project.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,6 @@
|
||||
"build": "bun run generate && astro build && bun script/pagefind.ts && bun run validate && bun script/prepare-cloudflare.ts",
|
||||
"deploy": "wrangler deploy --config dist/server/wrangler.json",
|
||||
"generate": "bun script/generate-openapi.ts && bun --cwd ../../packages/cli script/schema.ts ../../services/www/public/cli.json",
|
||||
"check:generated": "bun script/generate-openapi.ts --check",
|
||||
"validate": "bun script/validate-links.ts",
|
||||
"typecheck": "astro check",
|
||||
"typecheck:tsc": "astro check"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,6 @@
|
||||
import { fileURLToPath } from "url"
|
||||
|
||||
const source = fileURLToPath(new URL("../../../packages/protocol/openapi.json", import.meta.url))
|
||||
const targets = ["../openapi.json", "../public/openapi.json"].map((path) =>
|
||||
fileURLToPath(new URL(path, import.meta.url)),
|
||||
await Bun.write(
|
||||
fileURLToPath(new URL("../public/openapi.json", import.meta.url)),
|
||||
Bun.file(fileURLToPath(new URL("../../../packages/protocol/openapi.json", import.meta.url))),
|
||||
)
|
||||
const document = await Bun.file(source).text()
|
||||
|
||||
if (process.argv.includes("--check")) {
|
||||
const stale = (await Promise.all(targets.map((path) => Bun.file(path).text()))).some((value) => value !== document)
|
||||
if (stale) {
|
||||
console.error("Generated OpenAPI documents are stale. Run `bun run generate` from services/www.")
|
||||
process.exit(1)
|
||||
}
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
await Promise.all(targets.map((path) => Bun.write(path, document)))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import openapi from "../../../openapi.json"
|
||||
import openapi from "../../../../../packages/protocol/openapi.json"
|
||||
import type { OpenApiOperation, OpenApiSchema } from "../lib/openapi"
|
||||
import { openApiSchemaLabel } from "../lib/openapi"
|
||||
import OpenApiSchemaView from "./OpenApiSchema.astro"
|
||||
|
||||
Reference in New Issue
Block a user