Add a "version.sh" shell script to bump the version of the app and distribute it throughout the repo.

This commit is contained in:
mmcwilliams 2019-03-22 20:27:55 -04:00
parent 74e6b9c1b2
commit 79e16fb166
3 changed files with 20 additions and 3 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.3.2", "version": "1.3.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.3.2", "version": "1.3.4",
"description": "Small gauge film optical printer platform", "description": "Small gauge film optical printer platform",
"main": "build.js", "main": "build.js",
"directories": { "directories": {
@ -9,7 +9,9 @@
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "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": { "repository": {
"type": "git", "type": "git",

15
scripts/version.sh Normal file
View File

@ -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