update: 升级vben5.5.9到5.7.0

This commit is contained in:
2026-09-22 17:09:46 +08:00
parent 345e4a31f8
commit 802f72cd9e
766 changed files with 28468 additions and 15447 deletions
+21 -18
View File
@@ -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:'),