#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ --with nodejs

override_dh_auto_build:
	dh_auto_build
	mkdir node_modules
	for c in `perl -nle 'print $$1 if/component=([\w\-]+)/' debian/watch`; do \
		ln -s ../$$c node_modules/; \
	done
	for p in should-equal should-type; do \
		(cd $$p && \
			rollup --format=cjs --output=cjs/$$p.js index.js && \
			rollup --format=es --output=es6/$$p.js index.js \
		); \
	done
	rollup -c rollup.config.js --input ./lib/umd.js --output.format=iife  --output.file ./should.js
	rollup --output.format=cjs --output.file=cjs/should.js lib/index.js
	rollup --output.format=es --output.file=es6/should.js lib/index.js

override_dh_fixperms:
	dh_fixperms
	find debian -name package.json -exec chmod 644 {} \;
