Skip to content

Commit 003e932

Browse files
committed
fix: handle missing plugins propery in config
1 parent b19ea37 commit 003e932

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

customize.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ const defaultConfig = {
2121
plugins: [],
2222
badges: {
2323
/**
24-
* Should there be a greenkeeper badge?
25-
* `undefined` means autodetect (by parsing the badge for the repo-url)
24+
* Should there be a greenkeeper badge? Default: false
2625
* @property
2726
*/
28-
greenkeeper: undefined
27+
greenkeeper: false
2928
}
3029
}
3130

@@ -44,6 +43,7 @@ module.exports = function createSpec (workingDir) {
4443
debug('config loaded', config)
4544
return customize
4645
.registerEngine('handlebars', require('customize-engine-handlebars'))
46+
.merge({ handlebars: { data: { config: defaultConfig } } })
4747
.merge({
4848
handlebars: {
4949
partials: path.join(__dirname, 'handlebars', 'partials'),
@@ -63,9 +63,13 @@ module.exports = function createSpec (workingDir) {
6363
// Apply any customization from the config-files (such as loading modules)
6464
.load(function (customize) {
6565
debug('Loading modules', config)
66-
return config.plugins.reduce((prev, plugin) => {
67-
return prev.load(plugin)
68-
}, customize)
66+
if (config && config.plugins) {
67+
return config.plugins.reduce((prev, plugin) => {
68+
return prev.load(plugin)
69+
}, customize)
70+
} else {
71+
return customize
72+
}
6973
})
7074
.merge({
7175
handlebars: {

0 commit comments

Comments
 (0)