-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
61 lines (52 loc) · 1.21 KB
/
index.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import Args from './Args';
import Inquire from './Inquire';
import Init from './Tasks/Init';
import Info from './Modules/Info';
import Print from './Modules/Print';
import listTemplates from './Tasks/List';
import { UpdateNotifier } from 'update-notifier';
(async (): Promise<void> => {
const input: string[] = Args.input;
const flags = Args.flags;
Info({
title: 'Hyper',
tagLine: 'by @Shorky',
description: 'A Cli to bootstrap new projects',
version: '3.0',
clear: flags.keep ? false : true
});
const pkg = {
name: '@sharksv/hyper',
version: '3.0.0'
};
new UpdateNotifier({
pkg,
updateCheckInterval: 0
}).notify({ isGlobal: true });
// Cmds
input.includes('help') && Args.showHelp(0);
input.includes('list') && listTemplates();
if (input.includes('init')) {
const defaultSelection = {
confirm: 'yes',
aName: 'Someone',
projTemplate: 'Node',
pkgManager: 'Npm',
gitInit: true,
fstCommit: true
};
const userSelection =
flags.skip === true
? defaultSelection
: {
...(await (async () => {
return Inquire();
})())
};
Init(userSelection);
}
// Handle errors
})().catch((err: Error) => {
Print('Error', err.message);
process.exit(1);
});