Skip to content

Commit 8fa00d2

Browse files
authored
Don't throw error when failing to parse tsconfig.json (#232)
1 parent 58ff1de commit 8fa00d2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Development.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ First, make sure you are on the main branch and have no dirty changes.
4141

4242
Next, run the `dev/bump-version` script to bump the version in package.json and
4343
push a git tag to trigger a CI job.
44+
4445
```
4546
./dev/bump-version VERSION_TO_RELEASE
4647
# example: ./dev/bump-version 2.3.1

src/main.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ function indexSingleProject(options: ProjectOptions, cache: GlobalCache): void {
132132
return
133133
}
134134
}
135-
config = loadConfigFile(tsconfigFileName)
135+
const loadedConfig = loadConfigFile(tsconfigFileName)
136+
if (loadedConfig !== undefined) {
137+
config = loadedConfig
138+
}
136139
}
137140

138141
for (const projectReference of config.projectReferences || []) {
@@ -155,7 +158,7 @@ if (require.main === module) {
155158
main()
156159
}
157160

158-
function loadConfigFile(file: string): ts.ParsedCommandLine {
161+
function loadConfigFile(file: string): ts.ParsedCommandLine | undefined {
159162
const absolute = path.resolve(file)
160163

161164
const readResult = ts.readConfigFile(absolute, path => ts.sys.readFile(path))
@@ -193,8 +196,8 @@ function loadConfigFile(file: string): ts.ParsedCommandLine {
193196
errors.push(error)
194197
}
195198
if (errors.length > 0) {
196-
console.log({ absolute })
197-
throw new Error(ts.formatDiagnostics(errors, ts.createCompilerHost({})))
199+
console.log(ts.formatDiagnostics(errors, ts.createCompilerHost({})))
200+
return undefined
198201
}
199202
return result
200203
}

0 commit comments

Comments
 (0)