Skip to content

Commit

Permalink
strip v from tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jfschwarz committed Jun 1, 2022
1 parent ce543f1 commit 1abeaa8
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions manifest-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
main()

0 comments on commit 1abeaa8

Please sign in to comment.