Skip to content

Commit

Permalink
feat: ignore missing tsconfig (#97)
Browse files Browse the repository at this point in the history
Co-authored-by: Alec Larson <1925840+aleclarson@users.noreply.github.com>

Closes #96
  • Loading branch information
haikyuu committed Apr 10, 2023
1 parent f045696 commit 9766de8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -37,7 +37,7 @@
"esbuild-jest": "npm:@alloc/esbuild-jest@^0.3.6",
"jest": "^26.6.3",
"klona": "^2.0.4",
"prettier": "^2.0.5",
"prettier": "^2.8.7",
"rollup": "^2.45.2",
"tsup": "^6.5.0",
"typescript": "^4.9.3",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 21 additions & 6 deletions src/index.ts
Expand Up @@ -76,18 +76,33 @@ export default (opts: PluginOptions = {}): Plugin => {
}
}

const parseOptions = {
resolveWithEmptyIfConfigNotFound: true,
} satisfies import('tsconfck').TSConfckParseOptions

const parsedProjects = new Set(
await Promise.all(
projects.map((tsconfigFile) =>
hasTypeScriptDep
? tsconfck.parseNative(tsconfigFile)
: tsconfck.parse(tsconfigFile)
(
await Promise.all(
projects.map((tsconfigFile) =>
hasTypeScriptDep
? tsconfck.parseNative(tsconfigFile, parseOptions)
: tsconfck.parse(tsconfigFile, parseOptions)
)
)
)
).filter((project, i) => {
if (project.tsconfigFile !== 'no_tsconfig_file_found') {
return true
}
debug('tsconfig file not found:', projects[i])
return false
})
)

resolversByDir = {}
parsedProjects.forEach((project) => {
if (!project) {
return
}
// Don't create a resolver for projects with a references array.
// Instead, create a resolver for each project in that array.
if (project.referenced) {
Expand Down

0 comments on commit 9766de8

Please sign in to comment.