File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
2932if ( ! fs . existsSync ( OUTPUT_DIR ) ) {
3033 fs . mkdirSync ( OUTPUT_DIR , { recursive : true } ) ;
3134}
3235
3336fs . writeFileSync ( OUTPUT_FILE , combined , 'utf8' ) ;
37+
3438console . log ( `✅ 构建成功:${ OUTPUT_FILE } ` ) ;
You can’t perform that action at this time.
0 commit comments