MCPcopy Create free account
hub / github.com/Silentely/eSIM-Tools / main

Function main

scripts/prepare-commit-msg.js:25–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25function main() {
26 const messageFilePath = process.argv[2];
27 const commitSource = process.argv[3] || '';
28
29 if (!messageFilePath || SKIP_SOURCES.has(commitSource)) {
30 return;
31 }
32
33 const original = fs.readFileSync(messageFilePath, 'utf8');
34 const firstLine = getFirstMeaningfulLine(original);
35 if (firstLine) {
36 return;
37 }
38
39 const commentLines = original
40 .split(/\r?\n/)
41 .filter(line => line.trim().startsWith('#'));
42
43 const content = [
44 TEMPLATE_HEADER,
45 '',
46 '# 格式: <emoji> <type>(optional-scope): <中文描述>',
47 '# 示例: 🐛 fix(simyo): 修复验证码重试逻辑',
48 ...commentLines
49 ].join('\n');
50
51 fs.writeFileSync(messageFilePath, content, 'utf8');
52}
53
54main();

Callers 1

Calls 2

hasMethod · 0.80
getFirstMeaningfulLineFunction · 0.70

Tested by

no test coverage detected