From 8a32db0dc15703038395c1a365dbcdc2a3cc4367 Mon Sep 17 00:00:00 2001 From: skhomuti Date: Thu, 2 Mar 2023 12:19:04 +0500 Subject: [PATCH] Fixed bug when end of file in package.json has changed when version bumped --- src/version/json.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/version/json.js b/src/version/json.js index 5321148..71e72a1 100644 --- a/src/version/json.js +++ b/src/version/json.js @@ -18,6 +18,7 @@ module.exports = class Json extends BaseVersioning { // Parse the file let jsonContent + let eol = fileContent.endsWith('\n') ? '\n' : '' try { jsonContent = JSON.parse(fileContent) } catch (error) { @@ -45,7 +46,7 @@ module.exports = class Json extends BaseVersioning { // Update the file this.update( - JSON.stringify(jsonContent, null, 2), + JSON.stringify(jsonContent, null, 2) + eol ) }