Skip to content
Snippets Groups Projects
Unverified Commit bb6bc356 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

feat(bun): support multiple lock files (#24594)

parent cdb26369
No related branches found
No related tags found
No related merge requests found
Used for updating bun projects.
Bun is a tool for JavaScript projects and therefore an alternative to managers like npm, pnpm and Yarn.
If a `package.json` is found to be part of `bun` manager results then the same file will be excluded from the `npm` manager results so that it's not duplicated.
This means that supporting a `bun.lockb` file in addition to other JS lock files is not supported - Bun will take priority.
If a `package.json` is found to be part of `bun` manager results then the same file will be excluded from the `npm` manager results unless an npm/pnpm/Yarn lock file is also found.
......@@ -14,13 +14,21 @@ describe('workers/repository/extract/supersedes', () => {
{ manager: 'ansible' },
{
manager: 'bun',
packageFiles: [{ packageFile: 'package.json', deps: [] }],
packageFiles: [
{ packageFile: 'package.json', deps: [] },
{ packageFile: 'frontend/package.json', deps: [] },
],
},
{
manager: 'npm',
packageFiles: [
{ packageFile: 'package.json', deps: [] },
{ packageFile: 'backend/package.json', deps: [] },
{
packageFile: 'frontend/package.json',
deps: [],
lockFiles: ['frontend/yarn.lock'],
},
],
},
];
......@@ -34,11 +42,22 @@ describe('workers/repository/extract/supersedes', () => {
deps: [],
packageFile: 'package.json',
},
{
deps: [],
packageFile: 'frontend/package.json',
},
],
},
{
manager: 'npm',
packageFiles: [{ deps: [], packageFile: 'backend/package.json' }],
packageFiles: [
{ deps: [], packageFile: 'backend/package.json' },
{
deps: [],
lockFiles: ['frontend/yarn.lock'],
packageFile: 'frontend/package.json',
},
],
},
]);
});
......
......@@ -22,6 +22,7 @@ export function processSupersedesManagers(
supercededManagerResults.packageFiles =
supercededManagerResults.packageFiles.filter((packageFile) => {
if (
!packageFile.lockFiles?.length &&
supercedingPackageFileNames.includes(packageFile.packageFile)
) {
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment