Skip to content

Commit 9766de8

Browse files
authoredApr 10, 2023
feat: ignore missing tsconfig (#97)
Co-authored-by: Alec Larson <1925840+aleclarson@users.noreply.github.com> Closes #96
1 parent f045696 commit 9766de8

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"esbuild-jest": "npm:@alloc/esbuild-jest@^0.3.6",
3838
"jest": "^26.6.3",
3939
"klona": "^2.0.4",
40-
"prettier": "^2.0.5",
40+
"prettier": "^2.8.7",
4141
"rollup": "^2.45.2",
4242
"tsup": "^6.5.0",
4343
"typescript": "^4.9.3",

‎pnpm-lock.yaml

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/index.ts

+21-6
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,33 @@ export default (opts: PluginOptions = {}): Plugin => {
7676
}
7777
}
7878

79+
const parseOptions = {
80+
resolveWithEmptyIfConfigNotFound: true,
81+
} satisfies import('tsconfck').TSConfckParseOptions
82+
7983
const parsedProjects = new Set(
80-
await Promise.all(
81-
projects.map((tsconfigFile) =>
82-
hasTypeScriptDep
83-
? tsconfck.parseNative(tsconfigFile)
84-
: tsconfck.parse(tsconfigFile)
84+
(
85+
await Promise.all(
86+
projects.map((tsconfigFile) =>
87+
hasTypeScriptDep
88+
? tsconfck.parseNative(tsconfigFile, parseOptions)
89+
: tsconfck.parse(tsconfigFile, parseOptions)
90+
)
8591
)
86-
)
92+
).filter((project, i) => {
93+
if (project.tsconfigFile !== 'no_tsconfig_file_found') {
94+
return true
95+
}
96+
debug('tsconfig file not found:', projects[i])
97+
return false
98+
})
8799
)
88100

89101
resolversByDir = {}
90102
parsedProjects.forEach((project) => {
103+
if (!project) {
104+
return
105+
}
91106
// Don't create a resolver for projects with a references array.
92107
// Instead, create a resolver for each project in that array.
93108
if (project.referenced) {

0 commit comments

Comments
 (0)
Please sign in to comment.