-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli.ts
38 lines (35 loc) · 943 Bytes
/
cli.ts
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
#!/usr/bin/env node
import { cac, CAC } from 'cac';
import { main } from './src';
import utils from './src/utils';
import { cwd, exit } from 'node:process';
import { version } from './package.json';
import { emptyDir } from 'fs-extra';
const cli: CAC = cac('discord_deploy');
cli
.command('deploy')
.option('--debug, -d', 'run in debug mode.', {
default: false,
})
.option('cwd <dir>', 'Absolute directory to search for.', {
default: cwd(),
})
.option('--test', 'Enables test mode.', {
default: false,
})
.action(main);
cli.command('clear', 'clear esbuild cache.').action(async () => {
try {
const isEmpty = await emptyDir('build');
// @ts-ignore
if (isEmpty.length) utils._log('Cleaned successfully.', 'log');
else utils._log('Already Cleaned.');
exit(0);
} catch (error: any) {
utils._log(error.message, 'error');
exit(1);
}
});
cli.help();
cli.version(version);
cli.parse();