mirror of
https://github.com/affaan-m/ECC.git
synced 2026-08-17 21:15:40 +02:00
fix(scripts): detect modern bun.lock, ignore stray root lockfiles
Bun switched its default lockfile from the binary bun.lockb to the text-based bun.lock, but detectFromLockFile() only ever checked for bun.lockb — a project using modern Bun would never be detected as using Bun at all. Added bun.lock as the primary lockfile with bun.lockb kept as a recognized legacy alias, so either format is detected correctly. Also ignore stray bun.lock/bun.lockb at the repo root: yarn is this repo's canonical package manager (package.json "packageManager"), so a lockfile from someone running `bun install` locally shouldn't get picked up by git status.
This commit is contained in:
@@ -43,7 +43,10 @@ const PACKAGE_MANAGERS = {
|
||||
},
|
||||
bun: {
|
||||
name: 'bun',
|
||||
lockFile: 'bun.lockb',
|
||||
lockFile: 'bun.lock',
|
||||
// Bun switched its default lockfile from the binary bun.lockb to the
|
||||
// text-based bun.lock. Keep recognizing the legacy file too.
|
||||
lockFileAliases: ['bun.lockb'],
|
||||
installCmd: 'bun install',
|
||||
runCmd: 'bun run',
|
||||
execCmd: 'bunx',
|
||||
@@ -92,9 +95,9 @@ function saveConfig(config) {
|
||||
function detectFromLockFile(projectDir = process.cwd()) {
|
||||
for (const pmName of DETECTION_PRIORITY) {
|
||||
const pm = PACKAGE_MANAGERS[pmName];
|
||||
const lockFilePath = path.join(projectDir, pm.lockFile);
|
||||
const lockFileNames = [pm.lockFile, ...(pm.lockFileAliases || [])];
|
||||
|
||||
if (fs.existsSync(lockFilePath)) {
|
||||
if (lockFileNames.some(lockFileName => fs.existsSync(path.join(projectDir, lockFileName)))) {
|
||||
return pmName;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user