aboutsummaryrefslogtreecommitdiffstats
path: root/development/run-version-bump.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-07 08:15:45 +0800
committerDan <danjm.com@gmail.com>2018-03-07 08:15:45 +0800
commit9d215bab0fe124f036d2ac41f375331c8d43b72b (patch)
tree6bbbdb2e6a2dcd5948ee8473cad152232c73643b /development/run-version-bump.js
parentf06bca1151b07d908cd90f6efd97064e288e5f27 (diff)
parent9762a730413129361062804aa8dfc7be7cf74868 (diff)
downloadtangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.gz
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.bz2
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.lz
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.xz
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.zst
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.zip
Merge branch 'master' into i18n
Diffstat (limited to 'development/run-version-bump.js')
-rw-r--r--development/run-version-bump.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/development/run-version-bump.js b/development/run-version-bump.js
new file mode 100644
index 000000000..e06c00db3
--- /dev/null
+++ b/development/run-version-bump.js
@@ -0,0 +1,44 @@
+const { promisify } = require('util')
+const fs = require('fs')
+const readFile = promisify(fs.readFile)
+const writeFile = promisify(fs.writeFile)
+const path = require('path')
+const changelogPath = path.join(__dirname, '..', 'CHANGELOG.md')
+const manifestPath = path.join(__dirname, '..', 'app', 'manifest.json')
+const manifest = require('../app/manifest.json')
+const versionBump = require('./version-bump')
+
+const bumpType = normalizeType(process.argv[2])
+
+
+readFile(changelogPath)
+.then(async (changeBuffer) => {
+ const changelog = changeBuffer.toString()
+
+ const newData = await versionBump(bumpType, changelog, manifest)
+
+ const manifestString = JSON.stringify(newData.manifest, null, 2)
+
+ await writeFile(changelogPath, newData.changelog)
+ await writeFile(manifestPath, manifestString)
+
+ return newData.version
+})
+.then((version) => console.log(`Bumped ${bumpType} to version ${version}`))
+.catch(console.error)
+
+
+function normalizeType (userInput) {
+ const err = new Error('First option must be a type (major, minor, or patch)')
+ if (!userInput || typeof userInput !== 'string') {
+ throw err
+ }
+
+ const lower = userInput.toLowerCase()
+
+ if (lower !== 'major' && lower !== 'minor' && lower !== 'patch') {
+ throw err
+ }
+
+ return lower
+}