chore: 引入统一日志模块,统一 cli 输出

This commit is contained in:
rbetree
2026-01-16 17:29:05 +08:00
parent f2f59108a0
commit 87d1f0244c
26 changed files with 903 additions and 150 deletions

View File

@@ -1,13 +1,19 @@
const fs = require('fs');
const path = require('path');
const { createLogger } = require('../src/generator/utils/logger');
const log = createLogger('clean');
const distPath = path.resolve(__dirname, '..', 'dist');
try {
fs.rmSync(distPath, { recursive: true, force: true });
console.log(`Removed ${distPath}`);
log.ok('删除 dist 目录', { path: distPath });
} catch (error) {
console.error(`Failed to remove ${distPath}`);
console.error(error);
log.error('删除 dist 目录失败', {
path: distPath,
message: error && error.message ? error.message : String(error),
});
process.exitCode = 1;
}