aboutsummaryrefslogblamecommitdiff
path: root/cmd/web/Makefile
blob: c0ec4cd4ac17e9d6e66516871a9d645a29393e51 (plain) (tree)
1
2
3
4
5
6
7
8
9







                                                            
                                                                                                     









                                                       
                                                                                 


                        

                               
 


                             

                                   

                       

                                  
                 
                

                                                           



                                                                                                     
 
                                                                                            

                                                     
                                                


                    
                           
SHELL=/bin/bash
ENV ?= dev
export PATH := $(PATH):./node_modules/.bin

SRC_DIR=js
BUILD_DIR=build/js
JSX_SRC= main.jsx signup.jsx signin.jsx otp.jsx poloniex.jsx
JS_SRC= cookies.js app.js api.js
STATIC_FILES= index.html style.css cryptocoins.css cryptocoins.ttf cryptocoins.woff cryptocoins.woff2
JSX_OBJS=$(addprefix $(BUILD_DIR)/,$(JSX_SRC:.jsx=.js))
JS_OBJS=$(addprefix $(BUILD_DIR)/,$(JS_SRC))
STATIC_BUILD_DIR=build/static

install:
	node --version
	npm --version
	yarn --version
	yarn install

static: $(STATIC_BUILD_DIR) js $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES))

js: build/static/main.js

$(STATIC_BUILD_DIR)/%: static/%
	cp $< $@

$(STATIC_BUILD_DIR):
	mkdir -p $(BUILD_DIR)
	mkdir -p $@

$(BUILD_DIR)/%.js: $(SRC_DIR)/%.jsx
	eslint --fix $<
	cp $< $@

$(BUILD_DIR)/%.js: $(SRC_DIR)/%.js
	eslint $<
	cp $< $@

build/static/main.js: $(JSX_OBJS) $(JS_OBJS) env/$(ENV).env
	browserify -t [ babelify --presets [ env react ] --plugins [ transform-class-properties ] ] \
			   -t [ localenvify --envfile env/$(ENV).env ] \
			   -t [ debowerify ]  \
			    $(BUILD_DIR)/main.js -o $@

build/webapp.tar.gz: $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES)) build/static/main.js
	tar czf $@ --directory=$(dir $<) $(notdir $^)

release: $(STATIC_BUILD_DIR) build/webapp.tar.gz

clean:
	rm -rf build
	rm -rf node_modules