Skip to content

Commit 8a68c2c

Browse files
authored
Use JSON5 for parsing tsconfig (#59)
1 parent 555651b commit 8a68c2c

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"chalk": "^5.3.0",
5050
"commander": "^11.0.0",
5151
"detect-package-manager": "^3.0.1",
52+
"json5": "^2.2.3",
5253
"prompts": "^2.4.2",
5354
"recast": "^0.23.4",
5455
"ts-morph": "^20.0.0"

packages/cli/src/lib/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { readFile } from "fs"
33

44
import { log, spinner } from "@clack/prompts"
55
import { detect } from "detect-package-manager"
6+
import JSON5 from "json5"
67

78
export function readJsonFile(
89
filePath: string,
@@ -15,7 +16,7 @@ export function readJsonFile(
1516
}
1617

1718
try {
18-
const jsonObject = JSON.parse(data)
19+
const jsonObject = JSON5.parse(data)
1920
callback(null, jsonObject)
2021
} catch (parseError) {
2122
callback(parseError as Error, null)

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)