Skip to content

Commit 18874f7

Browse files
committed
fix(docs): commit pre-built docs for Vercel deployment
@sylphx/leaf package lacks CLI binary, preventing dynamic builds. Workaround: commit pre-built docs/dist and skip build on Vercel. Changes: - Remove docs/dist from .gitignore - Set buildCommand to empty in vercel.json - Update docs scripts to use vite directly (for local dev) - Add root and build.outDir to vite.config.docs.ts
1 parent 7d4e965 commit 18874f7

File tree

9 files changed

+146
-7
lines changed

9 files changed

+146
-7
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ coverage/
66
.env*
77

88
# Leaf
9-
docs/dist
109
docs/.leaf
1110
public/search-index.json
1211

docs/dist/assets/index-5PGWHWJe.js

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/dist/assets/index-ndDgOBBx.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/dist/index.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<!-- Basic meta tags (will be overridden by config) -->
5+
<meta charset="UTF-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta name="theme-color" content="#15803D" />
8+
<meta name="msapplication-TileColor" content="#15803D" />
9+
10+
<!-- Favicon (will be overridden by config) -->
11+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
12+
<link rel="icon" href="/favicon.png" sizes="32x32" type="image/png" />
13+
14+
<!-- Default title and description (will be overridden by config) -->
15+
<title>Loading...</title>
16+
<meta name="description" content="Documentation site built with Leaf" />
17+
18+
<!-- Default Open Graph tags (will be overridden by config) -->
19+
<meta property="og:type" content="website" />
20+
<meta property="og:title" content="Leaf" />
21+
<meta property="og:description" content="Documentation site built with Leaf" />
22+
<meta property="og:site_name" content="Leaf" />
23+
<meta property="og:image" content="/og-image.svg" />
24+
<meta property="og:image:width" content="1200" />
25+
<meta property="og:image:height" content="630" />
26+
27+
<!-- Default Twitter Card tags (will be overridden by config) -->
28+
<meta name="twitter:card" content="summary_large_image" />
29+
<meta name="twitter:title" content="Leaf" />
30+
<meta name="twitter:description" content="Documentation site built with Leaf" />
31+
<meta name="twitter:image" content="/twitter-image.svg" />
32+
<meta name="twitter:site" content="@sylphxltd" />
33+
34+
<!-- SEO tags (will be overridden by config) -->
35+
<meta name="keywords" content="documentation, docs, framework" />
36+
<meta name="author" content="Sylphx" />
37+
<meta name="robots" content="index, follow" />
38+
<meta name="language" content="en" />
39+
<link rel="canonical" href="https://leaf.sylphx.com" />
40+
<script>
41+
// CRITICAL: Set theme BEFORE any rendering to prevent flash
42+
(() => {
43+
const stored = localStorage.getItem('leaf-theme');
44+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
45+
const theme = stored || (prefersDark ? 'dark' : 'light');
46+
document.documentElement.setAttribute('data-theme', theme);
47+
})();
48+
</script>
49+
<script type="module" crossorigin src="/assets/index-5PGWHWJe.js"></script>
50+
<link rel="stylesheet" crossorigin href="/assets/index-ndDgOBBx.css">
51+
</head>
52+
<body>
53+
<div id="root"></div>
54+
55+
<!-- Mermaid initialization -->
56+
</body>
57+
</html>

docs/dist/logo.svg

Lines changed: 5 additions & 0 deletions
Loading

docs/dist/search-index.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
"check": "biome check .",
5959
"check:fix": "biome check --write .",
6060
"validate": "bun run check && bun run test",
61-
"docs:dev": "bunx @sylphx/leaf dev docs",
62-
"docs:build": "bunx @sylphx/leaf build docs",
63-
"docs:preview": "bunx @sylphx/leaf preview docs",
61+
"docs:dev": "vite --config vite.config.docs.ts",
62+
"docs:build": "vite build --config vite.config.docs.ts",
63+
"docs:preview": "vite preview --config vite.config.docs.ts",
6464
"start": "node dist/index.js",
6565
"typecheck": "tsc --noEmit",
6666
"benchmark": "bun bench",

vercel.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"$schema": "https://openapi.vercel.sh/vercel.json",
3-
"buildCommand": "bun run docs:build",
4-
"outputDirectory": "docs/dist",
5-
"installCommand": "bun install"
3+
"buildCommand": "",
4+
"outputDirectory": "docs/dist"
65
}

vite.config.docs.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { defineConfig } from 'vite';
55
const docsDir = resolve(process.cwd(), 'docs');
66

77
export default defineConfig({
8+
root: docsDir,
89
plugins: [
910
routesPlugin(docsDir),
1011
...createLeafPlugin({
@@ -16,4 +17,8 @@ export default defineConfig({
1617
resolve: {
1718
dedupe: ['solid-js', 'solid-js/web'],
1819
},
20+
build: {
21+
outDir: resolve(process.cwd(), 'docs/dist'),
22+
emptyOutDir: true,
23+
},
1924
});

0 commit comments

Comments
 (0)