| 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 4 | # |
| 5 | # This source code is licensed under the MIT license found in the |
| 6 | # LICENSE file in the root directory of this source tree. |
| 7 | # |
| 8 | |
| 9 | # Generates a TypeScript performance trace in a tmp folder, then runs the analyze-trace npm module |
| 10 | # to identify any hotspots that might cause slow compilation |
| 11 | # See https://github.com/microsoft/typescript-analyze-trace for CLI args |
| 12 | |
| 13 | set -eo pipefail |
| 14 | |
| 15 | tmp_dir=$(mktemp -d -t forget-XXXXXXXXXX) |
| 16 | ./node_modules/typescript/bin/tsc -p ./tsconfig.json --generateTrace $tmp_dir --incremental false && npx @typescript/analyze-trace $tmp_dir "$@" |