chore: 引入统一日志模块,统一 cli 输出
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user