Skip to content

Commit 95d738d

Browse files
committed
docs: dynamically resolve version from git tag
Replace hardcoded version in nav badge and installation examples with dynamic resolution from the latest git tag. Remove the migration guide as it has limited value without breaking changes.
1 parent 9935810 commit 95d738d

3 files changed

Lines changed: 30 additions & 242 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
import { defineConfig } from 'vitepress'
2+
import { execSync } from 'child_process'
3+
4+
function getKapperVersion(): string {
5+
if (process.env.KAPPER_VERSION) {
6+
return process.env.KAPPER_VERSION
7+
}
8+
try {
9+
return execSync('git tag --sort=-v:refname | head -1', { encoding: 'utf-8' }).trim()
10+
} catch {
11+
return 'dev'
12+
}
13+
}
14+
15+
const kapperVersion = getKapperVersion()
216

317
export default defineConfig({
418
title: 'Kapper',
519
description: 'A lightweight, Dapper-inspired ORM for Kotlin and the JVM',
620
base: '/kapper/',
21+
markdown: {
22+
config: (md) => {
23+
const defaultRender = md.render.bind(md)
24+
md.render = (src: string, env: any) => {
25+
src = src.replaceAll('%kapper_version%', kapperVersion)
26+
return defaultRender(src, env)
27+
}
28+
}
29+
},
730
ignoreDeadLinks: [
831
// Ignore all API documentation links (generated by dokka)
932
(url, context) => {
@@ -31,11 +54,10 @@ export default defineConfig({
3154
{ text: 'Performance', link: '/performance/' },
3255
{ text: 'API Reference', link: '/api/' },
3356
{ text: 'Blog', link: '/blog/' },
34-
{
35-
text: 'v1.6.1',
57+
{
58+
text: `v${kapperVersion}`,
3659
items: [
37-
{ text: 'Changelog', link: '/changelog' },
38-
{ text: 'Migration Guide', link: '/guide/migration' }
60+
{ text: 'Changelog', link: '/changelog' }
3961
]
4062
}
4163
],

docs/guide/installation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Add Kapper to your `build.gradle.kts`:
66

77
```kotlin
88
dependencies {
9-
implementation("net.samyn:kapper:1.6.1")
9+
implementation("net.samyn:kapper:%kapper_version%")
1010
}
1111
```
1212

1313
For coroutine support, use:
1414

1515
```kotlin
1616
dependencies {
17-
implementation("net.samyn:kapper-coroutines:1.6.1")
17+
implementation("net.samyn:kapper-coroutines:%kapper_version%")
1818
}
1919
```
2020

@@ -24,7 +24,7 @@ Add Kapper to your `build.gradle`:
2424

2525
```groovy
2626
dependencies {
27-
implementation 'net.samyn:kapper:1.6.1'
27+
implementation 'net.samyn:kapper:%kapper_version%'
2828
}
2929
```
3030

@@ -36,7 +36,7 @@ Add the following dependency to your `pom.xml`:
3636
<dependency>
3737
<groupId>net.samyn</groupId>
3838
<artifactId>kapper</artifactId>
39-
<version>1.6.1</version>
39+
<version>%kapper_version%</version>
4040
</dependency>
4141
```
4242

docs/guide/migration.md

Lines changed: 0 additions & 234 deletions
This file was deleted.

0 commit comments

Comments
 (0)