#!/bin/sh
# Upstream builds marked with esbuild (esbuild.config.js), using
# esbuild-plugin-umd-wrapper which is not packaged in Debian. Reproduce the
# shipped artifacts (ESM + browser bundle) with plain esbuild invocations.
set -e
esbuild src/marked.ts --bundle --format=esm --outfile=lib/marked.esm.js
esbuild src/marked.ts --bundle --format=iife --global-name=marked --outfile=lib/marked.umd.js
esbuild src/marked.ts --bundle --format=iife --global-name=marked --minify --outfile=lib/marked.umd.min.js

# Upstream generates the man page from man/marked.1.md with marked-man
# (honours SOURCE_DATE_EPOCH, so the build stays reproducible).
marked-man man/marked.1.md > man/marked.1
