HTML := cockpit.html mass-graduation.html admin-tools.html
SITES := $(addprefix dist/,$(HTML))
JS := $(SITES:.html=.js)

dist/%.html: %.html %.css dist/%.js
	echo | pandoc --template $< --embed-resources --standalone > $@

dist/%.js: $(wildcard src/*.js)
	npm run build:dev

.PHONY: mock dev prod check lint check-format format
mock:
	npm run build:mock
	scripts/update-env-srcs src/ mock
	$(MAKE) $(SITES)

dev:
	npm run build:dev
	scripts/update-env-srcs src/ prod
	$(MAKE) $(SITES)

prod:
	npm run build
	scripts/update-env-srcs src/ prod
	$(MAKE) $(SITES)

check: check-types check-format lint

check-types:
	npm run types-check

check-format:
	npm run prettier-check

lint:
	npm run lint

format:
	npm run format
