Skip to content

Commit

Permalink
Add script to bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners committed Feb 9, 2023
1 parent 0504a4f commit 41467da
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
40 changes: 40 additions & 0 deletions inc-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

set -e

PATH=./node_modules/.bin:${PATH}
CURRENT_VERSION=$(jq -r .version package.json)

case ${1} in
Major | MAJOR | major)
LEVEL=major
;;

Minor | MINOR | minor)
LEVEL=minor
;;

Patch | PATCH | patch)
LEVEL=patch
;;

*)
LEVEL=patch
;;
esac

NEW_VERSION=$(semver -i ${LEVEL} ${CURRENT_VERSION})
echo "${CURRENT_VERSION} => ${NEW_VERSION}"
read -n 1 -s -r -p "Press any key to continue (ctrl+c to abort)..."
echo ""

echo "Patching package.json..."
cat package.json | \
jq --arg vers "${NEW_VERSION}" '.version = $vers' | \
tee package.json 1>/dev/null

echo "Patching lib/meta.js ..."
SED_SCRIPT=$(printf 's/%s/%s/' ${CURRENT_VERSION//\./\\.} ${NEW_VERSION//\./\\.})
sed -e ${SED_SCRIPT} -i -f ./lib/meta.js

echo "Done."
3 changes: 3 additions & 0 deletions lib/meta.js-f
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict'

module.exports = { version: '8.10.0' }

0 comments on commit 41467da

Please sign in to comment.