Use smart detection when multiple lockfiles found#275
Conversation
🦋 Changeset detectedLatest commit: 955597f The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
|
@copilot - instead of just bailing and leaving it undefined, lets let the env var based detection run as well, and then if that fails, return one of the detected ones. It may cause issues in rare cases but this should be very rare. |
When multiple lockfiles are found: 1. First try env var based detection (npm_config_user_agent) 2. If that fails, return one of the detected package managers 3. This handles edge cases better while still providing a fallback Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
Updated in c5adb84. When multiple lockfiles are detected, the function now:
This provides better handling of edge cases while maintaining deterministic behavior. |
theoephraim
left a comment
There was a problem hiding this comment.
@copilot - add a changeset
|
@copilot add a changeset |
Co-authored-by: philmillman <3722211+philmillman@users.noreply.github.com>
commit: |
Fix: Don't explode when finding multiple lockfiles
This PR addresses the issue where varlock throws an error when it finds multiple package manager lockfiles in a project.
Plan:
detectJsPackageManageris called and whyvarlock init)Changes Made:
Modified
detectJsPackageManagerinjs-package-manager-utils.ts:npm_config_user_agent)init.command.tsandpretty-format.ts) already handle the result gracefullyAdded comprehensive tests in
js-package-manager-utils.test.ts:Added changeset documenting this fix for the next release
Behavior:
package-lock.jsonandbun.lockb):init.command.ts: Auto-installs varlock as a dependency with detected package managerpretty-format.ts: Shows commands with the detected package manager prefixTesting:
Security Summary:
No security vulnerabilities were found in the changes.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.