-
Notifications
You must be signed in to change notification settings - Fork 112
/
Makefile
54 lines (40 loc) · 1.36 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
44
45
46
47
48
49
50
51
52
53
54
BIN = ./node_modules/.bin
TESTS = $(shell find ./src -path '**/__tests__/*-test.js')
SRC = $(shell find ./src -name '*.js' -not -path '*/__tests__/*')
LIB = $(SRC:./src/%.js=./lib/%.js)
NODE = $(BIN)/babel-node $(BABEL_OPTIONS)
MOCHA_OPTIONS = --require ./src/__tests__/setup.js
MOCHA = $(BIN)/_mocha $(MOCHA_OPTIONS)
NYC_OPTIONS = --all --require babel-core/register
NYC = $(BIN)/nyc $(NYC_OPTIONS)
VERSION = $(shell node -e 'console.log(require("./package.json").version)')
build:
@$(MAKE) -j8 $(LIB)
doctoc:
@$(BIN)/doctoc --title '**Table of Contents**' ./README.md
lint::
@$(BIN)/eslint $(SRC)
test::
@NODE_ENV=test $(BIN)/babel-node $(MOCHA) -- $(TESTS)
test-cov::
@NODE_ENV=test $(NYC) --check-coverage $(MOCHA) -- $(TESTS)
report-cov::
@$(BIN)/nyc report --reporter html
report-cov-coveralls::
@$(BIN)/nyc report --reporter=text-lcov | $(BIN)/coveralls
ci:
@NODE_ENV=test $(BIN)/babel-node $(MOCHA) --watch -- $(TESTS)
version-major version-minor version-patch: lint test build
@npm version $(@:version-%=%)
_publish-git:
git tag $(VERSION)
git push --tags origin HEAD:develop
_publish-beta-npm: build
npm publish --tag beta
publish: _publish-git _publish-beta-npm
clean:
@rm -rf lib/
./lib/%.js: ./src/%.js
@echo "Building $<"
@mkdir -p $(@D)
@$(BIN)/babel $(BABEL_OPTIONS) -o $@ $<