-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
83 lines (74 loc) · 1.69 KB
/
index.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env node
const chalk = require('chalk');
const clear = require('clear');
const figlet = require('figlet');
const files = require('./lib/files');
const build = require('./lib/build');
const serve = require('./lib/serve');
if(process.argv.length>2){
switch(process.argv[2]){
case 'init':
banner();
init();
break;
case 'build':
banner();
build.build();
break;
case 'serve':
banner();
build.build();
var port = 3000
if(process.argv.length>3)
port = process.argv[3]
serve.serve(port);
break;
case '-v':
case '--version':
var pjson = require('./package.json');
console.log(pjson.version);
break;
default:
banner();
help();
}
}else{
banner();
help();
}
function help(){
console.log(
chalk.blue(
'htBuild Help \n'
)
);
console.log(
chalk.white(
'init - Creates htBuild Project\n'+
'build - Compile source\n'+
'serve - Autobuild and serve on :8080\n'+
'help - Shows htBuild help\n'+
'-v/--version - Current htBuild Version'
)
);
}
function init(){
console.log(
chalk.blue(
'Creating Directories...\n'
)
);
files.createDirectories();
build.build();
serve.serve(8080);
}
function banner(){
clear();
console.log(
chalk.greenBright(
figlet.textSync('htBuild',{
horizontalLayout: 'full'
})
)
);
}