Skip to content

Commit

Permalink
fix(help): default scripts weren't showing the script
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Jul 26, 2016
1 parent c176024 commit 1ba52fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/bin-utils/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ test('help: formats a nice message', t => {
},
},
build: {
default: 'webpack',
x: {
default: {
script: 'webpack --env.x',
description: 'webpack with x env',
},
y: {
description: 'build X-Y',
script: 'echo "build x-y"',
Expand All @@ -137,6 +142,8 @@ ${colors.green('foo')} - ${colors.white('the foo script')} - ${colors.gray('echo
${colors.green('bar')} - ${colors.white('stuff')} - ${colors.gray('echo "bar default"')}
${colors.green('bar.baz')} - ${colors.gray('echo "baz"')}
${colors.green('bar.barBub')} - ${colors.gray('echo "barBub"')}
${colors.green('build')} - ${colors.gray('webpack')}
${colors.green('build.x')} - ${colors.white('webpack with x env')} - ${colors.gray('webpack --env.x')}
${colors.green('build.x.y')} - ${colors.white('build X-Y')} - ${colors.gray('echo "build x-y"')}
${colors.green('foobar')} - ${colors.gray('echo "foobar"')}
`.trim()
Expand Down
4 changes: 1 addition & 3 deletions src/resolve-script-object-to-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ function resolveScriptObjectToString(script) {
const scriptObj = resolveScriptObjectToScript(script)
if (isPlainObject(scriptObj)) {
return scriptObj.script
} else if (isString(scriptObj)) {
return scriptObj
}
return undefined
}
Expand All @@ -17,7 +15,7 @@ function resolveScriptObjectToScript(script) {
if (!isUndefined(script.script)) {
return script
} else if (!isUndefined(script.default)) {
return script.default
return resolveScriptObjectToScript(script.default)
}
} else if (isString(script)) {
return {script}
Expand Down

0 comments on commit 1ba52fc

Please sign in to comment.