diff options
Diffstat (limited to 'cmd/web/Makefile')
-rw-r--r-- | cmd/web/Makefile | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/cmd/web/Makefile b/cmd/web/Makefile new file mode 100644 index 0000000..1d98085 --- /dev/null +++ b/cmd/web/Makefile | |||
@@ -0,0 +1,52 @@ | |||
1 | SHELL=/bin/bash | ||
2 | ENV ?= dev | ||
3 | export PATH := $(PATH):./node_modules/.bin | ||
4 | |||
5 | SRC_DIR=js | ||
6 | BUILD_DIR=build/js | ||
7 | JSX_SRC= main.jsx signup.jsx signin.jsx otp.jsx poloniex.jsx | ||
8 | JS_SRC= cookies.js app.js api.js | ||
9 | JSX_OBJS=$(addprefix $(BUILD_DIR)/,$(JSX_SRC:.jsx=.js)) | ||
10 | JS_OBJS=$(addprefix $(BUILD_DIR)/,$(JS_SRC)) | ||
11 | STATIC_BUILD_DIR=build/static | ||
12 | |||
13 | install: | ||
14 | node --version | ||
15 | npm --version | ||
16 | yarn --version | ||
17 | yarn install | ||
18 | |||
19 | static: js $(STATIC_BUILD_DIR)/index.html $(STATIC_BUILD_DIR)/style.css | ||
20 | |||
21 | js: build/static/main.js | ||
22 | |||
23 | $(STATIC_BUILD_DIR)/index.html: static/index.html | ||
24 | cp static/index.html $@ | ||
25 | |||
26 | $(STATIC_BUILD_DIR)/style.css: static/style.css | ||
27 | cp static/style.css $@ | ||
28 | |||
29 | $(BUILD_DIR)/%.js: $(SRC_DIR)/%.jsx | ||
30 | mkdir -p $(@D) | ||
31 | jscs --fix $< | ||
32 | babel $< -o $@ | ||
33 | jshint $@ | ||
34 | |||
35 | $(BUILD_DIR)/%.js: $(SRC_DIR)/%.js | ||
36 | jscs --fix $< | ||
37 | cp $< $@ | ||
38 | jshint $@ | ||
39 | |||
40 | build/static/main.js: $(JSX_OBJS) $(JS_OBJS) env/$(ENV).env | ||
41 | browserify -t [ localenvify --envfile env/$(ENV).env ] \ | ||
42 | -t [ debowerify ] \ | ||
43 | $(BUILD_DIR)/main.js -o $@ | ||
44 | |||
45 | build/webapp.tar.gz: $(STATIC_BUILD_DIR)/main.js $(STATIC_BUILD_DIR)/index.html $(STATIC_BUILD_DIR)/style.css | ||
46 | tar czf $@ --directory=$(dir $<) $(notdir $^) | ||
47 | |||
48 | release: build/webapp.tar.gz | ||
49 | |||
50 | clean: | ||
51 | rm -rf build | ||
52 | rm -rf node_modules \ No newline at end of file | ||