Skip to content

Commit

Permalink
only log if manifest has keys
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidWells committed May 15, 2019
1 parent 29ed42b commit 0c6c60f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/commands/addons/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ class AddonsConfigCommand extends Command {

// TODO update getAddonManifest to https://open-api.netlify.com/#/default/showServiceManifest
const manifest = await getAddonManifest(addonName, accessToken)
const hasConfig = manifest.config && Object.keys(manifest.config).length
// Parse flags
const rawFlags = parseRawFlags(raw)
// Get Existing Config
const currentConfig = currentAddon.config || {}

const words = `Current "${addonName} add-on" Settings:`
console.log(` ${chalk.yellowBright.bold(words)}`)
if (manifest.config) {
if (hasConfig) {
render.configValues(addonName, manifest.config, currentConfig)
} else {
// For addons without manifest. TODO remove once we enfore manifests
Expand All @@ -57,7 +58,7 @@ class AddonsConfigCommand extends Command {
})
}

if (manifest.config) {
if (hasConfig) {
const required = requiredConfigValues(manifest.config)
const missingValues = missingConfigValues(required, rawFlags)

Expand Down
3 changes: 2 additions & 1 deletion src/commands/addons/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ class AddonsCreateCommand extends Command {
}

const manifest = await getAddonManifest(addonName, accessToken)
const hasConfig = manifest.config && Object.keys(manifest.config).length

let configValues = rawFlags
if (manifest.config && Object.keys(manifest.config).length) {
if (hasConfig) {
const required = requiredConfigValues(manifest.config)
const missingValues = missingConfigValues(required, rawFlags)
console.log(`Starting the setup for "${addonName} add-on"`)
Expand Down

0 comments on commit 0c6c60f

Please sign in to comment.