X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=cmd%2Fweb%2FMakefile;h=7315d5ec17a9ff28b3cf6e591db6d95e93625c44;hb=cf5bb85cede5b05b58ed2b40460d0b913e8b2cf6;hp=2ebb734d0397af420959fb6f064c72f5a42dd6dc;hpb=2f91f20a8645339385ada602684f4957f20f4da4;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/cmd/web/Makefile b/cmd/web/Makefile index 2ebb734..7315d5e 100644 --- a/cmd/web/Makefile +++ b/cmd/web/Makefile @@ -4,11 +4,14 @@ 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 +JSX_SRC= header_footer.jsx main.jsx signup.jsx signin.jsx otp.jsx poloniex.jsx password_reset.jsx change_password.jsx account.jsx balance.jsx JS_SRC= cookies.js app.js api.js -STATIC_FILES= index.html style.css cryptocoins.css cryptocoins.ttf cryptocoins.woff cryptocoins.woff2 +STATIC_FILES= index.html style.css fontello.css +STATIC_FILES+=$(addprefix fonts/, fontello.eot fontello.svg fontello.ttf fontello.woff fontello.woff2) JSX_OBJS=$(addprefix $(BUILD_DIR)/,$(JSX_SRC:.jsx=.js)) JS_OBJS=$(addprefix $(BUILD_DIR)/,$(JS_SRC)) +ICONS=$(addprefix $(STATIC_BUILD_DIR)/icons/black/, $(notdir $(wildcard static/icons/black/*.svg))) +ICONS+=$(addprefix $(STATIC_BUILD_DIR)/icons/color/, $(notdir $(wildcard static/icons/color/*.svg))) STATIC_BUILD_DIR=build/static install: @@ -17,7 +20,7 @@ install: yarn --version yarn install -static: $(STATIC_BUILD_DIR) js $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES)) +static: $(STATIC_BUILD_DIR) $(STATIC_BUILD_DIR)/fonts js $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES)) $(ICONS) js: build/static/main.js @@ -27,27 +30,69 @@ $(STATIC_BUILD_DIR)/%: static/% $(STATIC_BUILD_DIR): mkdir -p $(BUILD_DIR) mkdir -p $@ + mkdir -p $@/icons/black + mkdir -p $@/icons/color + +$(STATIC_BUILD_DIR)/fonts: + mkdir -p $@ $(BUILD_DIR)/%.js: $(SRC_DIR)/%.jsx - jscs --fix $< - babel $< -o $@ - jshint $@ + eslint --fix $< + cp $< $@ $(BUILD_DIR)/%.js: $(SRC_DIR)/%.js - jscs --fix $< + eslint $< + cp $< $@ + +$(STATIC_BUILD_DIR)/icons/black/%.svg: static/icons/black/%.svg cp $< $@ - jshint $@ build/static/main.js: $(JSX_OBJS) $(JS_OBJS) env/$(ENV).env - browserify -t [ localenvify --envfile env/$(ENV).env ] \ - -t [ debowerify ] \ - $(BUILD_DIR)/main.js -o $@ + 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 $^) +build/webapp.tar.gz: $(addprefix $(STATIC_BUILD_DIR)/, $(STATIC_FILES)) build/static/main.js $(ICONS) + tar czf $@ --directory=$(dir $<) $(subst $(STATIC_BUILD_DIR)/,,$^) release: $(STATIC_BUILD_DIR) build/webapp.tar.gz clean: rm -rf build rm -rf node_modules + + +FONT_DIR = ./static/fontello +FONTELLO_HOST ?= http://fontello.com + +fontopen: + @if test ! `which curl` ; then \ + echo 'Install curl first.' >&2 ; \ + exit 128 ; \ + fi + curl --silent --show-error --fail --output .fontello \ + --form "config=@fontello_config.json" \ + ${FONTELLO_HOST} + x-www-browser ${FONTELLO_HOST}/`cat .fontello` + + +fontsave: + @if test ! `which unzip` ; then \ + echo 'Install unzip first.' >&2 ; \ + exit 128 ; \ + fi + @if test ! -e .fontello ; then \ + echo 'Run `make fontopen` first.' >&2 ; \ + exit 128 ; \ + fi + rm -rf .fontello.src .fontello.zip + curl --silent --show-error --fail --output .fontello.zip \ + ${FONTELLO_HOST}/`cat .fontello`/get + unzip .fontello.zip -d .fontello.src + rm -rf ${FONT_DIR} + mv `find ./.fontello.src -maxdepth 1 -name 'fontello-*'` ${FONT_DIR} + rm -rf .fontello.src .fontello.zip + cp ${FONT_DIR}/font/* static/fonts/ + cp ${FONT_DIR}/css/fontello-codes.css static/fontello.css + rm -rf ${FONT_DIR} \ No newline at end of file