SBT Json
This is an plugin to read from an JSON-File in your SBT Tasks. If you are using Conventional Changelog you have to insert your version number in an package.json file. It is not comfortable to update your version at many points in your project. So this plugin supports you read the Version Number or other Settings from a JSON-File in your Build Process.
Usage
Add to your project/plugins.sbt
addSbtPlugin("dev.quadstingray" % "sbt-json" % pluginVersion)
Use the JsonHandler
Add to you build.sbt
file.
jsonFiles += (baseDirectory.value / "package.json")
version := jsonHandler.value.stringValue("package.json", "version")
To add another Json-File to the Handler
jsonFiles += (baseDirectory.value / "second.json")
organization := jsonHandler.value.stringValue("second.json", "organization")
Direct JsonFile
As alternative you can import and use JsonFile from your Code.
import dev.quadstingray.sbt.json.JsonFile
val json = JsonFile(file("package.json"))
organization := json.stringValue("organization")