forked from kogosoftwarellc/open-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish
executable file
·54 lines (43 loc) · 885 Bytes
/
publish
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
#!/bin/bash
set -e
export PATH="$PWD/bin/dev-tools:$PWD/node_modules/.bin:$PATH"
function publish() {
pushd "$1" > /dev/null
cp ../../.npmignore .
rm -rf node_modules
npm i
npm version "$2"
npm pu
git add .
git commit -m "$3 `node -e "process.stdout.write(require('./package.json').version);"`"
popd > /dev/null
}
if [[ -n "$1" ]]; then
package="`basename $1`"
else
ls -1 packages
echo ''
read -p 'Which package would you like to publish? ' package
fi
package_dir="packages/$package"
if [[ ! -d "$package_dir" ]]; then
echo "$package_dir was not a directory" >&2
exit 1
fi
if [[ -n "$2" ]]; then
bump="$2"
else
echo '
major
minor
patch
'
read -p 'Which version bump to use? ' bump
fi
case "$bump" in
major|minor|patch);;
*)
echo "Unknown version bump $bump" >&2
exit 1;;
esac
publish "$package_dir" "$bump" "$package"