Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Commit

Permalink
feat: return both currentVersion and nextVersion
Browse files Browse the repository at this point in the history
Signed-off-by: Charlike Mike Reagent <[email protected]>
  • Loading branch information
Charlike Mike Reagent committed Nov 14, 2017
1 parent 05a4000 commit d5677fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const newRelease = require('./index.js')

async function init () {
const cwd = process.cwd()
const nextVersion = newRelease(cwd)
const { currentVersion, nextVersion } = newRelease(cwd)

console.log('current version is', currentVersion)

await shell([
`yarn version --no-git-tag-version --new-version ${nextVersion}`,
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function getNextVersion (increment, cwd) {
const name = path.basename(cwd)
const pkgJson = await util.promisify(getPkg)(name)
const currentVersion = pkgJson.version
const nextVersion = semver.inc(currentVersion, increment)

return semver.inc(currentVersion, increment)
return { currentVersion, nextVersion }
}

0 comments on commit d5677fb

Please sign in to comment.