Skip to content

Commit 14d6943

Browse files
committed
feat(docs): auto sync saltify version in index.md
1 parent 6e1579d commit 14d6943

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

saltify-docs/content/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ Saltify 是一个跨平台、可扩展的 Kotlin QQ Bot 框架 & Milky SDK。
1212

1313
### 添加 Saltify 依赖
1414

15-
[![Maven Central](https://img.shields.io/maven-central/v/org.ntqqrev/saltify-core?label=Maven%20Central&logo=maven)](https://central.sonatype.com/artifact/org.ntqqrev/saltify-core)
16-
1715
对于使用 Gradle 的 Kotlin 项目,可以在 `build.gradle.kts` 中添加以下内容:
1816

1917
```kotlin
2018
dependencies {
2119
// 核心模块
22-
implementation("org.ntqqrev:saltify-core:$saltifyVersion")
20+
implementation("org.ntqqrev:saltify-core:1.2.0-RC2.1")
2321

2422
// 你可以选择为 Ktor client 使用不同的引擎而不是 cio,这里只是一个推荐。
2523
implementation("io.ktor:ktor-client-cio:$ktorVersion")

saltify-docs/scripts/extract-version.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,14 @@ const outputPath = path.join(__dirname, '../app/version.ts');
1212
const output = `export const SALTIFY_VERSION = '${version}';`;
1313

1414
fs.writeFileSync(outputPath, output, 'utf8');
15+
16+
// 替换 content/index.md 中的版本号
17+
const indexPath = path.join(__dirname, '../content/index.md');
18+
let indexContent = fs.readFileSync(indexPath, 'utf8');
19+
20+
indexContent = indexContent.replace(
21+
/"org\.ntqqrev:saltify-core:[^"]+"/g,
22+
`"org.ntqqrev:saltify-core:${version}"`
23+
);
24+
25+
fs.writeFileSync(indexPath, indexContent, 'utf8');

0 commit comments

Comments
 (0)