This repository has been archived by the owner on May 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
make.js
65 lines (57 loc) · 1.48 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
#!/usr/bin/env node
require('shelljs/make');
var path = require('path');
var jshint = makeCmd('./node_modules/.bin/jshint');
var karma = makeCmd('./node_modules/karma/bin/karma');
function makeCmd (unixPath) {
var path = platformPath(unixPath);
return function () {
exec([path].concat([].slice.call(arguments, 0)).join(' '));
};
}
// Replace / with \ on windows
function platformPath(p) {
return p.split('/').join(path.sep);
}
function setupPhantomPath() {
if (!env['PHANTOMJS_BIN']) {
try {
var path = require('phantomjs2').path;
if (path) {
env['PHANTOMJS_BIN'] = path;
}
if (!path) {
path = require('phantomjs').path;
if (path) {
env['PHANTOMJS_BIN'] = path;
}
}
} catch(e){}
}
}
target.lint = function () {
jshint(
'--reporter node_modules/jshint-stylish/stylish.js',
'lib',
'test',
'--exclude test/lib'
);
};
target.test = function () {
target.lint();
setupPhantomPath();
karma('start', '--single-run');
};
target.ci = function () {
target.lint();
setupPhantomPath();
['ie', 'ienew', 'chrome', 'android', 'ios', 'firefox'].forEach(function(browserType){
env['BROWSER_TYPE'] = browserType;
karma('start', '--single-run');
});
};
target.watch = function () {
target.lint();
setupPhantomPath();
karma('start');
};