diff --git a/compiler/forget/package.json b/compiler/forget/package.json index c2982f58e1..c4abdc0a94 100644 --- a/compiler/forget/package.json +++ b/compiler/forget/package.json @@ -12,7 +12,8 @@ "bundle:meta": "scripts/bundle-meta.sh", "dev": "concurrently \"yarn:build --watch\" \"yarn:playground\"", "playground": "cd packages/playground && yarn && yarn dev", - "test": "yarn build && jest" + "test": "yarn build && jest", + "ts:analyze-trace": "scripts/ts-analyze-trace.sh" }, "repository": { "type": "git", diff --git a/compiler/forget/scripts/ts-analyze-trace.sh b/compiler/forget/scripts/ts-analyze-trace.sh new file mode 100755 index 0000000000..7351272888 --- /dev/null +++ b/compiler/forget/scripts/ts-analyze-trace.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Generates a TypeScript performance trace in a tmp folder, then runs the analyze-trace npm module +# to identify any hotspots that might cause slow compilation +# See https://github.com/microsoft/typescript-analyze-trace for CLI args + +set -eo pipefail + +tmp_dir=$(mktemp -d -t forget-XXXXXXXXXX) +tsc -p ./tsconfig.json --generateTrace $tmp_dir --incremental false && npx @typescript/analyze-trace $tmp_dir "$@"