forked from wix-incubator/wix-gruntfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
feature-detector.js
34 lines (31 loc) · 920 Bytes
/
feature-detector.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
'use strict';
var glob = require('glob');
function isFeaturePresent(pattern) {
return glob.sync(process.cwd() + pattern).length !== 0;
}
module.exports = {
isTypescriptEnabled: function () {
return isFeaturePresent('/{app/scripts,app/modules,test}/**/*.ts');
},
isTslintEnabled: function () {
return isFeaturePresent('/tslint.json');
},
isTraceurEnabled: function () {
return isFeaturePresent('/{app/scripts,app/modules,test}/**/*.es6');
},
isHamlEnabled: function () {
return isFeaturePresent('/app/{views,modules}/**/*.haml');
},
isScssStyleEnabled: function () {
return isFeaturePresent('/.scss-lint.yml');
},
isJshintEnabled: function () {
return isFeaturePresent('/.jshintrc');
},
isTestInAppFolderEnabled: function () {
return isFeaturePresent('/app/test/**/*.{js,ts}');
},
isJscsEnabled: function () {
return isFeaturePresent('/.jscsrc');
}
};