From 79e16fb1664bb13187182693cf6a28a86394e2cb Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Fri, 22 Mar 2019 20:27:55 -0400 Subject: [PATCH] Add a "version.sh" shell script to bump the version of the app and distribute it throughout the repo. --- package-lock.json | 2 +- package.json | 6 ++++-- scripts/version.sh | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 scripts/version.sh diff --git a/package-lock.json b/package-lock.json index 2453283..06dfa27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mcopy", - "version": "1.3.2", + "version": "1.3.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0023c69..496b241 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcopy", - "version": "1.3.2", + "version": "1.3.4", "description": "Small gauge film optical printer platform", "main": "build.js", "directories": { @@ -9,7 +9,9 @@ }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "sh ./scripts/build.sh" + "build": "sh ./scripts/build.sh", + "patch": "sh ./scripts/version.sh patch", + "minor": "sh ./scripts/version.sh minor" }, "repository": { "type": "git", diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100644 index 0000000..222e46f --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +npm version --no-git-tag-version ${1} + +#version all sub projects and config files +version=$(jq -r '.version' ./package.json) +echo "VERSION: $version" + +declare -a fileArr=("./data/cfg.json" "./app/package.json" "./cli/package.json") + +for i in "${fileArr[@]}" +do + tmp=$(mktemp) + VERSION="$version" jq '.version = env.VERSION' "$i" > "$tmp" && mv "$tmp" "$i" +done \ No newline at end of file