Move release version resolution from build-time (vite.config.ts) to runtime (server function on Cloudflare Workers). The server function fetches GitHub releases, filters out prereleases/drafts, and only returns a version that has all required assets (Mac DMG, Linux AppImage, Windows exe). Uses Cloudflare's cf.cacheEverything with a 60s TTL to avoid hitting GitHub on every request. This fixes a race condition where the website would deploy and show download links for a new release before the desktop build assets were actually uploaded, resulting in 404s for users.
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import path from "node:path";
|
|
import { defineConfig, type UserConfig } from "vite";
|
|
import tsConfigPaths from "vite-tsconfig-paths";
|
|
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
import react from "@vitejs/plugin-react";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
|
|
const repoRoot = path.resolve(__dirname, "../..");
|
|
const siteHost = "https://paseo.sh";
|
|
const sitemapPages = [
|
|
"/",
|
|
"/changelog",
|
|
"/claude-code",
|
|
"/codex",
|
|
"/docs",
|
|
"/download",
|
|
"/opencode",
|
|
"/privacy",
|
|
"/docs/best-practices",
|
|
"/docs/cli",
|
|
"/docs/configuration",
|
|
"/docs/security",
|
|
"/docs/updates",
|
|
"/docs/voice",
|
|
"/docs/worktrees",
|
|
].map((routePath) => ({
|
|
path: routePath,
|
|
}));
|
|
|
|
export default defineConfig((): UserConfig => {
|
|
return {
|
|
server: {
|
|
port: 8082,
|
|
fs: {
|
|
allow: [repoRoot],
|
|
},
|
|
},
|
|
plugins: [
|
|
cloudflare({ viteEnvironment: { name: "ssr" } }),
|
|
tsConfigPaths(),
|
|
tanstackStart({
|
|
pages: sitemapPages,
|
|
sitemap: {
|
|
host: siteHost,
|
|
},
|
|
}),
|
|
react(),
|
|
tailwindcss(),
|
|
],
|
|
};
|
|
});
|