aboutsummaryrefslogtreecommitdiffstats
path: root/development/run-version-bump.js
diff options
context:
space:
mode:
authorThomas <tmashuang@gmail.com>2018-03-10 07:01:48 +0800
committerThomas <tmashuang@gmail.com>2018-03-10 07:01:48 +0800
commitd5b1d6182ba73b28efd6862034038156c3e596c1 (patch)
tree8bebaedc1f9c95bb2d17b12be2fd16d50f75ad0f /development/run-version-bump.js
parent0db4ba1086f56422752dd4b9e3754a273d23a866 (diff)
parent634e5d8f55efc6c307a867556116a565eee21b58 (diff)
downloadtangerine-wallet-browser-d5b1d6182ba73b28efd6862034038156c3e596c1.tar
tangerine-wallet-browser-d5b1d6182ba73b28efd6862034038156c3e596c1.tar.gz
tangerine-wallet-browser-d5b1d6182ba73b28efd6862034038156c3e596c1.tar.bz2
tangerine-wallet-browser-d5b1d6182ba73b28efd6862034038156c3e596c1.tar.lz
tangerine-wallet-browser-d5b1d6182ba73b28efd6862034038156c3e596c1.tar.xz
tangerine-wallet-browser-d5b1d6182ba73b28efd6862034038156c3e596c1.tar.zst
tangerine-wallet-browser-d5b1d6182ba73b28efd6862034038156c3e596c1.zip
Merge branch 'master' into selenium-e2e
Diffstat (limited to 'development/run-version-bump.js')
-rw-r--r--development/run-version-bump.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/development/run-version-bump.js b/development/run-version-bump.js
new file mode 100644
index 000000000..fde14566e
--- /dev/null
+++ b/development/run-version-bump.js
@@ -0,0 +1,43 @@
+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])
+
+start().catch(console.error)
+
+async function start() {
+
+ const changeBuffer = await readFile(changelogPath)
+ 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)
+
+ console.log(`Bumped ${bumpType} to version ${newData.version}`)
+}
+
+
+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
+}