mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 05:49:20 +08:00
update: 升级vben5.5.9到5.7.0
This commit is contained in:
@@ -4,7 +4,7 @@ import { cac } from 'cac';
|
||||
|
||||
import { version } from '../package.json';
|
||||
import { defineCheckCircularCommand } from './check-circular';
|
||||
import { defineDepcheckCommand } from './check-dep';
|
||||
import { defineCheckDepCommand } from './check-dep';
|
||||
import { defineCodeWorkspaceCommand } from './code-workspace';
|
||||
import { defineLintCommand } from './lint';
|
||||
import { definePubLintCommand } from './publint';
|
||||
@@ -30,29 +30,32 @@ async function main(): Promise<void> {
|
||||
definePubLintCommand(vsh);
|
||||
defineCodeWorkspaceCommand(vsh);
|
||||
defineCheckCircularCommand(vsh);
|
||||
defineDepcheckCommand(vsh);
|
||||
|
||||
// Handle invalid commands
|
||||
vsh.on('command:*', ([cmd]) => {
|
||||
consola.error(
|
||||
colors.red(`Invalid command: ${cmd}`),
|
||||
'\n',
|
||||
colors.yellow('Available commands:'),
|
||||
'\n',
|
||||
Object.entries(COMMAND_DESCRIPTIONS)
|
||||
.map(([cmd, desc]) => ` ${colors.cyan(cmd)} - ${desc}`)
|
||||
.join('\n'),
|
||||
);
|
||||
process.exit(1);
|
||||
});
|
||||
defineCheckDepCommand(vsh);
|
||||
|
||||
// Set up CLI
|
||||
vsh.usage('vsh <command> [options]');
|
||||
vsh.help();
|
||||
vsh.version(version);
|
||||
|
||||
// Parse arguments
|
||||
vsh.parse();
|
||||
// Parse arguments without auto-running to detect unknown commands
|
||||
// Note: cac v7 removed EventEmitter; use matchedCommand after parse instead
|
||||
vsh.parse(undefined, { run: false });
|
||||
|
||||
if (!vsh.matchedCommand && vsh.args.length > 0) {
|
||||
const unknownCmd = String(vsh.args[0]);
|
||||
consola.error(
|
||||
colors.red(`Invalid command: ${unknownCmd}`),
|
||||
'\n',
|
||||
colors.yellow('Available commands:'),
|
||||
'\n',
|
||||
Object.entries(COMMAND_DESCRIPTIONS)
|
||||
.map(([name, desc]) => ` ${colors.cyan(name)} - ${desc}`)
|
||||
.join('\n'),
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await vsh.runMatchedCommand();
|
||||
} catch (error) {
|
||||
consola.error(
|
||||
colors.red('An unexpected error occurred:'),
|
||||
|
||||
Reference in New Issue
Block a user