Fixed bug when end of file in package.json has changed when version bumped

releases/v3
skhomuti 2023-03-02 12:19:04 +05:00
parent c3a1c6e042
commit 8a32db0dc1
1 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@ module.exports = class Json extends BaseVersioning {
// Parse the file // Parse the file
let jsonContent let jsonContent
let eol = fileContent.endsWith('\n') ? '\n' : ''
try { try {
jsonContent = JSON.parse(fileContent) jsonContent = JSON.parse(fileContent)
} catch (error) { } catch (error) {
@ -45,7 +46,7 @@ module.exports = class Json extends BaseVersioning {
// Update the file // Update the file
this.update( this.update(
JSON.stringify(jsonContent, null, 2), JSON.stringify(jsonContent, null, 2) + eol
) )
} }