Skip to content

Commit

Permalink
feat(scripts): bump-version.js > auto bump chrome app manifest patch …
Browse files Browse the repository at this point in the history
…version, as I keep forgetting to do that for every release
  • Loading branch information
flawiddsouza committed Mar 10, 2024
1 parent 3fd60fc commit 4b45922
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/browser-extension/v3-app/src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Restfox",
"description": "Minimalistic HTTP Client for API Development and Testing",
"version": "1.0.605",
"version": "1.0.606",
"manifest_version": 3,
"icons": {
"512": "icons/favicon.png"
Expand Down
14 changes: 9 additions & 5 deletions scripts/bump-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ const { execSync } = require('child_process')
const pathToElectron = path.join(__dirname, '../packages/electron')
const pathToElectronPackageJSON = path.join(pathToElectron, 'package.json')
const pathToElectronPackageLockJSON = path.join(pathToElectron, 'package-lock.json')
// const pathToChromeAppManifest = path.join(__dirname, '../packages/browser-extension/v3-app/src/manifest.json')
const pathToChromeAppManifest = ''
const pathToChromeAppManifest = path.join(__dirname, '../packages/browser-extension/v3-app/src/manifest.json')
const pathToREADME = path.join(__dirname, '../README.md')

const packageJSON = JSON.parse(readFileSync(pathToElectronPackageJSON))
// const chromeAppManifest = JSON.parse(readFileSync(pathToChromeAppManifest))
const chromeAppManifest = JSON.parse(readFileSync(pathToChromeAppManifest))
const README = readFileSync(pathToREADME).toString()

const args = process.argv.slice(2)
Expand Down Expand Up @@ -51,10 +50,15 @@ if (args.includes('--major')) {
}

packageJSON.version = `${major}.${minor}.${patch}`
// chromeAppManifest.version = `${major}.${minor}.${patch+1}`

const chromeAppManifestVersion = chromeAppManifest.version.split('.')
const chromeAppManifestMajor = Number(chromeAppManifestVersion[0])
const chromeAppManifestMinor = Number(chromeAppManifestVersion[1])
const chromeAppManifestPatch = Number(chromeAppManifestVersion[2])
chromeAppManifest.version = `${chromeAppManifestMajor}.${chromeAppManifestMinor}.${chromeAppManifestPatch+1}`

writeFileSync(pathToElectronPackageJSON, JSON.stringify(packageJSON, null, 4) + '\n')
// writeFileSync(pathToChromeAppManifest, JSON.stringify(chromeAppManifest, null, 4) + '\n')
writeFileSync(pathToChromeAppManifest, JSON.stringify(chromeAppManifest, null, 4) + '\n')
writeFileSync(pathToREADME, README.replace(/\d+\.\d+\.\d+/g, packageJSON.version))

execSync('npm i', {
Expand Down

0 comments on commit 4b45922

Please sign in to comment.