Fixed bug when end of file in package.json has changed when version bumped
parent
c3a1c6e042
commit
8a32db0dc1
|
@ -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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue