identifier-normalization, no-hardcoded-vendors, vendor-installer-verification, and build-version-display follow the go-database split: rules in contract.md, snippets in README.md. Routed contract reads get cheaper; examples stay available on demand. Lint now also rejects stale kit/patterns references. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
30 lines
522 B
Markdown
30 lines
522 B
Markdown
# Build Version Display Pattern Notes
|
|
|
|
This file keeps examples. The normative rules live in `contract.md`.
|
|
|
|
## Frontend (JS/TS build tools)
|
|
|
|
```ts
|
|
// vite.config.ts / webpack.config.js
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(process.env.APP_VERSION ?? "dev"),
|
|
}
|
|
|
|
// Footer component
|
|
<footer>v{__APP_VERSION__}</footer>
|
|
```
|
|
|
|
## Go (server-rendered HTML)
|
|
|
|
```go
|
|
// main.go
|
|
var Version = "dev"
|
|
|
|
// Build: go build -ldflags "-X main.Version=1.4.2"
|
|
```
|
|
|
|
```html
|
|
<!-- base template -->
|
|
<footer>v{{ .Version }}</footer>
|
|
```
|