wrote bump-version tool for #23

This commit is contained in:
2021-07-23 17:53:19 -06:00
parent 16ed9923c5
commit 6080f5ba76
3 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
{
"main": "bump_version.Main",
"name": "bump-version",
"description": "bump the version attribute of a json file",
"classPath": "src/",
"dependencies": {
"kiss": ""
},
"url": "https://github.com/NQNStudios/kisslang",
"contributors": [
"NQNStudios"
],
"version": "0.0.0",
"releasenote": "",
"tags": [],
"license": "LGPL"
}

View File

@@ -0,0 +1,9 @@
package bump_version;
import kiss.Kiss;
import kiss.Prelude;
import haxe.Json;
import sys.io.File;
@:build(kiss.Kiss.build())
class Main {}

View File

@@ -0,0 +1,16 @@
(defun :Void main []
(let [[jsonFile workingDir]
(Sys.args)
json
(Json.parse
(File.getContent (joinPath workingDir jsonFile)))
oldVersion
json.version
:kiss.List<Int> versionParts
(.map (oldVersion.split ".") Std.parseInt)]
(+= (nth versionParts -1) 1)
(let [newVersion
(versionParts.join ".")]
(print "Bumping version of $jsonFile from $oldVersion -> $newVersion")
(set json.version newVersion)
(File.saveContent (joinPath workingDir jsonFile) (Json.stringify json "\t")))))