hubl/Makefile

73 lines
1.6 KiB
Makefile
Raw Normal View History

2018-10-05 09:37:48 +00:00
DIST_DIR := www
2018-09-28 19:20:15 +00:00
SCRIPT_SRC := $(wildcard src/scripts/*.js)
2018-10-05 09:37:48 +00:00
SCRIPT_DEST := $(SCRIPT_SRC:src/%=$(DIST_DIR)/%)
2018-09-28 19:20:15 +00:00
default: build
clean:
2018-10-17 21:04:03 +00:00
git clean -fXd -e !src/config.pug
2018-09-28 19:20:15 +00:00
2018-10-05 11:07:14 +00:00
install: node_modules copy_lib copy_samples submodules
2018-09-28 19:20:15 +00:00
submodules:
git submodule init
git submodule update
2018-10-05 09:37:48 +00:00
build: $(DIST_DIR)/index.html $(DIST_DIR)/styles/index.css $(SCRIPT_DEST)
2018-09-28 19:20:15 +00:00
watch:
@echo 'watching for change'
@echo 'press Ctrl+C to stop'
@while true; do \
$(MAKE) --silent build; \
sleep 0.5; \
done
serve:
node server
# npm
node_modules:
npm install
# vendor lib
copy_lib:
@node copy_lib.js
2018-10-17 21:04:03 +00:00
# samples
2018-10-05 11:07:14 +00:00
copy_samples:
@cp -n src/config.sample.pug src/config.pug
2018-09-28 19:20:15 +00:00
# pug
2018-10-05 09:37:48 +00:00
$(DIST_DIR)/index.html: src/index.pug $(wildcard src/*.pug src/*/*.pug)
2018-09-28 19:20:15 +00:00
@echo pug: $< ➜ $@
@node_modules/.bin/pug --pretty $< --out $(dir $@) || touch $@
# sass
2018-10-05 09:37:48 +00:00
$(DIST_DIR)/styles/index.css: src/styles/index.scss $(wildcard src/*.scss src/*/*.scss)
2018-09-28 19:20:15 +00:00
@echo sass: $< ➜ $@
2018-10-05 09:37:48 +00:00
@node_modules/.bin/node-sass $< $@ --source-map true --source-map-contents || touch $@
2018-09-28 19:20:15 +00:00
# babel
2018-10-22 15:03:00 +00:00
$(DIST_DIR)/%.js: src/%.js .babelrc
2018-09-28 19:20:15 +00:00
@echo babel: $< ➜ $@
@mkdir -p $(dir $@)
@node_modules/.bin/babel $< --out-file $@ --source-maps || touch $@
2018-10-17 21:04:03 +00:00
buildprod: build
2018-10-12 17:11:13 +00:00
export SDN="https://test-paris.happy-dev.fr"; \
$(MAKE) $(DIST_DIR)/index.html -B
2018-11-14 13:03:57 +00:00
deploy: pull install build
2018-10-17 21:04:03 +00:00
pull:
git pull
2018-10-05 09:37:48 +00:00
sync:
2018-10-12 17:11:13 +00:00
rsync -rv www/* staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/ --exclude=www/oidc-client-config.json
2018-10-18 18:06:43 +00:00
rsync -v www/.htaccess staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/
2018-09-28 19:20:15 +00:00
2018-10-17 21:04:03 +00:00
.PHONY: default install submodules copy_lib copy_samples build watch serve clean sync buildprod pull deploy