Skip to content

Commit

Permalink
Fixing issue with releasing to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabriskie committed Jul 12, 2015
1 parent 88fedb0 commit b6313bd
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tasks/release
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,29 @@ if [ "$1" == "--preview" ] || [ "$1" == "-P" ] || [ "$1" == "-p" ]; then
# Preview release
$RACKT_PATH/node_modules/rf-release/node_modules/.bin/changelog -t preview -s
else
# build task has to be run prior to release module
# the release module is what prompts for next version number
# version is needed in order to update the package.json generated by build task
# we are left prompting for version, and updating build/package.json ourselves
# the version gathered here can then be provided to the release module

update_version() {
echo "$(node -p "p=require('./${1}');p.version='${2}';JSON.stringify(p,null,2)")" > $1
echo "Updated ${1} version to ${2}"
}

current_version=$(node -p "require('./package').version")

printf "Next version (current is $current_version)? "
read next_version

if ! [[ $next_version =~ ^[0-9]\.[0-9]+\.[0-9](-.+)? ]]; then
echo "Version must be a valid semver string, e.g. 1.0.2 or 2.3.0-beta.1"
exit 1
fi

# Release to npm
$RACKT_PATH/tasks/build
$RACKT_PATH/node_modules/.bin/release -f ./build
update_version 'build/package.json' $next_version
$RACKT_PATH/node_modules/.bin/release -v $next_version -f ./build
fi

0 comments on commit b6313bd

Please sign in to comment.