| 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 -b -6) master) |
| 10 |
GITHUB_PROJ := https://github.com//markdown-it/${NPM_PACKAGE} |
| 11 |
|
| 12 |
|
| 13 |
lint: |
| 14 |
./node_modules/.bin/eslint --reset . |
| 15 |
|
| 16 |
test: lint |
| 17 |
./node_modules/.bin/mocha -R spec |
| 18 |
|
| 19 |
coverage: |
| 20 |
rm -rf coverage |
| 21 |
./node_modules/.bin/istanbul cover node_modules/.bin/_mocha |
| 22 |
|
| 23 |
test-ci: lint |
| 24 |
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage |
| 25 |
|
| 26 |
browserify: |
| 27 |
rm -rf ./dist |
| 28 |
mkdir dist |
| 29 |
# Browserify |
| 30 |
( printf "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" ; \ |
| 31 |
./node_modules/.bin/browserify ./ -s markdownitForInline \ |
| 32 |
) > dist/markdown-it-for-inline.js |
| 33 |
# Minify |
| 34 |
./node_modules/.bin/uglifyjs dist/markdown-it-for-inline.js -b beautify=false,ascii-only=true -c -m \ |
| 35 |
--preamble "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" \ |
| 36 |
> dist/markdown-it-for-inline.min.js |
| 37 |
|
| 38 |
.PHONY: lint test coverage |
| 39 |
.SILENT: lint test |