From 1abeaa8ada8b3758e46ceb649b8d68fd32c3ace9 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Wed, 1 Jun 2022 17:38:46 +0200 Subject: [PATCH] strip v from tag --- manifest-util.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/manifest-util.js b/manifest-util.js index 2595c03ca..59cd8d8a0 100644 --- a/manifest-util.js +++ b/manifest-util.js @@ -7,28 +7,29 @@ const fs = require('fs') // node manifest-util.js ./public/manifest.json const main = () => { - const manifestPath = process.argv[2]; - const releaseTag = process.env.RELEASE_TAG; + const manifestPath = process.argv[2] + const releaseTag = process.env.RELEASE_TAG if (!manifestPath) { - return console.log('Please provide a path to the Manifest file.') + return console.log('Please provide a path to the manifest file.') } if (!releaseTag) { return console.log('Please provide a RELEASE_TAG env variable.') } - updateManifest(manifestPath, releaseTag); + updateManifest(manifestPath, releaseTag) } const updateManifest = (manifestFilename, releaseTag) => { + const version = releaseTag.replace('v', '') + try { - const data = fs.readFileSync(manifestFilename); - const manifest = JSON.parse(data); - manifest["version"] = releaseTag; + const data = fs.readFileSync(manifestFilename) + const manifest = JSON.parse(data) + manifest['version'] = version fs.writeFileSync(manifestFilename, JSON.stringify(manifest)) - } catch (error) { - console.log(error); + console.log(error) } } -main(); \ No newline at end of file +main()