USER=$(shell id -u)
GROUP=$(shell id -g)
PWD=$(shell pwd)

.PHONY: livebook
livebook:
	docker run -u ${USER}:${GROUP} -v ${PWD}:/data --net host --pull always -e LIVEBOOK_PORT=8090 -e LIVEBOOK_IFRAME_PORT=8091 -e ALTWORX_BOOK_ENV=dev -e LIVEBOOK_TOKEN_ENABLED=false ghcr.io/livebook-dev/livebook

deps/.get: mix.exs mix.lock
	mix deps.get
	touch $@

.PHONY: credo
credo: deps/.get
	mix credo --strict

.PHONY: compile-strict
compile-strict: deps/.get
	mix compile --warnings-as-errors

.PHONY: check-formatted
check-formatted: deps/.get
	mix format --check-formatted

.PHONY: dialyze
dialyze: deps/.get
	mix dialyzer

.PHONY: exdoc
exdoc: deps/.get
	mix docs

.PHONY: publish
publish: deps/.get
	mix hex.publish --yes
