forked from andreypopp/validated
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (48 loc) · 1.38 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.DELETE_ON_ERROR:
BIN = ./node_modules/.bin
TESTS = $(shell find src -path '*/__tests__/*-test.js')
SRC = $(filter-out $(TESTS) $(FIXTURES), $(shell find src -name '*.js'))
LIB = $(SRC:src/%=lib/%)
MOCHA_OPTS = -R dot --require babel-core/register
build: build-lib build-typings
build-lib::
@$(MAKE) -j 8 $(LIB)
build-typings: $(SRC:src/%=lib/%.flow)
doctoc:
@$(BIN)/doctoc --title '**Table of Contents**' ./README.md
build-silent::
@$(MAKE) -s -j 8 $(LIB)
lint::
@$(BIN)/eslint src
check::
@$(BIN)/flow --show-all-errors src
test:: test-unit test-doc
test-unit::
@$(BIN)/mocha --bail $(MOCHA_OPTS) $(TESTS)
test-doc:: build-silent
@$(BIN)/mocha $(MOCHA_OPTS) --compilers md:mocha-doctest ./README.md
ci-doc::
@$(BIN)/mocha $(MOCHA_OPTS) --compilers md:mocha-doctest --watch ./README.md
ci-unit::
@$(BIN)/mocha $(MOCHA_OPTS) --watch --watch-extensions json,md $(TESTS)
sloc::
@$(BIN)/sloc -e __tests__ src
version-major version-minor version-patch:: lint check test
@npm version $(@:version-%=%)
publish:: build
@git push --tags origin HEAD:master
@npm publish
clean::
@rm -rf lib
lib/%.js: src/%.js
@echo "Building $@"
@mkdir -p $(@D)
@$(BIN)/babel $(BABEL_OPTIONS) -o $@ $<
lib/json5.js.flow: src/json5.js.flow
@echo "Building $@"
@mkdir -p $(@D)
@cp $< $@
lib/%.js.flow: src/%.js
@echo "Building $@"
@mkdir -p $(@D)
@cp $< $@