forked from ianstormtaylor/slate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (60 loc) · 1.56 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
69
70
71
72
73
74
75
76
# Binaries.
bin = ./node_modules/.bin
babel = $(bin)/babel
browserify = $(bin)/browserify
exorcist = $(bin)/exorcist
eslint = $(bin)/eslint
http-server = $(bin)/http-server
gh-pages = $(bin)/gh-pages
mocha = $(bin)/mocha
node = node
watchify = $(bin)/watchify
# Options.
babel_flags =
browserify_flags = --debug --transform babelify
eslint_flags = --ignore-pattern "build.js"
mocha_flags = --compilers js:babel-core/register --require source-map-support/register --reporter spec
# Flags.
DEBUG ?=
GREP ?=
# Config.
ifeq ($(DEBUG),true)
mocha += debug
node += debug
endif
# Run all of the checks.
check: lint test
# Remove the generated files.
clean:
@ rm -rf ./dist ./node_modules
# Build the source.
dist: $(shell find ./lib) package.json
@ $(babel) $(babel_flags) --out-dir ./dist ./lib
@ $(browserify) ./dist/index.js --standalone Slate --outfile ./dist/slate.js
# Build the examples.
examples:
@ $(browserify) $(browserify_flags) ./examples/index.js --outfile ./examples/build.js
# Deploy the latest examples to GitHub pages.
gh-pages:
@ $(gh-pages) --dist ./examples
# Install the dependencies.
install:
@ npm install
# Lint the source files.
lint:
@ $(eslint) $(eslint_flags) "lib/**/*.js" "examples/**/*.js"
# Start the server.
start:
@ $(http-server) ./examples
# Run the tests.
test:
@ $(mocha) $(mocha_flags) --fgrep "$(GREP)" ./test/server.js
# Watch the source.
watch-dist:
@ $(MAKE) dist babel_flags="$(babel_flags) --watch"
# Watch the examples.
watch-examples:
@ $(MAKE) examples browserify=$(watchify)
# Phony targets.
.PHONY: examples
.PHONY: test