index.ts 888 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { colors, consola } from '@vben/node-utils';
  2. import { cac } from 'cac';
  3. import { defineCheckCircularCommand } from './check-circular';
  4. import { defineDepcheckCommand } from './check-dep';
  5. import { defineCodeWorkspaceCommand } from './code-workspace';
  6. import { defineLintCommand } from './lint';
  7. import { definePubLintCommand } from './publint';
  8. try {
  9. const vsh = cac('vsh');
  10. // vsh lint
  11. defineLintCommand(vsh);
  12. // vsh publint
  13. definePubLintCommand(vsh);
  14. // vsh code-workspace
  15. defineCodeWorkspaceCommand(vsh);
  16. // vsh check-circular
  17. defineCheckCircularCommand(vsh);
  18. // vsh check-dep
  19. defineDepcheckCommand(vsh);
  20. // Invalid command
  21. vsh.on('command:*', () => {
  22. consola.error(colors.red('Invalid command!'));
  23. process.exit(1);
  24. });
  25. vsh.usage('vsh');
  26. vsh.help();
  27. vsh.parse();
  28. } catch (error) {
  29. consola.error(error);
  30. process.exit(1);
  31. }