From 337fc055f9125b817401e6147274ca2db461a124 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 19 Sep 2023 11:04:40 +0300 Subject: [PATCH] Fix errors Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- index.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 86c6ebc..198aff2 100644 --- a/index.js +++ b/index.js @@ -171,20 +171,23 @@ function getProjectInfoFile(filePath) { return require(`${process.cwd()}/${filePath}`); } -function getProjectVersion(file) { +function getProjectVersion(filePath) { + const projectInfoFile = require(filePath); // Update the version if the file is .csproj - if (file.match(/\.csproj/)) - return file.Project.PropertyGroup[0].Version; - else if (file.match(/package\.json/)) - return file.version; + if (filePath.match(/\.csproj/)) + return projectInfoFile.Project.PropertyGroup[0].Version; + else if (filePath.match(/package\.json/)) + return projectInfoFile.version; } -function updateProjectVersion(file, newVersion) { +function updateProjectVersion(filePath, newVersion) { + + const projectInfoFile = require(filePath); // Update the version if the file is .csproj - if (file.match(/\.csproj/)) - file.Project.PropertyGroup[0].Version = newVersion; - else if (file.match(/package\.json/)) - file.version = newVersion; + if (filePath.match(/\.csproj/)) + projectInfoFile.Project.PropertyGroup[0].Version = newVersion; + else if (filePath.match(/package\.json/)) + projectInfoFile.version = newVersion; }