#!/usr/bin/make -f

%:
	dh $@

# build browser library and documentation
# * pre-compress in gzip, zlib, and brotli formats
override_dh_auto_build:
	webpack --progress
	mkdir -p debian/js
	cp -f dist/* debian/js/
	find debian/js -name '*.min.js' \
		-exec pigz --force --keep -11 -- {} + \
		-exec pigz --force --keep -11 --zlib -- {} + \
		-exec brotli --force --keep --best -- {} +
	marked --output README.html README.md

# build and run testsuite
# * wrap with perl TAP harness
# TODO: build and and ship test library
override_dh_auto_test:
#	webpack --progress --config webpack-tests.config.js
	NODE_ENV=test prove --verbose \
		--exec "mocha --reporter=tap --timeout 30000" \
		tests/unit/index.js

# install select documentation with all binary packages
override_dh_installdocs:
	dh_installdocs -- README.md README.html
