-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
107 lines (73 loc) · 2.44 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
PAGES = $(patsubst %.jsx, %.js, $(wildcard client/pages/*.jsx))
COMPONENTS = $(patsubst %.jsx, %.js, $(wildcard client/components/*.jsx))
COMPILED = $(PAGES) $(COMPONENTS)
LESS = $(wildcard less/*.less)
build: components index.js main.css $(COMPILED)
component build --dev -n build -s main -o web
test-build: components index.js main.css $(COMPILED)
@component build --dev -n build -o test/client/
# Resources
client/pages/%.js: client/pages/%.jsx
@jsx $< > $@
client/components/%.js: client/components/%.jsx
@jsx $< > $@
main.css: ${LESS}
lessc less/index.less main.css
# Other stuff
components: component.json
@component install --dev
clean:
rm -fr build components template.js
# Testing
test: lint test-only
lint:
jshint *.js lib client test/client/fixtures
test-only:
mocha -R spec
gh-pages: build
cp -r web w
git co gh-pages
rm -rf bootstrap font-awesome
mv w/* ./
rmdir w
TEST_FIXTURES = $(patsubst test/client/fixtures/%.js, %, $(wildcard test/client/fixtures/*.js))
TEST_DIRS = $(patsubst %, test/client/%, $(TEST_FIXTURES))
TEST_HTMLS = $(patsubst %, test/client/%/index.html, $(TEST_FIXTURES))
# TEST_DATA = $(patsubst %, test/client/build/%/data.js, $(TEST_FIXTURES))
examples: test-htmls test-build
node tsetup.js
test-htmls: $(TEST_HTMLS)
# test/client/%/data.js: test/client/fixtures/%.js
# @browserify $< -o $@
test/client/%/index.html:
@rm -f $@
@ln -s ../index-base.html $@;
# Remote Libs
remote-libs: web/jquery-2.0.3.js web/react-0.9.0.js web/bootstrap-3.1.0 web/font-awesome-4.0.3 web/moment.js
web/bootstrap-3.1.0:
@cd web &&\
wget https://github.com/twbs/bootstrap/releases/download/v3.1.0/bootstrap-3.1.0-dist.zip &&\
unzip bootstrap-3.1.0-dist.zip &&\
mv dist bootstrap-3.1.0 &&\
rm bootstrap-3.1.0-dist.zip
web/font-awesome-4.0.3:
@cd web &&\
wget http://fontawesome.io/assets/font-awesome-4.0.3.zip &&\
unzip font-awesome-4.0.3.zip &&\
rm font-awesome-4.0.3.zip
web/moment.js:
@cd web && wget http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.5.1/moment.js
web/jquery-2.0.3.js:
@cd web && wget http://code.jquery.com/jquery-2.0.3.js
web/react-0.9.0.js:
@cd web && wget http://fb.me/react-0.9.0.js
# Heroku stuff
postinstall: get-tools use-cdn build
use-cdn:
mv web/index-cdn.html web/index.html
get-tools:
@npm install -g [email protected] less jshint react-tools
#
serve:
@node index.js
.PHONY: clean serve postinstall get-tools remote-libs test lint test-only build example-build