2017-03-24 15:48:24 +00:00
|
|
|
ELM_FILES := $(shell find src -iname *.elm)
|
2017-05-12 14:49:32 +00:00
|
|
|
DOCKER_IMG :=elm-env
|
|
|
|
DOCKER_CMD := docker run --rm -t -v $(PWD):/app -w /app $(DOCKER_IMG)
|
|
|
|
TEMPFILE := $(shell mktemp ./elm-XXXXXXXXXX.js)
|
2017-04-21 16:42:29 +00:00
|
|
|
|
2017-05-12 14:49:32 +00:00
|
|
|
ifeq ($(NO_DOCKER), true)
|
|
|
|
DOCKER_CMD=
|
|
|
|
endif
|
|
|
|
|
|
|
|
all: test script.js
|
|
|
|
|
|
|
|
elm-env:
|
|
|
|
@(if [ "$(NO_DOCKER)" != "true" ] ; then \
|
|
|
|
echo ">> building elm-env docker image"; \
|
|
|
|
docker build -t $(DOCKER_IMG) ../. > /dev/null; \
|
|
|
|
fi; )
|
|
|
|
|
|
|
|
format: elm-env $(ELM_FILES)
|
|
|
|
@echo ">> format front-end code"
|
|
|
|
@$(DOCKER_CMD) elm-format --yes $(ELM_FILES)
|
|
|
|
|
|
|
|
test: elm-env
|
|
|
|
@$(DOCKER_CMD) elm-format $(ELM_FILES) --validate
|
|
|
|
@$(DOCKER_CMD) elm-test
|
2017-04-21 16:42:29 +00:00
|
|
|
|
|
|
|
dev-server:
|
2017-06-07 20:38:39 +00:00
|
|
|
elm-reactor
|
|
|
|
|
2017-05-12 14:49:32 +00:00
|
|
|
script.js: elm-env format $(ELM_FILES)
|
|
|
|
@echo ">> building script.js"
|
|
|
|
@$(DOCKER_CMD) elm make src/Main.elm --yes --output $(TEMPFILE)
|
|
|
|
@$(DOCKER_CMD) uglifyjs $(TEMPFILE) --compress unused --mangle --output $(@)
|
|
|
|
@rm $(TEMPFILE)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
- @rm script.js
|
|
|
|
- @docker rmi $(DOCKER_IMG)
|