(
	cd debian/tests/test_modules/topojson-client
	babeljs -d dist --plugins '@babel/plugin-transform-modules-commonjs' src/
)
if test "$AUTOPKGTEST_TMP" != ""; then
	rm -f src
	cp -a /usr/share/nodejs/d3-geo/src .
fi
# @babel/register hangs with Babel 8 (it now runs a worker thread), so the
# ESM sources and tests are compiled into a shadow CommonJS tree instead.
rm -rf .debian-cjs
babeljs -d .debian-cjs/src --copy-files --plugins '@babel/plugin-transform-modules-commonjs' src/
babeljs -d .debian-cjs/test --copy-files --plugins '@babel/plugin-transform-modules-commonjs' test/
cp package.json .debian-cjs/
ln -sfn ../dist .debian-cjs/dist
tape '.debian-cjs/test/**/*.js'
