fix: support bun old and new lockfiles#227
Open
MrChrisRodriguez wants to merge 1 commit intodmno-dev:mainfrom
Open
fix: support bun old and new lockfiles#227MrChrisRodriguez wants to merge 1 commit intodmno-dev:mainfrom
MrChrisRodriguez wants to merge 1 commit intodmno-dev:mainfrom
Conversation
|
theoephraim
approved these changes
Jul 9, 2025
Comment on lines
+70
to
+72
| const lockfiles = Array.isArray(JS_PACKAGE_MANAGERS[pm].lockfile) | ||
| ? JS_PACKAGE_MANAGERS[pm].lockfile | ||
| : [JS_PACKAGE_MANAGERS[pm].lockfile as string]; |
Member
There was a problem hiding this comment.
Suggested change
| const lockfiles = Array.isArray(JS_PACKAGE_MANAGERS[pm].lockfile) | |
| ? JS_PACKAGE_MANAGERS[pm].lockfile | |
| : [JS_PACKAGE_MANAGERS[pm].lockfile as string]; | |
| const possibleLockFiles = _.castArray(JS_PACKAGE_MANAGERS[pm].lockfile)); |
Comment on lines
+74
to
+81
| let lockFileExists = false; | ||
| for (const lockfile of lockfiles) { | ||
| const lockFilePath = path.join(cwd, lockfile); | ||
| if (pathExistsSync(lockFilePath)) { | ||
| lockFileExists = true; | ||
| break; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| let lockFileExists = false; | |
| for (const lockfile of lockfiles) { | |
| const lockFilePath = path.join(cwd, lockfile); | |
| if (pathExistsSync(lockFilePath)) { | |
| lockFileExists = true; | |
| break; | |
| } | |
| } | |
| const thisPmLockFile = _.find(possibleLockFiles, (lockFileName) => pathExistsSync(path.join(cwd, lockFileName))); |
| } | ||
| } | ||
|
|
||
| if (lockFileExists) { |
Member
There was a problem hiding this comment.
Suggested change
| if (lockFileExists) { | |
| if (thisPmlockFile) { |
| @@ -67,14 +67,30 @@ export function detectJsPackageManager(opts?: { | |||
| let pm: JsPackageManager; | |||
| let detectedPm: JsPackageManager | undefined; | |||
Member
There was a problem hiding this comment.
Suggested change
| let detectedPm: JsPackageManager | undefined; | |
| let detectedPm: JsPackageManager | undefined; | |
| let detectedPmLockFile: string | undefined; |
Comment on lines
+85
to
94
| if (detectedPm) { | ||
| const currentLockfiles = Array.isArray(JS_PACKAGE_MANAGERS[pm].lockfile) | ||
| ? (JS_PACKAGE_MANAGERS[pm].lockfile as string[]).join(' or ') | ||
| : JS_PACKAGE_MANAGERS[pm].lockfile; | ||
| const detectedLockfiles = Array.isArray(JS_PACKAGE_MANAGERS[detectedPm].lockfile) | ||
| ? (JS_PACKAGE_MANAGERS[detectedPm].lockfile as string[]).join(' or ') | ||
| : JS_PACKAGE_MANAGERS[detectedPm].lockfile; | ||
| throw new Error(`Found multiple js package manager lockfiles - ${currentLockfiles} and ${detectedLockfiles}`); | ||
| } | ||
| detectedPm = pm; |
Member
There was a problem hiding this comment.
Suggested change
| if (detectedPm) { | |
| const currentLockfiles = Array.isArray(JS_PACKAGE_MANAGERS[pm].lockfile) | |
| ? (JS_PACKAGE_MANAGERS[pm].lockfile as string[]).join(' or ') | |
| : JS_PACKAGE_MANAGERS[pm].lockfile; | |
| const detectedLockfiles = Array.isArray(JS_PACKAGE_MANAGERS[detectedPm].lockfile) | |
| ? (JS_PACKAGE_MANAGERS[detectedPm].lockfile as string[]).join(' or ') | |
| : JS_PACKAGE_MANAGERS[detectedPm].lockfile; | |
| throw new Error(`Found multiple js package manager lockfiles - ${currentLockfiles} and ${detectedLockfiles}`); | |
| } | |
| detectedPm = pm; | |
| if (detectedPmLockFile) { | |
| throw new Error(`Found multiple js package manager lockfiles - ${thisPmLockFile} and ${detectedPmLockFile}`); | |
| } | |
| detectedPmLockFile = thisPmLockFile; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modern bun uses .lock instead of .lockb files. This updates detect-package-manager to detect both.