]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/blob - cmd/web/Makefile
Upgrade ReactJS. EC6 import modules.
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git] / cmd / web / Makefile
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 STATIC_FILES= index.html style.css cryptocoins.css cryptocoins.ttf cryptocoins.woff cryptocoins.woff2
10 JSX_OBJS=$(addprefix $(BUILD_DIR)/,$(JSX_SRC:.jsx=.js))
11 JS_OBJS=$(addprefix $(BUILD_DIR)/,$(JS_SRC))
12 STATIC_BUILD_DIR=build/static
13
14 install:
15 node --version
16 npm --version
17 yarn --version
18 yarn install
19
20 static: $(STATIC_BUILD_DIR) js $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES))
21
22 js: build/static/main.js
23
24 $(STATIC_BUILD_DIR)/%: static/%
25 cp $< $@
26
27 $(STATIC_BUILD_DIR):
28 mkdir -p $(BUILD_DIR)
29 mkdir -p $@
30
31 $(BUILD_DIR)/%.js: $(SRC_DIR)/%.jsx
32 eslint --fix $<
33 cp $< $@
34
35 $(BUILD_DIR)/%.js: $(SRC_DIR)/%.js
36 eslint $<
37 cp $< $@
38
39 build/static/main.js: $(JSX_OBJS) $(JS_OBJS) env/$(ENV).env
40 browserify -t [ babelify --presets [ env react ] --plugins [ transform-class-properties ] ] \
41 -t [ localenvify --envfile env/$(ENV).env ] \
42 -t [ debowerify ] \
43 $(BUILD_DIR)/main.js -o $@
44
45 build/webapp.tar.gz: $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES)) build/static/main.js
46 tar czf $@ --directory=$(dir $<) $(notdir $^)
47
48 release: $(STATIC_BUILD_DIR) build/webapp.tar.gz
49
50 clean:
51 rm -rf build
52 rm -rf node_modules