#!/usr/bin/make -f
%:
	dh $@

override_dh_auto_build:
	mkdir -p scripts/node_modules/.bin
	ln -sf /usr/bin/tsc scripts/node_modules/.bin/tsc
	ln -sf /usr/bin/terser scripts/node_modules/.bin/terser
	cp debian/scripts-shims.d.ts scripts/src/debian-shims.d.ts
	cd scripts && cp tsconfig.safe.json tsconfig.json && node -e 'let f="tsconfig.json", fs=require("fs"), j=require("./"+f); Object.assign(j.compilerOptions, { module: "Node16", composite: false, declaration: false, declarationMap: false, noImplicitAny: false, noEmitOnError: false, skipLibCheck: true, strict: false }); delete j.references; fs.writeFileSync(f, JSON.stringify(j, null, 2) + "\n")' && (tsc -p tsconfig.json || test -f dist/pkg/build.js)
	node debian/build.mjs

override_dh_auto_install:
	dh_install
