Debian Codegraph @

mdurl/Makefile

raw
1 NPM_PACKAGE := $(shell node -e 'process.stdout.write(require("./package.json").name)')
2 NPM_VERSION := $(shell node -e 'process.stdout.write(require("./package.json").version)')
3
4 TMP_PATH := /tmp/${NPM_PACKAGE}-$(shell date +%s)
5
6 REMOTE_NAME ?= origin
7 REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
8
9 CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut --bytes=-6) master)
10 GITHUB_PROJ := https://github.com/nodeca/${NPM_PACKAGE}
11
12
13 lint:
14 ./node_modules/.bin/eslint --reset .
15
16
17 test: lint
18 ./node_modules/.bin/mocha
19
20
21 coverage:
22 rm -rf coverage
23 ./node_modules/.bin/istanbul cover node_modules/.bin/_mocha
24
25
26 test-ci: lint
27 ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
28
29
30 publish:
31 @if test 0 -ne `git status --porcelain | wc -l` ; then \
32 echo "Unclean working tree. Commit or stash changes first." >&2 ; \
33 exit 128 ; \
34 fi
35 @if test 0 -ne `git tag -l ${NPM_VERSION} | wc -l` ; then \
36 echo "Tag ${NPM_VERSION} exists. Update package.json" >&2 ; \
37 exit 128 ; \
38 fi
39 git tag ${NPM_VERSION} && git push origin ${NPM_VERSION}
40 npm publish ${GITHUB_PROJ}/tarball/${NPM_VERSION}
41
42
43 .PHONY: publish lint test coverage
44 .SILENT: help lint test todo