Move inline code examples out of normative contracts
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>
This commit is contained in:
29
rules/patterns/build-version-display/README.md
Normal file
29
rules/patterns/build-version-display/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# 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>
|
||||
```
|
||||
Reference in New Issue
Block a user