Skip to content

Commit aa5ec36

Browse files
authored
Make --project accept path to directory containing tsconfig, not just path to tsconfig (#1830)
* fix #1829 * fix * fix
1 parent ad01f49 commit aa5ec36

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/configuration.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolve, dirname } from 'path';
1+
import { resolve, dirname, join } from 'path';
22
import type * as _ts from 'typescript';
33
import {
44
CreateOptions,
@@ -167,9 +167,13 @@ export function readConfig(
167167

168168
// Read project configuration when available.
169169
if (!skipProject) {
170-
configFilePath = project
171-
? resolve(cwd, project)
172-
: ts.findConfigFile(projectSearchDir, fileExists);
170+
if (project) {
171+
const resolved = resolve(cwd, project);
172+
const nested = join(resolved, 'tsconfig.json');
173+
configFilePath = fileExists(nested) ? nested : resolved;
174+
} else {
175+
configFilePath = ts.findConfigFile(projectSearchDir, fileExists);
176+
}
173177

174178
if (configFilePath) {
175179
let pathToNextConfigInChain = configFilePath;

0 commit comments

Comments
 (0)