Commit 7f5952f
authored
fix: fix locating tsc in workspaces using yarn 1
### Summary
When running yarn (tested on ver. `1.22.19`), `yarn bin tsc` run via
Node.js `spawn` outputs extra leading ANSI characters, causing the path
to `tsc` to look like the following:
`\x1B[2K\x1B[1G/Users/<username>/<path to
project>/node_modules/.bin/tsc`. This causes any call to `existsSync` to
fail (the ANSI chars are non-printable so not visible below, but
printing an object with the string as value shows them encoded), showing
a false-positive warning:
```
⚠ [typescript] Failed to locate tsc in the workspace. Falling back to the binary found in PATH at /Users/<username>/<path to project>/node_modules/.bin/tsc. Consider adding typescript to your devDependencies or specifying the tsc option for the typescript target.
```
Setting the env var `FORCE_COLOR` to `0` remediates the problem, which
this PR brings.
### Test plan
Run `bob build` in a yarn project, ensure tsc is found successfully.1 parent eb0e43f commit 7f5952f
1 file changed
+1
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| |||
0 commit comments