diff --git a/index.js b/index.js index 8ab7c5a34..b098bdcbb 100755 --- a/index.js +++ b/index.js @@ -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') } diff --git a/test.js b/test.js index e89f45df1..5c97cbf1d 100644 --- a/test.js +++ b/test.js @@ -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')) + }) })