73 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
DIST_DIR := www
 | 
						|
 | 
						|
SCRIPT_SRC := $(wildcard src/scripts/*.js)
 | 
						|
 | 
						|
SCRIPT_DEST := $(SCRIPT_SRC:src/%=$(DIST_DIR)/%)
 | 
						|
 | 
						|
default: build
 | 
						|
 | 
						|
clean:
 | 
						|
	git clean -fXd -e !src/config.pug
 | 
						|
 | 
						|
 | 
						|
install: node_modules copy_lib copy_samples submodules
 | 
						|
 | 
						|
submodules:
 | 
						|
	git submodule init
 | 
						|
	git submodule update --recursive --remote
 | 
						|
 | 
						|
build: $(DIST_DIR)/index.html $(DIST_DIR)/styles/index.css $(SCRIPT_DEST)
 | 
						|
 | 
						|
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
 | 
						|
 | 
						|
# samples
 | 
						|
copy_samples:
 | 
						|
	@cp -n src/config.sample.pug src/config.pug
 | 
						|
 | 
						|
# pug
 | 
						|
$(DIST_DIR)/index.html: src/index.pug $(wildcard src/*.pug src/*/*.pug)
 | 
						|
	@echo pug: $< ➜ $@
 | 
						|
	@node_modules/.bin/pug --pretty $< --out $(dir $@) || touch $@
 | 
						|
 | 
						|
# sass
 | 
						|
$(DIST_DIR)/styles/index.css: src/styles/index.scss $(wildcard src/*.scss src/*/*.scss)
 | 
						|
	@echo sass: $< ➜ $@
 | 
						|
	@node_modules/.bin/node-sass $< $@ --source-map true --source-map-contents || touch $@ 
 | 
						|
 | 
						|
# babel
 | 
						|
$(DIST_DIR)/%.js: src/%.js .babelrc
 | 
						|
	@echo babel: $< ➜ $@
 | 
						|
	@mkdir -p $(dir $@)
 | 
						|
	@node_modules/.bin/babel $< --out-file $@ --source-maps || touch $@
 | 
						|
 | 
						|
buildprod: build
 | 
						|
	export SDN="https://test-paris.happy-dev.fr"; \
 | 
						|
	$(MAKE) $(DIST_DIR)/index.html -B
 | 
						|
 | 
						|
deploy: pull install build
 | 
						|
 | 
						|
pull:
 | 
						|
	git pull
 | 
						|
 | 
						|
sync:
 | 
						|
	rsync -rv www/* staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/ --exclude=www/oidc-client-config.json
 | 
						|
	rsync -v www/.htaccess staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/
 | 
						|
 | 
						|
.PHONY: default install submodules copy_lib copy_samples build watch serve clean sync buildprod pull deploy |