Skip to content

Commit e19d8b6

Browse files
committed
perf: build
1 parent c0deb5c commit e19d8b6

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

build.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,24 @@ const fileOrder = [
1515
'config/main.js',
1616
];
1717

18-
let combined = '';
19-
for (const relPath of fileOrder) {
20-
const fullPath = path.join(SRC_DIR, relPath);
21-
if (!fs.existsSync(fullPath)) {
22-
console.error(`错误:找不到源文件 ${fullPath}`);
23-
process.exit(1);
24-
}
25-
const content = fs.readFileSync(fullPath, 'utf8');
26-
combined += `\n` + content.trim() + '\n';
27-
}
18+
const combined =
19+
fileOrder
20+
.map((relPath) => {
21+
const fullPath = path.join(SRC_DIR, relPath);
22+
23+
if (!fs.existsSync(fullPath)) {
24+
console.error(`错误:找不到源文件 ${fullPath}`);
25+
process.exit(1);
26+
}
27+
28+
return fs.readFileSync(fullPath, 'utf8').trim();
29+
})
30+
.join('\n\n') + '\n';
2831

2932
if (!fs.existsSync(OUTPUT_DIR)) {
3033
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
3134
}
3235

3336
fs.writeFileSync(OUTPUT_FILE, combined, 'utf8');
37+
3438
console.log(`✅ 构建成功:${OUTPUT_FILE}`);

0 commit comments

Comments
 (0)