(filePath)
| 61 | |
| 62 | // 辅助函数 |
| 63 | function checkFile(filePath) { |
| 64 | const fullPath = path.join(projectRoot, filePath); |
| 65 | if (!fs.existsSync(fullPath)) { |
| 66 | BuildLogger.error(`文件不存在: ${filePath}`); |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | try { |
| 71 | execSync(`node -c "${fullPath}"`, { stdio: 'pipe' }); |
| 72 | return true; |
| 73 | } catch (error) { |
| 74 | BuildLogger.error(`语法错误: ${filePath}`); |
| 75 | BuildLogger.error(error.message); |
| 76 | return false; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | function checkEnvExample() { |
| 81 | const envPath = path.join(projectRoot, 'env.example'); |