1 |
|
2 |
|
3 | changelog=node_modules/.bin/changelog
|
4 |
|
5 | update_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 |
|
10 | current_version=$(node -p "require('./package').version")
|
11 |
|
12 | printf "Next version (current is $current_version)? "
|
13 | read next_version
|
14 |
|
15 | if ! [[ $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
|
18 | fi
|
19 |
|
20 | next_ref="v$next_version"
|
21 |
|
22 | git add -u
|
23 |
|
24 | npm run build
|
25 | npm test
|
26 |
|
27 | update_version 'package.json' $next_version
|
28 |
|
29 | git commit -am "release $next_version"
|
30 | git tag $next_version
|
31 |
|
32 | git push --tags
|
33 |
|
34 | npm publish
|