Files
Converge/scripts/build-test-lib.sh

13 lines
622 B
Bash
Executable File

#!/usr/bin/env bash
# Compiles the pure-logic libs so tests can exercise the real source under Node.
set -euo pipefail
cd "$(dirname "$0")/.."
rm -rf .test-build
npx --yes tsc src/lib/dossier.ts src/lib/kb.ts src/lib/scoring.ts src/lib/client.ts src/lib/finance.ts src/lib/timeline.ts src/lib/shelfware.ts src/lib/portfolio.ts \
--outDir .test-build --target ES2022 --module esnext \
--moduleResolution bundler --skipLibCheck
# tsc emits extensionless relative imports; Node ESM needs the .js suffix.
for f in .test-build/*.js; do
perl -pi -e 's{(from\s+")(\./[^"]+?)(")}{$1.$2.".js".$3}ge unless /\.js"/' "$f"
done