Skip to content

Instantly share code, notes, and snippets.

@webstrand
Created April 2, 2025 18:50
Show Gist options
  • Save webstrand/7dd5347d0ed77fea9c13e0713acd2b5d to your computer and use it in GitHub Desktop.
Save webstrand/7dd5347d0ed77fea9c13e0713acd2b5d to your computer and use it in GitHub Desktop.
Compile one file in a project using `tsc`
#!/usr/bin/env -S unshare -Umr -- bash
set -euo pipefail;
tmpfile=$(mktemp);
cpp -P -E tsconfig.json | FILE=$1 jq '.files = [env.FILE] | del(.include)' > $tmpfile;
mount --bind $tmpfile tsconfig.json;
rm $tmpfile;
exec pnpm exec tsc -p tsconfig.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment