1
0
mirror of synced 2026-04-03 06:28:35 +08:00

feat(cli): 优化 logger,优化 ast 解析

This commit is contained in:
kevinyzheng
2022-11-04 16:03:35 +08:00
committed by roymondchen
parent a03ac7c78b
commit 958bcd3ec5
3 changed files with 31 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
import { cac } from 'cac';
import chalk from 'chalk';
import { allowTs } from './utils/allowTs';
import { error } from './utils/logger';
import { scripts } from './commands';
import { UserConfig } from './types';
@@ -11,7 +11,7 @@ import { UserConfig } from './types';
const wrapCommand = (cmd: (...args: any[]) => Promise<void>): typeof cmd => {
const wrappedCommand: typeof cmd = (...args) =>
cmd(...args).catch((err) => {
console.error(chalk.red(err.stack));
error(err.stack);
process.exit(1);
});
return wrappedCommand;