Skip to content

Commit

Permalink
feat: add debug mode for resolveConfig
Browse files Browse the repository at this point in the history
relates #60
  • Loading branch information
antongolub committed Oct 30, 2019
1 parent 0821daf commit aef853e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@
"publish": [
"@semantic-release/npm",
"@semantic-release/github",
"@qiwi/semantic-release-gh-pages-plugin"
{
"path": "@qiwi/semantic-release-gh-pages-plugin",
"docs": "docs v{{=it.nextRelease.gitTag}}"
}
]
}
}
10 changes: 10 additions & 0 deletions src/main/ts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ export const resolveConfig = (pluginConfig: TAnyMap, context: TContext, path = P
const token = getToken(env)
const repo = getRepo(pluginConfig, context, enterprise)

if (process.env.DEBUG) {
const { logger } = context

logger.log('resolveConfig args:')
logger.log('context=', omit(context, 'env.GH_TOKEN', 'env.GITHUB_TOKEN'))
logger.log('pluginConfig=', pluginConfig)
logger.log('path=', path)
logger.log('step=', step)
}

return {
src: opts.src || DEFAULT_SRC,
dst: opts.dst || DEFAULT_DST,
Expand Down
5 changes: 3 additions & 2 deletions src/test/ts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ describe('config', () => {
foo: 'bar',
baz: 'qux',
msg: 'doc update',
branch: 'master' // NOTE must be omitted
branch: 'master', // NOTE must be omitted,
repositoryUrl: 'https://enterprise.com/org/repo.git'
}
const extra = {
enterprise: true,
Expand Down Expand Up @@ -128,7 +129,7 @@ describe('config', () => {
branch: DEFAULT_BRANCH,
msg: 'doc update',
token,
repo: `https://${token}@github.com/${repoName}.git`
repo: `https://${token}@enterprise.com/org/repo.git`
})
})

Expand Down

0 comments on commit aef853e

Please sign in to comment.