#!/bin/sh
# Build the two library layouts that package.json exports: dist/index.js for
# "import" and dist/index.cjs for "require".  Upstream does the same with
# rollup and its rollup.config.js.
set -e

# rollup.config.js is an ES module, and ES module resolution only looks at
# node_modules -- never at the system-wide /usr/share/nodejs where Debian
# installs the rollup plugin.
mkdir -p node_modules/@rollup
[ -e node_modules/@rollup/plugin-buble ] || \
    ln -s /usr/share/nodejs/@rollup/plugin-buble node_modules/@rollup/plugin-buble

rollup -c
