UNPKG

685 Bapplication/x-shView Raw
1#!/bin/bash -e
2
3changelog=node_modules/.bin/changelog
4
5update_version() {
6 echo "$(node -p "p=require('./${1}');p.version='${2}';JSON.stringify(p,null,2)")" > $1
7 echo "Updated ${1} version to ${2}"
8}
9
10current_version=$(node -p "require('./package').version")
11
12printf "Next version (current is $current_version)? "
13read next_version
14
15if ! [[ $next_version =~ ^[0-9]\.[0-9]+\.[0-9](-.+)? ]]; then
16 echo "Version must be a valid semver string, e.g. 1.0.2 or 2.3.0-beta.1"
17 exit 1
18fi
19
20next_ref="v$next_version"
21
22git add -u
23
24npm run build
25npm test
26
27update_version 'package.json' $next_version
28
29git commit -am "release $next_version"
30git tag $next_version
31
32git push --tags
33
34npm publish