admin-vben/scripts/vsh/src/index.ts

42 lines
888 B
TypeScript
Raw Normal View History

2024-05-19 13:20:42 +00:00
import { colors, consola } from '@vben/node-utils';
2024-06-08 11:49:06 +00:00
2024-05-19 13:20:42 +00:00
import { cac } from 'cac';
import { defineCheckCircularCommand } from './check-circular';
import { defineDepcheckCommand } from './check-dep';
import { defineCodeWorkspaceCommand } from './code-workspace';
import { defineLintCommand } from './lint';
import { definePubLintCommand } from './publint';
try {
const vsh = cac('vsh');
// vsh lint
defineLintCommand(vsh);
// vsh publint
definePubLintCommand(vsh);
// vsh code-workspace
defineCodeWorkspaceCommand(vsh);
// vsh check-circular
defineCheckCircularCommand(vsh);
// vsh check-dep
defineDepcheckCommand(vsh);
// Invalid command
vsh.on('command:*', () => {
consola.error(colors.red('Invalid command!'));
process.exit(1);
});
vsh.usage('vsh');
vsh.help();
vsh.parse();
} catch (error) {
consola.error(error);
process.exit(1);
}