forked from deployd/deployd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.js
80 lines (65 loc) · 1.82 KB
/
make.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
require('shelljs/make');
var path = require('path')
, less = require('less');
target.all = function() {
target.dashboard();
target.jshint();
};
target.dashboard = function() {
cd(__dirname);
var lessSource = cat('lib/resources/dashboard/stylesheets/style.less');
if (lessSource) {
var parser = new(less.Parser)({
paths: ['lib/resources/dashboard/stylesheets'], // Specify search paths for @import directives
filename: 'style.less' // Specify a filename, for better error messages
});
parser.parse(lessSource, function (e, tree) {
if (e) return console.error(e.message);
try {
tree.toCSS().to('lib/resources/dashboard/stylesheets/style.css');
} catch (ex) {
console.error(path.basename(ex.filename) + ":" + ex.line + " - " + ex.message);
ex.extract.forEach(function(line) {
console.error(" " + line);
});
}
});
}
};
target.jshint = function() {
target.jshintLib();
target.jshintTest();
target.jshintDpdJs();
target.jshintCli();
target.jshintDashboard();
target.jshintCollectionDashboard();
};
function hint(pathName, fileName) {
var lastPath = process.cwd();
cd(pathName);
echo("Linting " + pathName + (fileName ? ("/" + fileName) : "") + "...");
exec('jshint ' + (fileName || '.') + " --extra-ext " + fileName);
echo();
cd(lastPath);
}
target.jshintLib = function() {
hint('lib');
};
target.jshintTest = function() {
hint('test');
hint('test-app');
};
target.jshintDpdJs = function() {
hint('clib', 'dpd.js');
};
target.jshintCli = function() {
cp('bin/dpd', 'bin/dpd.js');
hint('bin', 'dpd.js');
rm('bin/dpd.js');
};
target.jshintDashboard = function() {
hint('lib/resources/dashboard/js');
};
target.jshintCollectionDashboard = function() {
hint('lib/resources/collection/dashboard/js');
};