fix(core): add missing bun PM support (#26084)

This fix add support for bun PM in daemon and affected changes.

Helps towards #26053 fix
This commit is contained in:
Jordan Hall 2024-05-27 15:00:35 +01:00 committed by GitHub
parent 33ba03a81f
commit 4cbb0f0988
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 53 additions and 32 deletions

View File

@ -23,6 +23,13 @@ npx create-nx-workspace --pm yarn
npx create-nx-workspace --pm pnpm npx create-nx-workspace --pm pnpm
``` ```
{% /tab %}
{% tab label="Bun" %}
```shell
bunx create-nx-workspace --pm bun
```
{% /tab %} {% /tab %}
{% /tabs %} {% /tabs %}
@ -85,6 +92,13 @@ yarn global add nx@latest
pnpm add --global nx@latest pnpm add --global nx@latest
``` ```
{% /tab %}
{% tab label="Bun" %}
```shell
bun install --global nx@latest
```
{% /tab %} {% /tab %}
{% /tabs %} {% /tabs %}

View File

@ -161,6 +161,7 @@ function replaceMentions(
'yarn.lock', 'yarn.lock',
'package-lock.json', 'package-lock.json',
'pnpm-lock.yaml', 'pnpm-lock.yaml',
'bun.lockb',
'CHANGELOG.md', 'CHANGELOG.md',
]; ];
if (ignoredFiles.includes(basename(path))) { if (ignoredFiles.includes(basename(path))) {

View File

@ -258,6 +258,7 @@ function lockFileHashChanged(): boolean {
join(workspaceRoot, 'package-lock.json'), join(workspaceRoot, 'package-lock.json'),
join(workspaceRoot, 'yarn.lock'), join(workspaceRoot, 'yarn.lock'),
join(workspaceRoot, 'pnpm-lock.yaml'), join(workspaceRoot, 'pnpm-lock.yaml'),
join(workspaceRoot, 'bun.lockb'),
] ]
.filter((file) => existsSync(file)) .filter((file) => existsSync(file))
.map((file) => hashFile(file)); .map((file) => hashFile(file));

View File

@ -36,37 +36,41 @@ describe('getTouchedProjectsFromLockFile', () => {
allNodes = Object.keys(graph.nodes); allNodes = Object.keys(graph.nodes);
}); });
['package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'pnpm-lock.yml'].forEach( [
(lockFile) => { 'package-lock.json',
describe(`"${lockFile}"`, () => { 'yarn.lock',
it(`should not return changes when "${lockFile}" is not touched`, () => { 'pnpm-lock.yaml',
const result = getTouchedProjectsFromLockFile( 'pnpm-lock.yml',
[ 'bun.lockb',
{ ].forEach((lockFile) => {
file: 'source.ts', describe(`"${lockFile}"`, () => {
hash: 'some-hash', it(`should not return changes when "${lockFile}" is not touched`, () => {
getChanges: () => [new WholeFileChange()], const result = getTouchedProjectsFromLockFile(
}, [
], {
graph.nodes file: 'source.ts',
); hash: 'some-hash',
expect(result).toEqual([]); getChanges: () => [new WholeFileChange()],
}); },
],
it(`should return all nodes when "${lockFile}" is touched`, () => { graph.nodes
const result = getTouchedProjectsFromLockFile( );
[ expect(result).toEqual([]);
{
file: lockFile,
hash: 'some-hash',
getChanges: () => [new WholeFileChange()],
},
],
graph.nodes
);
expect(result).toEqual(allNodes);
});
}); });
}
); it(`should return all nodes when "${lockFile}" is touched`, () => {
const result = getTouchedProjectsFromLockFile(
[
{
file: lockFile,
hash: 'some-hash',
getChanges: () => [new WholeFileChange()],
},
],
graph.nodes
);
expect(result).toEqual(allNodes);
});
});
});
}); });

View File

@ -10,6 +10,7 @@ export const getTouchedProjectsFromLockFile: TouchedProjectLocator<
'yarn.lock', 'yarn.lock',
'pnpm-lock.yaml', 'pnpm-lock.yaml',
'pnpm-lock.yml', 'pnpm-lock.yml',
'bun.lockb',
]; ];
if (fileChanges.some((f) => lockFiles.includes(f.file))) { if (fileChanges.some((f) => lockFiles.includes(f.file))) {