@make:
	elm make src/Main.elm --warn

@make-static:
	elm make src/Main-Static.elm --warn

@build-server:
	npm run build
	(cd dist; tar -cvf ../../src/api/data/web-ui.tar *)

@build-static:
	elm make src/Main-Static.elm
	rm -rf dist && mkdir dist
	cp -r index.html css dist
	# copy and link the style sheets
	sed -i'' -e 's/<title>Main<\/title>/<title>Design Documents<\/title>/g' dist/index.html
	sed -i'' -e 's/<head>/<head><link rel="stylesheet" type="text\/css" href="css\/index.css" \/>/g' dist/index.html
	(cd dist && tar -cvf ../../src/cmd/data/web-ui-static.tar *)

build: build-static build-server
	@echo "-- full elm build complete"

@test:
	elm test

lint:
	rm -rf elm-stuff/build_artifacts
	just make
	rm -rf elm-stuff/build_artifacts
	just make-static

fmt:
	elm-format src/ tests/ --yes

check-fmt:
	elm-format src/ --validate 2>&1

update:
	npm install $NPM_PACKAGES --prefix $NODE_DIR
	npm install
	elm make src/Main.elm --yes
