forked from wix-incubator/wix-gruntfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeature-detector.js
40 lines (37 loc) · 1.08 KB
/
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
35
36
37
38
39
40
'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');
},
isTSConfigEnabled: function () {
return isFeaturePresent('/app/tsconfig.json');
},
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');
},
isVelocityEnabled: function () {
return isFeaturePresent('/velocity.data.js');
}
};