Skip to content

Commit 9308f5c

Browse files
SimplyLizclaude
andcommitted
docs(site): inject version from Cargo.toml at build time
astro.config.mjs reads [workspace.package].version once and exposes it via Vite's define as __LIP_VERSION__; src/version.ts re-exports it as a typed constant. Hero badge, terminal demo, and footer in index.astro now reference {version} instead of a hardcoded string, so future tag bumps only require Cargo.toml + a Vercel rebuild. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 10c663b commit 9308f5c

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

website/astro.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
import { defineConfig } from 'astro/config';
22
import mdx from '@astrojs/mdx';
3+
import { readFileSync } from 'node:fs';
4+
import { fileURLToPath } from 'node:url';
5+
import { dirname, resolve } from 'node:path';
6+
7+
const here = dirname(fileURLToPath(import.meta.url));
8+
const cargoToml = readFileSync(resolve(here, '../Cargo.toml'), 'utf8');
9+
const match = cargoToml.match(/^\s*\[workspace\.package\][^\[]*?^\s*version\s*=\s*"([^"]+)"/ms);
10+
if (!match) {
11+
throw new Error('astro.config: could not parse [workspace.package].version from Cargo.toml');
12+
}
13+
const version = match[1];
314

415
export default defineConfig({
516
site: 'https://lip.dev',
617
integrations: [mdx()],
18+
vite: {
19+
define: {
20+
__LIP_VERSION__: JSON.stringify(version),
21+
},
22+
},
723
});

website/src/pages/index.astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import Layout from '../layouts/Layout.astro';
3+
import { version } from '../version';
34
---
45

56
<Layout>
@@ -41,7 +42,7 @@ import Layout from '../layouts/Layout.astro';
4142
<div class="hero-head">
4243
<div class="badge">
4344
<span class="badge-dot"></span>
44-
v2.3.5 — Free & Open Source
45+
v{version} — Free & Open Source
4546
</div>
4647
<h1 class="hero-title">
4748
Live code intelligence.<br />
@@ -222,7 +223,7 @@ import Layout from '../layouts/Layout.astro';
222223
</div>
223224
<div class="terminal-body">
224225
<p class="tline"><span class="tprompt">$</span> <span class="tcmd">lip daemon --socket /tmp/lip.sock</span></p>
225-
<p class="tline tout">LIP daemon v2.3.5 — listening on /tmp/lip.sock</p>
226+
<p class="tline tout">LIP daemon v{version} — listening on /tmp/lip.sock</p>
226227
<p class="tline tout">Watching ./src <span class="tdim">3,847 files · Tier 1 warm</span></p>
227228
<p class="tline tgap"><span class="tprompt">$</span> <span class="tcmd">lip query blast-radius \</span></p>
228229
<p class="tline"><span class="tindent"></span><span class="tcmd">"lip://local/src/auth.rs#AuthService"</span></p>
@@ -985,7 +986,7 @@ import Layout from '../layouts/Layout.astro';
985986
<div class="footer-left">
986987
<div class="footer-logo">LIP</div>
987988
<div class="footer-tagline">Linked Incremental Protocol</div>
988-
<div class="footer-meta">Free & open source · MIT License · v2.3.5 · © 2026 Lisa Welsch</div>
989+
<div class="footer-meta">Free & open source · MIT License · v{version} · © 2026 Lisa Welsch</div>
989990
</div>
990991
<div class="footer-links">
991992
<a href="https://github.com/nyxCore-Systems/LIP" target="_blank" rel="noopener">GitHub</a>

website/src/version.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare const __LIP_VERSION__: string;
2+
3+
export const version = __LIP_VERSION__;

0 commit comments

Comments
 (0)