Skip to content

Commit 7cc7081

Browse files
committed
add publish script
1 parent 96e1fba commit 7cc7081

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"cover": "istanbul cover _mocha --report lcovonly",
2323
"coveralls": "cat ./coverage/lcov.info | coveralls",
2424
"codacy": "cat ./coverage/lcov.info | codacy-coverage -v",
25-
"codecov": "codecov"
25+
"codecov": "codecov",
26+
"publishPackage": "sh publish.sh && git push && git push --tags && npm publish"
2627
},
2728
"repository": {
2829
"type": "git",

publish.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
#!/bin/bash
3+
set -e
4+
5+
# release defaults to patch (last number in semver)
6+
RELEASE="patch" && [ -n "$1" ] && RELEASE=$1
7+
8+
# cut the release
9+
VERSION=$(npm --no-git-tag-version version $RELEASE | sed 's/v//')
10+
11+
git add package.json
12+
git commit -m "release: cut the $VERSION release"
13+
14+
# tag the release
15+
git tag $VERSION
16+
git tag -l
17+
18+
echo -e "\033[1;92m You are ready to publish!"
19+
echo -e "\033[1;95m git push"
20+
echo -e "\033[1;95m git push --tags"
21+
echo -e "\033[1;95m npm publish"

0 commit comments

Comments
 (0)