Skip to content

Commit 178e001

Browse files
nexdrewbcoe
authored andcommitted
fix: append line feed to end of package.json (#42)
1 parent d37aedb commit 178e001

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ conventionalRecommendedBump({
6161
newVersion = semver.inc(pkg.version, release.releaseAs)
6262
checkpoint('bumping version in package.json from %s to %s', [pkg.version, newVersion])
6363
pkg.version = newVersion
64-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), 'utf-8')
64+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf-8')
6565
} else {
6666
console.log(chalk.red(figures.cross) + ' skip version bump on first release')
6767
}

test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,13 @@ describe('cli', function () {
155155
// check annotated tag message
156156
shell.exec('git tag -l -n1 v1.1.0').stdout.should.match(/chore\(release\): 1\.1\.0/)
157157
})
158+
159+
it('appends line feed at end of package.json', function () {
160+
writePackageJson('1.0.0')
161+
162+
shell.exec(cliPath).code.should.equal(0)
163+
164+
var pkgJson = fs.readFileSync('package.json', 'utf-8')
165+
pkgJson.should.equal(['{', ' "version": "1.0.1"', '}', ''].join('\n'))
166+
})
158167
})

0 commit comments

Comments
 (0)