Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add stop option to detect #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

luxass
Copy link

@luxass luxass commented Dec 31, 2024

Description

This PR adds a new stop option to detect and detectSync. This will allow us to stop traversing directories when a certain directory is hit.

Linked Issues

N/A

Additional context

N/A

Currently we can't break the traversing up directories, which we now can.
@benmccann
Copy link
Collaborator

What is the motivation for this?

@luxass
Copy link
Author

luxass commented Jan 1, 2025

What is the motivation for this?

I needed this feature for testing package manager detection in my codebase that uses pnpm. Specifically, I have tests that should return null when no package manager is found, but without the stop option, the traversal continues upward and finds the pnpm configuration at the repository root, causing the test to fail. The stop option allows me to properly test these scenarios by limiting how far up the directory tree the search goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants