-
Notifications
You must be signed in to change notification settings - Fork 11
/
volofile
59 lines (51 loc) · 1.72 KB
/
volofile
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
/*jslint node: true */
'use strict';
var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
var buildDir = 'www-built';
module.exports = {
build: {
flags: {
//Does not print the build output.
'q': 'quiet'
},
run: function (d, v, namedArgs) {
//Remove the old dir
v.rm('www-built');
d.resolve(v.spawn('node', ['tools/r.js', '-o', 'tools/build.js'], {
useConsole: !namedArgs.quiet
}));
}
},
serve: function(d, v, namedArgs) {
try {
var connect = require('connect');
}
catch(e) {
console.log('To use the `serve` command, you must ' +
'install the connect module:\n\n' +
'npm install connect');
return;
}
var lessMiddleware = require('less-middleware');
var port = 8008;
var base = path.join(process.cwd(), namedArgs.base || 'www');
var middleware = [
lessMiddleware({ src: base }),
connect.static(base),
connect.directory(base),
];
connect.logger.format("OpenWebApp",
"[D] server :method :url :status " +
":res[content-length] - :response-time ms");
middleware.unshift(connect.logger("OpenWebApp"));
console.log("starting web server on port " + port);
connect.apply(null, middleware).listen(port);
},
//Creates a local project command called appcache
appcache: require('volo-appcache')({
depends: ['build']
}),
ghdeploy: require('volo-ghdeploy')('www-built', 'www-ghdeploy')
};