-
Notifications
You must be signed in to change notification settings - Fork 247
/
cli.ts
27 lines (25 loc) · 816 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
import chalk from 'chalk';
import { checkArgs } from './args';
import { inquire } from './inquire';
import { addInferredOptions, LiveTasks } from './tasks';
import { typescriptStarter } from './typescript-starter';
import { getIntro, hasCLIOptions, TypescriptStarterUserOptions } from './utils';
(async () => {
const argInfo = await checkArgs();
const userOptions: TypescriptStarterUserOptions = hasCLIOptions(argInfo)
? argInfo
: {
...(await (async () => {
console.log(getIntro(process.stdout.columns));
return inquire();
})()),
...argInfo,
};
const options = await addInferredOptions(userOptions);
return typescriptStarter(options, LiveTasks);
})().catch((err: Error) => {
console.error(`
${chalk.red(err.message)}
`);
process.exit(1);
});