MCPcopy
hub / github.com/Lin-arm/GKD_subscription / parseReadMeMd

Function parseReadMeMd

scripts/updateReadMeMd.ts:4–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3// 从 README.md 中解析出 GROUP_SIZE、GLOBALGROUP_SIZE 和 VERSION 的值
4const parseReadMeMd = async () => {
5 const readmePath = process.cwd() + '/dist/README.md';
6 const readmeContent = await fs.readFile(readmePath, 'utf-8');
7
8 // 使用正则表达式匹配需要的值
9 const groupSizeMatch = readmeContent.match(/\|应用规则\|(\d+)\|/);
10 const globalGroupSizeMatch = readmeContent.match(/\|全局规则\|(\d+)\|/);
11 const appSizeMatch = readmeContent.match(/\|应用\|(\d+)\|/);
12 const versionMatch = readmeContent.match(/v(\d+)/);
13
14 const APP_SIZE = appSizeMatch ? appSizeMatch[1] : '';
15 const GROUP_SIZE = groupSizeMatch ? groupSizeMatch[1] : '';
16 const GLOBALGROUP_SIZE = globalGroupSizeMatch ? globalGroupSizeMatch[1] : '';
17 const VERSION = versionMatch ? versionMatch[1] : '';
18
19 return { APP_SIZE, GROUP_SIZE, GLOBALGROUP_SIZE, VERSION };
20};
21
22// 更新 README.md 的模板内容并写入文件
23export const updateReadMeMd = async () => {

Callers 1

updateReadMeMdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected