#!/bin/sh
# Upstream's .babelrc.js reads the target Node.js version from package.json
# through read-pkg-up, which Debian does not ship under that name, so
# debian/babel.config.js carries the same settings and --no-babelrc keeps the
# upstream file out of the way.
set -e

# tsc resolves the type declarations of the imported modules through
# node_modules, which a Debian build does not populate.
mkdir -p node_modules
ln -sfn /usr/share/nodejs/del node_modules/del
ln -sfn /usr/share/nodejs/webpack node_modules/webpack

babeljs src -d dist --extensions .ts --no-babelrc \
	--config-file ./debian/babel.config.js --source-maps \
	--ignore '*/**/*.d.ts,**/**/*.test.ts'
tsc --project tsconfig.types.json
