chore: 更新文档

This commit is contained in:
lisonge
2023-09-25 14:37:10 +08:00
parent d274931482
commit 255e132f98
3 changed files with 14 additions and 14 deletions

View File

@@ -1,10 +1,8 @@
# @gkd-kit/subscription
<p>
<a href="https://www.npmjs.com/package/@gkd-kit/subscription"><img src="https://img.shields.io/npm/v/@gkd-kit/subscription.svg" alt="npm package"></a>
</p>
GKD 默认订阅规则
搞快点 APP 默认订阅规则
当前订阅为 APP 自带, 无需手动添加, 当前版本: v108
当前订阅文件已适配 204 个 APP, 共有 505 规则组
@@ -221,4 +219,4 @@
## 感谢以下开发者的贡献
![img](https://contrib.rocks/image?repo=gkd-kit/subscription)
![img](https://contrib.rocks/image?repo=gkd-kit/subscription&_v=--VERSION--)

View File

@@ -1,10 +1,8 @@
# @gkd-kit/subscription
<p>
<a href="https://www.npmjs.com/package/@gkd-kit/subscription"><img src="https://img.shields.io/npm/v/@gkd-kit/subscription.svg" alt="npm package"></a>
</p>
GKD 默认订阅规则
搞快点 APP 默认订阅规则
当前订阅为 APP 自带, 无需手动添加, 当前版本: v--VERSION--
当前订阅文件已适配 --APP_SIZE-- 个 APP, 共有 --GROUP_SIZE-- 规则组
@@ -16,4 +14,4 @@
## 感谢以下开发者的贡献
![img](https://contrib.rocks/image?repo=gkd-kit/subscription)
![img](https://contrib.rocks/image?repo=gkd-kit/subscription&_v=--VERSION--)

View File

@@ -30,15 +30,19 @@ export const writeConfig = async (fp: string, config: SubscriptionConfig) => {
newConfig.version = oldConfig.version || 0;
checkConfig(newConfig);
const hasUpdate = !_.isEqual(newConfig, oldConfig);
if (hasUpdate) {
newConfig.version++;
}
// update md
await updateReadMeMd(newConfig);
console.log('更新文档');
if (_.isEqual(newConfig, oldConfig)) {
console.log('没有检测到规则变化,跳过更新');
if (!hasUpdate) {
console.log('没有检测到规则变化,跳过更新JSON');
return;
}
newConfig.version++;
// keep json key sort by map
const map = new Map<string, unknown>();
@@ -288,7 +292,7 @@ export const updateReadMeMd = async (newConfig: SubscriptionConfig) => {
.reduce((p, c) => p + (c.groups?.length || 0), 0)
.toString(),
)
.replace('--VERSION--', (newConfig.version || 0).toString())
.replace('--APP_LIST--', appListText);
await fs.writeFile(process.cwd() + '/README.md', readMeMdText);
};