Commit 05436eb
committed
Allow comments in tsconfig.json files
Previously, if your tsconfig.json file contained a comment (allowed by the
TS compiler) the ts-import-types-cli would throw the following error:
`ts-import-types-cli --project /home/joshuacc/projects/azure-iots-saas/ux-renderer/tsconfig.json is not a tsconfig.json file`
This is because the node `require` function can only parse valid
(commentless) JSON.
This PR swaps out the use of `require` in favor of directly reading
the file contents, stripping all comments, and only then parsing it
to confirm that it is valid JSON.
Hopefully this will save other users some confusion!1 parent 8b1e038 commit 05436eb
3 files changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
309 | 314 | | |
310 | 315 | | |
311 | 316 | | |
| |||
0 commit comments