File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ PATH=./node_modules/.bin:${PATH}
6+ CURRENT_VERSION=$( jq -r .version package.json)
7+
8+ case ${1} in
9+ Major | MAJOR | major)
10+ LEVEL=major
11+ ;;
12+
13+ Minor | MINOR | minor)
14+ LEVEL=minor
15+ ;;
16+
17+ Patch | PATCH | patch)
18+ LEVEL=patch
19+ ;;
20+
21+ * )
22+ LEVEL=patch
23+ ;;
24+ esac
25+
26+ NEW_VERSION=$( semver -i ${LEVEL} ${CURRENT_VERSION} )
27+ echo " ${CURRENT_VERSION} => ${NEW_VERSION} "
28+ read -n 1 -s -r -p " Press any key to continue (ctrl+c to abort)..."
29+ echo " "
30+
31+ echo " Patching package.json..."
32+ cat package.json | \
33+ jq --arg vers " ${NEW_VERSION} " ' .version = $vers' | \
34+ tee package.json 1> /dev/null
35+
36+ echo " Patching lib/meta.js ..."
37+ SED_SCRIPT=$( printf ' s/%s/%s/' ${CURRENT_VERSION// \. / \\ .} ${NEW_VERSION// \. / \\ .} )
38+ cat ./lib/meta.js | \
39+ sed -e ${SED_SCRIPT} | \
40+ tee ./lib/meta.js 1> /dev/null
41+
42+ echo " Done."
You can’t perform that action at this time.
0 commit comments