forked from bitjson/typescript-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
28 lines (27 loc) · 914 Bytes
/
cli.ts
File metadata and controls
28 lines (27 loc) · 914 Bytes
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
// tslint:disable:no-expression-statement no-console
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';
console.log('JUST EXECUTED THE PACKAGE!!!!!');
(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);
});