Easy deployment to Gemfury for NPM modules
Useful little script that I made, figured someone else might need it. Basically looks for the name and version attributes in package.json, and then it builds your package from there. I've added fury yank
since I often develop with just the same version of 0.0.1
all of the time.
Makefile
KEY ?= <YOUR KEY HERE>
NAME_CMD := cat package.json | grep -m 1 -o '"name":\s*"\([^"]\)*"' | sed 's/"name":[^"]*"\(.*\)"$$/\1/'
VERSION_CMD := cat package.json | grep -m 1 -o '"version":\s*"\([^"]\)*"' | sed 's/"version":[^"]*"\(.*\)"$$/\1/'
build clean : PACKAGE_NAME:=$(shell ${NAME_CMD})
build : PACKAGE_VERSION:=$(shell ${VERSION_CMD})
clean:
rm -rf ./node_modules
rm -rf ./${PACKAGE_NAME}*.tgz
pack: clean
npm pack
build: pack
fury yank ${PACKAGE_NAME} --version=${PACKAGE_VERSION}
curl -F package=@${PACKAGE_NAME}-${PACKAGE_VERSION}.tgz https://push.fury.io/${KEY}/
.PHONY: clean pack build
Simply type make build
to deploy.
Note: I removed a lot of '@' symbols that prepends a few of the commands (such as npm
, rm
, etc.) since Coderwall was globbing it up and turning it into a literal <a href="">
link. If you want to silence the output simply type in make -s build
Written by Daniel Durante
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Nodejs
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#