Files
ui/apps/cd/vite.config.ts
zeekayandHanzo Dev 57f9435929 Keep every package in one directory
The workspace declared pkg/* and pkgs/* both, so one repo had two names
for one concept and a package's home was a coin toss. The shared build
tooling already lived in pkg/ui/scripts and pkgs reached back into it
two levels up; now it is a sibling. hanzo.yml gates on pkg/ui, so the
published library stays where CI already looks and the rest joins it.

The publish glob follows: one root, one pattern, nothing invisible to it.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-08 23:50:28 -07:00

41 lines
1.7 KiB
TypeScript

import { fileURLToPath, URL } from "node:url"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vitest/config"
/**
* Hanzo CD — a static SPA served at cd.hanzo.ai from the shared static plane
* (s3://cdn/cd, ingress staticFiles/spaMode). `/v1/deploy/*` is peeled off to the
* cloud binary by the ingress, so in prod the SPA calls same-origin `/v1/deploy`
* with the `hanzo_iam_token` cookie (cloud validates → SuperAdmin gate).
*
* The @hanzo/cd (built dist) + @hanzo/canvas/pure (pure TS source) workspace
* packages are resolved by path alias so the app builds without a full monorepo
* install (the shared store lacks the registry deps of the heavier packages). A
* dev proxy forwards `/v1` to CD_API (default the live cluster) for local dev.
*/
const r = (p: string) => fileURLToPath(new URL(p, import.meta.url))
const CD_API = process.env.CD_API ?? "https://cd.hanzo.ai"
export default defineConfig({
plugins: [react()],
resolve: {
dedupe: ["react", "react-dom"],
alias: {
"@hanzo/cd": r("../../pkg/cd/dist/index.mjs"),
"@hanzo/canvas/pure": r("../../pkg/canvas/src/pure.ts"),
},
},
// Plain CSS only — override the monorepo-root PostCSS/Tailwind config discovery
// (this app has no Tailwind; the @hanzo/cd components ship their own scoped CSS).
css: { postcss: { plugins: [] } },
build: { outDir: "dist", target: "es2022", sourcemap: false },
server: {
port: 4200,
proxy: { "/v1": { target: CD_API, changeOrigin: true, secure: false } },
},
// The e2e/ specs are Playwright's (they use test.beforeAll); vitest must not
// glob them, or a bare `vitest run` reports a red suite for a passing app.
test: { exclude: ["e2e/**", "node_modules/**", "dist/**"] },
})