1
|
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
2
|
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
3
|
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
4
|
|
5
|
# BIN directory
|
6
|
BIN := $(THIS_DIR)/node_modules/.bin
|
7
|
|
8
|
# Path
|
9
|
PATH := node_modules/.bin:$(PATH)
|
10
|
SHELL := /bin/bash
|
11
|
|
12
|
# applications
|
13
|
NODE ?= $(shell which node)
|
14
|
YARN ?= $(shell which yarn)
|
15
|
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
16
|
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
17
|
|
18
|
.FORCE:
|
19
|
|
20
|
install: node_modules
|
21
|
|
22
|
node_modules: package.json
|
23
|
@NODE_ENV= $(PKG) install
|
24
|
@touch node_modules
|
25
|
|
26
|
lint: .FORCE
|
27
|
eslint browser.js debug.js index.js node.js
|
28
|
|
29
|
test-node: .FORCE
|
30
|
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
31
|
|
32
|
test-browser: .FORCE
|
33
|
mkdir -p dist
|
34
|
|
35
|
@$(BROWSERIFY) \
|
36
|
--standalone debug \
|
37
|
. > dist/debug.js
|
38
|
|
39
|
karma start --single-run
|
40
|
rimraf dist
|
41
|
|
42
|
test: .FORCE
|
43
|
concurrently \
|
44
|
"make test-node" \
|
45
|
"make test-browser"
|
46
|
|
47
|
coveralls:
|
48
|
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
49
|
|
50
|
.PHONY: all install clean distclean
|