File size: 888 Bytes
dc649b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { colors, consola } from '@vben/node-utils';

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);
}