Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
BIN = ./node_modules/.bin
SRC = $(wildcard src/*.coffee)
LIB = $(SRC:src/
build: $(LIB)
lib/%.js: src/
@mkdir -p $(@D)
@$(BIN)/coffee -bcp $< > $@
test: build
@$(BIN)/mocha -b specs
@rm -f $(LIB)
install link:
@npm $@
define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync('./package.json', s);" && \
git commit -m "release $$NEXT_VERSION" -- package.json && \
git tag "$$NEXT_VERSION" -m "release $$NEXT_VERSION"
release-patch: build test
@$(call release,patch)
release-minor: build test
@$(call release,minor)
release-major: build test
@$(call release,major)
git push --tags origin HEAD:master
npm publish

This comment has been minimized.

Copy link

ilsken commented Apr 17, 2015

I know this is two years old but I just wanted to point out that you can bump the version number easily with npm version which also automatically creates a git tag if your package has a git repo. So you can get rid of the release macro and do this instead

release-patch: build test
  npm version patch

release-minor: build test
  npm version minor

release-major: build test
  npm version major
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.