Skip to content

Commit

Permalink
fix: tsconfig files always included in root names
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Dec 22, 2020
1 parent 556a391 commit 9be7b2a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/utils/src/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ async function getRootNames(config: JsonConfig, dirname: string) {
const include: string[] | undefined = config.include
const exclude: string[] | undefined = config.exclude || ['node_modules/**']

if (config.files) {
return config.files.map(f => path.resolve(dirname, f))
}
const files = config.files?.map(f => path.resolve(dirname, f)) ?? []

if (include && Array.isArray(include) && include.length > 0) {
const rules: string[] = []
for (const file of include) {
Expand All @@ -133,10 +132,14 @@ async function getRootNames(config: JsonConfig, dirname: string) {
rules.push(currentPath)
}
}
return globAsync(rules.length === 1 ? rules[0] : `{${rules.join(',')}}`, exclude, dirname)
const includeFiles = await globAsync(rules.length === 1 ? rules[0] : `{${rules.join(',')}}`, exclude, dirname)
return [...files, ...includeFiles]
}
const rootNames = await globAsync(`**/*.{ts,tsx}`, exclude, dirname)
return rootNames.map((r) => path.resolve(process.cwd(), dirname, r))
return [
...files,
...rootNames.map((r) => path.resolve(process.cwd(), dirname, r)),
]
}

function statAsync(file: string) {
Expand Down

1 comment on commit 9be7b2a

@jamestowers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

Please sign in to comment.