forked from remix-run/react-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·57 lines (40 loc) · 1.27 KB
/
release.sh
File metadata and controls
executable file
·57 lines (40 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash -e
export RELEASE=1
if ! [ -e scripts/release.sh ]; then
echo >&2 "Please run scripts/release.sh from the repo root"
exit 1
fi
update_version() {
echo "$(node -p "p=require('./${1}');p.version='${2}';JSON.stringify(p,null,2)")" > $1
echo "Updated ${1} version to ${2}"
}
validate_semver() {
if ! [[ $1 =~ ^[0-9]\.[0-9]+\.[0-9](-.+)? ]]; then
echo >&2 "Version $1 is not valid! It must be a valid semver string like 1.0.2 or 2.3.0-beta.1"
exit 1
fi
}
current_version=$(node -p "require('./package').version")
printf "Next version (current is $current_version)? "
read next_version
validate_semver $next_version
next_ref="v$next_version"
npm test
update_version 'package.json' $next_version
git commit -am "Version $next_version"
# push first to make sure we're up-to-date
git push origin 1.0.x
git tag $next_ref
git tag latest -f
git push origin $next_ref
git push origin latest -f
node scripts/build.js
# This is a workaround for a nasty npm bug. :'(
# First, we need to uninstall the history package so
# it's not included in the react-router npm package.
# https://github.com/rackt/react-router/issues/2195
# https://github.com/npm/npm/issues/9894
rm -rf node_modules/history
npm publish
# And then re-install it after we publish.
npm install history