-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
executable file
·153 lines (140 loc) · 3.65 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env node
'use strict';
var generators = require('./src/generators');
var release = require('./src/release');
var server = require('./src/server');
var pkg = require('./package.json');
var olo = require('commander')
.version(pkg.version);
/**
* generator-olo嵌入
*/
olo
.command('init')
.option('-c, --clean', 'clean olo cached template')
.description('create a new front-end project')
.action(function (options) {
// console.log(options.clean)
!options.clean? generators('app'): generators('app','clean');
// generators('app');
});
olo
.command('v <name>')
.alias('view')
.description('create a new view page')
.action(function (name) {
generators('view', name);
});
olo
.command('c <name>')
.alias('cmp')
.description('create a new component')
.action(function (name) {
generators('c', 'create', name);
});
olo
.command('i [cmp]')
.alias('install')
.description('install component(s) from git.biketo.com.cn/')
.action(function (cmp) {
generators('c', 'i', cmp);
});
olo
.command('f <name>')
.alias('frame')
.description('install frame(s) from olo')
.action(function (name) {
generators('frame', name);
});
/**
* fis3 嵌入(包括node服务嵌入)
*/
olo
.command('w')
.alias('watch')
.description('build and watch your project with fis3')
.option('--child-flag', 'hack fis3-release-watch --child-flag')
.action(function () {
// server.clean();
release({
// c: true,
w: true,
L: true
});
});
olo
.command('r [media]')
.alias('release')
.description('build your project with fis3')
.option('-d, --dest <path>', 'release output destination')
.option('-l, --lint', 'with lint')
.option('-w, --watch', 'monitor the changes of project')
.option('-L, --live', 'automatically reload your browser')
.option('-c, --clean', 'clean compile cache')
.option('-u, --unique', 'use unique compile caching')
.option('-r, --root <path>', 'specify project root')
.option('-f, --file <filename>', 'specify the file path of `fis-conf.js`')
.option('--child-flag', 'hack fis3-release-watch --child-flag')
.action(function (media, options) {
var argv = {};
if (options.dest) {
argv.d = options.dest;
}
if (options.lint) {
argv.l = options.lint;
}
if (options.watch) {
argv.w = options.watch;
}
if (options.live) {
argv.L = options.live;
}
if (options.clean) {
argv.c = options.clean;
}
if (options.unique) {
argv.u = options.unique;
}
if (options.root) {
argv.r = options.root;
}
if (options.file) {
argv.f = options.file;
}
release(argv, media);
});
olo
.command('s')
.alias('start')
.option('--live', 'release output destination')
.description('start server')
.action(function () {
// server.stop();
// server.clean();
release({
c: true
});
server.start();
});
olo
.command('open')
.description('open server folder')
.action(function () {
server.open();
});
olo
.command('clean')
.description('clean server folder')
.action(function () {
server.clean();
});
olo
.command('stop')
.description('stop server folder')
.action(function () {
server.stop();
});
olo.parse(process.argv);
if (!process.argv.slice(2).length) {
olo.outputHelp();
}