index.ts 977 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 { defineCleanCommand } from './clean';
  6. import { defineCodeWorkspaceCommand } from './code-workspace';
  7. import { defineLintCommand } from './lint';
  8. import { definePubLintCommand } from './publint';
  9. try {
  10. const vsh = cac('vsh');
  11. // vsh lint
  12. defineLintCommand(vsh);
  13. // vsh publint
  14. definePubLintCommand(vsh);
  15. // vsh clean
  16. defineCleanCommand(vsh);
  17. // vsh code-workspace
  18. defineCodeWorkspaceCommand(vsh);
  19. // vsh check-circular
  20. defineCheckCircularCommand(vsh);
  21. // vsh check-dep
  22. defineDepcheckCommand(vsh);
  23. // Invalid command
  24. vsh.on('command:*', () => {
  25. consola.error(colors.red('Invalid command!'));
  26. process.exit(1);
  27. });
  28. vsh.usage('vsh');
  29. vsh.help();
  30. vsh.parse();
  31. } catch (error) {
  32. consola.error(error);
  33. process.exit(1);
  34. }