Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 55 lines (37 sloc) 1.08 KB
#!/bin/sh
# Dangerously fast way to publish a patch to NPM
set -e # Stop if anything fails
# Make sure we're in sync with master
git pull --rebase
# Begin with a clean NPM slate to get as
# close to build server as possible
rm -rf node_modules
npm cache clean
if [ "$1" == "--minor" ]; then
BUMP_COMMAND="bump:minor"
elif [ "$1" == "--major" ]; then
BUMP_COMMAND="bump:major"
else
BUMP_COMMAND="bump:patch"
fi
# Authenticate with NPM
echo "Enter your npmjs.org credentials."
npm adduser
npm install
# Run grunt-bump and use some grep and cut voodoo to extract the version
# generated by grunt-bump
VERSION=`./node_modules/grunt-cli/bin/grunt $BUMP_COMMAND | grep -no 'to .*$' | cut -c 6-`;
# grunt-bump will have updated package.json with the
# new version.
git add package.json
# Build it!
grunt build
# Add the built files.
git add lib/*.js
# Commit it!
git commit -m "Bumped version number to "$VERSION"."
# Create a tag for this version
git tag -a v$VERSION --message 'Version '$VERSION --force
# Push the commit + the new tag, to Github
git push origin master --tags
npm publish