( current: string, root: string = searchForPackageRoot(current), )
| 82 | * Search up for the nearest workspace root |
| 83 | */ |
| 84 | export function searchForWorkspaceRoot( |
| 85 | current: string, |
| 86 | root: string = searchForPackageRoot(current), |
| 87 | ): string { |
| 88 | if (hasRootFile(current)) return current |
| 89 | if (hasWorkspacePackageJSON(current)) return current |
| 90 | if (hasWorkspaceDenoJSON(current)) return current |
| 91 | |
| 92 | const dir = dirname(current) |
| 93 | // reach the fs root |
| 94 | if (!dir || dir === current) return root |
| 95 | |
| 96 | return searchForWorkspaceRoot(dir, root) |
| 97 | } |
no test coverage detected