Skip to content

Commit 3920190

Browse files
committed
fix
1 parent 332747d commit 3920190

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

packages/react-doctor/src/utils/discover-project.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,7 @@ const FRAMEWORK_DISPLAY_NAMES: Record<Framework, string> = {
6969
export const formatFrameworkName = (framework: Framework): string =>
7070
FRAMEWORK_DISPLAY_NAMES[framework];
7171

72-
const IGNORED_DIRECTORIES = new Set([
73-
"node_modules",
74-
".git",
75-
".next",
76-
".turbo",
77-
"dist",
78-
"build",
79-
"coverage",
80-
".cache",
81-
".output",
82-
".nuxt",
83-
".expo",
84-
]);
72+
const IGNORED_DIRECTORIES = new Set(["node_modules", "dist", "build", "coverage"]);
8573

8674
const countSourceFilesViaFilesystem = (rootDirectory: string): number => {
8775
let count = 0;
@@ -93,10 +81,8 @@ const countSourceFilesViaFilesystem = (rootDirectory: string): number => {
9381

9482
for (const entry of entries) {
9583
if (entry.isDirectory()) {
96-
if (!entry.name.startsWith(".") || entry.name === ".git") {
97-
if (!IGNORED_DIRECTORIES.has(entry.name)) {
98-
stack.push(path.join(currentDirectory, entry.name));
99-
}
84+
if (!entry.name.startsWith(".") && !IGNORED_DIRECTORIES.has(entry.name)) {
85+
stack.push(path.join(currentDirectory, entry.name));
10086
}
10187
continue;
10288
}

packages/react-doctor/src/utils/find-monorepo-root.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { readPackageJson } from "./read-package-json.js";
44

55
export const isMonorepoRoot = (directory: string): boolean => {
66
if (fs.existsSync(path.join(directory, "pnpm-workspace.yaml"))) return true;
7+
if (fs.existsSync(path.join(directory, "nx.json"))) return true;
78
const packageJsonPath = path.join(directory, "package.json");
89
if (!fs.existsSync(packageJsonPath)) return false;
910
const packageJson = readPackageJson(packageJsonPath);

packages/react-doctor/src/utils/run-knip.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,20 @@ const extractFailedPluginName = (error: unknown): string | null => {
8181
return match?.[1] ?? null;
8282
};
8383

84+
const resolveTsConfigFile = (directory: string): string | undefined =>
85+
fs.existsSync(path.join(directory, "tsconfig.base.json")) ? "tsconfig.base.json" : undefined;
86+
8487
const runKnipWithOptions = async (
8588
knipCwd: string,
8689
workspaceName?: string,
8790
): Promise<KnipResults> => {
91+
const tsConfigFile = resolveTsConfigFile(knipCwd);
8892
const options = await silenced(() =>
8993
createOptions({
9094
cwd: knipCwd,
9195
isShowProgress: false,
9296
...(workspaceName ? { workspace: workspaceName } : {}),
97+
...(tsConfigFile ? { tsConfigFile } : {}),
9398
}),
9499
);
95100

0 commit comments

Comments
 (0)