From 06bb905c8dfe0e125a56df76e038a21869fec155 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Sun, 17 Sep 2023 14:13:52 +0300 Subject: [PATCH] Code cleanup Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- index.js | 16 ---------------- package-lock.json | 28 +++++++++++++++++++++++++++- package.json | 3 ++- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index 7f19dca..7369418 100644 --- a/index.js +++ b/index.js @@ -24,22 +24,6 @@ try { // join the parts back together const newVersion = `v${versionParts.join('.')}`; - // Parse XML to JS Obj - xml2js.parseString(data, function (err, result) { - if (err) { - return console.log(err); - } - // Convert JS obj to JSON - const json = JSON.stringify(result, null, 2); - - // Write JSON to file - fs.writeFile('./project.json', json, 'utf8', function (err) { - if (err) { - return console.log(err); - } - console.log('Created project.json from project.csproj'); - }); - }); console.log(`Old version: ${version}. New version: ${newVersion}`) diff --git a/package-lock.json b/package-lock.json index 80735e9..7836c28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,8 @@ "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", - "@actions/io": "^1.1.3" + "@actions/io": "^1.1.3", + "xml2js": "^0.6.2" }, "devDependencies": { "@types/node": "^20.6.2" @@ -202,6 +203,11 @@ "wrappy": "1" } }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -246,6 +252,26 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/xml2js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", + "integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "engines": { + "node": ">=4.0" + } } } } diff --git a/package.json b/package.json index c8e34fe..3ff8d4c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", - "@actions/io": "^1.1.3" + "@actions/io": "^1.1.3", + "xml2js": "^0.6.2" }, "devDependencies": { "@types/node": "^20.6.2"