forked from svbergerem/markdown-it-sanitizer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
43 lines (31 loc) · 1.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
PATH := ./node_modules/.bin:${PATH}
NPM_PACKAGE := $(shell node -e 'process.stdout.write(require("./package.json").name)')
NPM_VERSION := $(shell node -e 'process.stdout.write(require("./package.json").version)')
TMP_PATH := /tmp/${NPM_PACKAGE}-$(shell date +%s)
REMOTE_NAME ?= origin
REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut -b -6) master)
GITHUB_PROJ := https://github.com/svbergerem/${NPM_PACKAGE}
lint:
eslint .
test: lint
mocha -R spec --inline-diffs
coverage:
rm -rf coverage
istanbul cover node_modules/.bin/_mocha
test-ci: lint
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
browserify:
rm -rf ./dist
mkdir dist
# Browserify
( printf "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" ; \
browserify ./ -s markdownitSanitizer \
) > dist/markdown-it-sanitizer.js
# Minify
uglifyjs dist/markdown-it-sanitizer.js -b beautify=false,ascii-only=true -c -m \
--preamble "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" \
> dist/markdown-it-sanitizer.min.js
release: coverage browserify
.PHONY: lint test coverage
.SILENT: lint test