mirror of
https://github.com/AIsouler/GKD_subscription.git
synced 2025-12-19 16:25:09 +08:00
chore: v152
This commit is contained in:
15
src/file.ts
15
src/file.ts
@@ -36,7 +36,7 @@ export const writeConfig = async (fp: string, config: SubscriptionConfig) => {
|
||||
}
|
||||
|
||||
// update md
|
||||
await updateReadMeMd(newConfig);
|
||||
await updateReadMeMd(newConfig, oldConfig);
|
||||
console.log('更新文档');
|
||||
|
||||
if (!hasUpdate) {
|
||||
@@ -268,12 +268,21 @@ export const updateAppMd = async (app: AppConfig) => {
|
||||
const appMdText = [appHeadMdText, groupMdText].join('\n\n').trim() + '\n';
|
||||
await fs.writeFile(process.cwd() + `/docs/${app.id}.md`, appMdText, 'utf-8');
|
||||
};
|
||||
export const updateReadMeMd = async (newConfig: SubscriptionConfig) => {
|
||||
export const updateReadMeMd = async (
|
||||
newConfig: SubscriptionConfig,
|
||||
oldConfig: SubscriptionConfig,
|
||||
) => {
|
||||
let changeCount = 0;
|
||||
await Promise.all(
|
||||
newConfig.apps.map(async (app) => {
|
||||
await updateAppMd(app);
|
||||
const oldApp = oldConfig.apps.find((a) => a.id == app.id);
|
||||
if (!_.isEqual(oldApp, app)) {
|
||||
await updateAppMd(app);
|
||||
changeCount++;
|
||||
}
|
||||
}),
|
||||
);
|
||||
if (changeCount <= 0) return;
|
||||
|
||||
const appListText =
|
||||
'| 名称 | ID | 规则组 |\n| - | - | - |\n' +
|
||||
|
||||
Reference in New Issue
Block a user