feat(cli): Add emitcheck command to validate TS file emission without generating output

This commit is contained in:
2025-03-20 15:16:02 +00:00
parent 5d32ac85e0
commit 6cc9f41bd2
6 changed files with 179 additions and 2 deletions

View File

@ -121,6 +121,31 @@ compiling in this order:
[ 'ts_interfaces', 'ts_shared', 'ts_core', 'ts_utils', 'ts_modules' ]
```
### EmitCheck Command
Checks if TypeScript files can be emitted without actually emitting them:
```bash
npx tsbuild emitcheck <file_or_glob_pattern> [additional_patterns ...]
```
This command:
1. Performs type checking on the specified TypeScript file(s)
2. Supports both direct file paths and glob patterns
3. Reports any errors that would prevent successful compilation
4. Exits with code 0 if all files can be emitted, or 1 if any cannot
5. Doesn't produce any output files
Example usage with specific files:
```bash
npx tsbuild emitcheck src/main.ts src/utils.ts
```
Example usage with glob patterns:
```bash
npx tsbuild emitcheck "src/**/*.ts" "test/**/*.ts"
```
## Compiler Options
Additional flags can be passed to any command to modify the compilation behavior: