Skip to content

Commit

Permalink
fix: append line feed to end of package.json (conventional-changelog#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
nexdrew authored and bcoe committed May 31, 2016
1 parent d37aedb commit 178e001
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ conventionalRecommendedBump({
newVersion = semver.inc(pkg.version, release.releaseAs)
checkpoint('bumping version in package.json from %s to %s', [pkg.version, newVersion])
pkg.version = newVersion
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), 'utf-8')
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf-8')
} else {
console.log(chalk.red(figures.cross) + ' skip version bump on first release')
}
Expand Down
9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,13 @@ describe('cli', function () {
// check annotated tag message
shell.exec('git tag -l -n1 v1.1.0').stdout.should.match(/chore\(release\): 1\.1\.0/)
})

it('appends line feed at end of package.json', function () {
writePackageJson('1.0.0')

shell.exec(cliPath).code.should.equal(0)

var pkgJson = fs.readFileSync('package.json', 'utf-8')
pkgJson.should.equal(['{', ' "version": "1.0.1"', '}', ''].join('\n'))
})
})

0 comments on commit 178e001

Please sign in to comment.