Skip to content

Commit

Permalink
fix: handle missing plugins propery in config
Browse files Browse the repository at this point in the history
  • Loading branch information
nknapp committed Feb 19, 2019
1 parent b19ea37 commit 003e932
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions customize.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ const defaultConfig = {
plugins: [],
badges: {
/**
* Should there be a greenkeeper badge?
* `undefined` means autodetect (by parsing the badge for the repo-url)
* Should there be a greenkeeper badge? Default: false
* @property
*/
greenkeeper: undefined
greenkeeper: false
}
}

Expand All @@ -44,6 +43,7 @@ module.exports = function createSpec (workingDir) {
debug('config loaded', config)
return customize
.registerEngine('handlebars', require('customize-engine-handlebars'))
.merge({ handlebars: { data: { config: defaultConfig } } })
.merge({
handlebars: {
partials: path.join(__dirname, 'handlebars', 'partials'),
Expand All @@ -63,9 +63,13 @@ module.exports = function createSpec (workingDir) {
// Apply any customization from the config-files (such as loading modules)
.load(function (customize) {
debug('Loading modules', config)
return config.plugins.reduce((prev, plugin) => {
return prev.load(plugin)
}, customize)
if (config && config.plugins) {
return config.plugins.reduce((prev, plugin) => {
return prev.load(plugin)
}, customize)
} else {
return customize
}
})
.merge({
handlebars: {
Expand Down

0 comments on commit 003e932

Please sign in to comment.