Skip to content

Commit

Permalink
Transverse the dir tree without assuming unix dir structure
Browse files Browse the repository at this point in the history
  • Loading branch information
kraftbj committed Jan 10, 2025
1 parent 5e8d778 commit 0dd5ba8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion projects/js-packages/jetpack-cli/bin/jp.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ const isMonorepoRoot = dir => {
*/
const findMonorepoRoot = startDir => {
let dir = startDir;
while ( dir !== '/' ) {
let prevDir;
while ( dir !== prevDir ) {
// Keep going until dirname() stops changing the path
if ( isMonorepoRoot( dir ) ) {
return dir;
}
prevDir = dir;
dir = dirname( dir );
}
return null;
Expand Down

0 comments on commit 0dd5ba8

Please sign in to comment.