#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_build:
	ROLLUP_PRODUCTION=1 rollup --strict --config=debian/rollup.config.js --format=esm --file=dist/index.min.js lib/index.js
	rollup --strict --config=debian/rollup.config.js --format=esm --file=dist/index.js lib/index.js
	mkdir -p debian/js
	cp -f -t debian/js \
		-- dist/*.*
	find debian/js -name '*.min.js' \
		-exec pigz --force --keep -11 -- {} + \
		-exec brotli --force --keep --best -- {} +

# TODO: Enable testsuite when cross-env (and more) is in Debian
override_dh_auto_test:
#	cross-env NODE_ENV=test mocha --delay -t 30000 -A -R ${REPORTER:-spec} tests/test.js

execute_before_dh_auto_clean:
	rm -rf node_modules/.cache
