-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
hbs-helpers.js
45 lines (35 loc) · 1.11 KB
/
hbs-helpers.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
const {devDependencies, dependencies} = require('./template/package');
const {version} = require('./package');
module.exports = {
or: (a, b, opts) => {
if (a || b) {
return opts.fn(this)
}else{
return opts.inverse(this)
}
},
and: (a, b, opts) => {
if (a && b) {
return opts.fn(this)
}else{
return opts.inverse(this)
}
},
templateVersion: () => {
return version;
},
dependency: (name, comma = true) => {
const version = ((dependencies || {})[name]) || ((devDependencies || {})[name]);
return `"${name}": "${version}"` + (comma ? ',' : '');
},
if_eq: (arg1, arg2, opts) => {
const TEST_SUITE = process.env.TEST_SUITE;
if(TEST_SUITE){
const cssFramewoks = ['vuetify', 'buefy', 'element'];
const loaders = ['less', 'sass', 'stylus'];
if(cssFramewoks.includes(arg2)) return TEST_SUITE === 'css_frameworks' ? opts.fn(this) : opts.inverse(this);
if(loaders.includes(arg2)) return TEST_SUITE === 'loaders' ? opts.fn(this) : opts.inverse(this);
}
return (arg1 === arg2) ? opts.fn(this) : opts.inverse(this);
}
}