.PHONY: format
format:
	find ./src -type f -name "*.hs" -exec sh -c 'fourmolu -i {}' \;
	find ./app -type f -name "*.hs" -exec sh -c 'fourmolu -i {}' \;
	find ./test -type f -name "*.hs" -exec sh -c 'fourmolu -i {}' \;

.PHONY: clean
clean:
	rm -rf ./newdist ./out ./dist-newstyle

.PHONY: build
build: fedi.cabal cabal.project
	cabal build all --enable-tests --enable-benchmarks

.PHONY: test
test:
	cabal test --test-show-details=direct

.PHONY: serve
serve:
	FEDI_DETAILS="test/public/details.json" cabal run fediserve -- serve

.PHONY: insert
insert:
	FEDI_DETAILS="test/public/details.json" cabal run fediserve -- insert note.html

.PHONY: docker
docker: fedi.cabal cabal.project clean
	DOCKER_BUILDKIT=1 docker build -o ./out/ .
	file out/fediserve