Skip to content

Instantly share code, notes, and snippets.

@aslakhellesoy
Created December 22, 2011 13:22
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslakhellesoy/1510295 to your computer and use it in GitHub Desktop.
Save aslakhellesoy/1510295 to your computer and use it in GitHub Desktop.
Publish NPM packages with Make
NAME := $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).name)")
VERSION := $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).version)")
TARBALL := $(NAME)-$(VERSION).tgz
npm-publish:
@rm -Rf package
@mkdir package
@cp -R lib package/lib
@cp package.json package
@tar czf $(TARBALL) package
@scp $(TARBALL) npm@npm:/home/npm/repo
clean:
rm -Rf *.tgz
.PHONY: npm-publish clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment