aboutsummaryrefslogtreecommitdiffstats
path: root/development/version-bump.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-03-03 05:55:56 +0800
committerDan Finlay <dan@danfinlay.com>2018-03-03 05:55:56 +0800
commitbf17d7e1153180fe68cc568a6f4ffa8db66010dc (patch)
treed82dbcb2c5588f5f18ca779f42037a60c25b1e4a /development/version-bump.js
parent452c5d0513a14419b71ffd92d253fef661b74300 (diff)
downloadtangerine-wallet-browser-bf17d7e1153180fe68cc568a6f4ffa8db66010dc.tar
tangerine-wallet-browser-bf17d7e1153180fe68cc568a6f4ffa8db66010dc.tar.gz
tangerine-wallet-browser-bf17d7e1153180fe68cc568a6f4ffa8db66010dc.tar.bz2
tangerine-wallet-browser-bf17d7e1153180fe68cc568a6f4ffa8db66010dc.tar.lz
tangerine-wallet-browser-bf17d7e1153180fe68cc568a6f4ffa8db66010dc.tar.xz
tangerine-wallet-browser-bf17d7e1153180fe68cc568a6f4ffa8db66010dc.tar.zst
tangerine-wallet-browser-bf17d7e1153180fe68cc568a6f4ffa8db66010dc.zip
Add version bumping script
One step towards automating our deploy process is automating our version bumping scheme. This PR does that.
Diffstat (limited to 'development/version-bump.js')
-rw-r--r--development/version-bump.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/development/version-bump.js b/development/version-bump.js
new file mode 100644
index 000000000..63dd802d1
--- /dev/null
+++ b/development/version-bump.js
@@ -0,0 +1,53 @@
+const clone = require('clone')
+
+async function versionBump(bumpType, changelog, oldManifest) {
+ const manifest = clone(oldManifest)
+ const newVersion = newVersionFrom(manifest, bumpType)
+
+ manifest.version = newVersion
+ const date = (new Date()).toDateString()
+
+ const logHeader = `\n## ${newVersion} ${date}`
+ const logLines = changelog.split('\n')
+ for (let i = 0; i < logLines.length; i++) {
+ if (logLines[i].includes('Current Master')) {
+ logLines.splice(i + 1, 0, logHeader)
+ break
+ }
+ }
+
+ return {
+ version: newVersion,
+ manifest: manifest,
+ changelog: logLines.join('\n')
+ }
+}
+
+function newVersionFrom (manifest, bumpType) {
+ const string = manifest.version
+ let segments = string.split('.').map((str) => parseInt(str))
+
+ console.log('bump type is ' + bumpType)
+ switch (bumpType) {
+ case 'major':
+ segments[0] += 1
+ segments[1] = 0
+ segments[2] = 0
+ break
+ case 'minor':
+ segments[1] += 1
+ segments[2] = 0
+ break
+ case 'patch':
+ segments[2] += 1
+ break
+ }
+
+ return segments.map(String).join('.')
+}
+
+function bumpManifest (manifest, bumpType) {
+
+}
+
+module.exports = versionBump