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
```
{% /tab %}
{% tab label="Bun" %}
```shell
bunx create-nx-workspace --pm bun
```
{% /tab %}
{% /tabs %}
@ -85,6 +92,13 @@ yarn global add nx@latest
pnpm add --global nx@latest
```
{% /tab %}
{% tab label="Bun" %}
```shell
bun install --global nx@latest
```
{% /tab %}
{% /tabs %}

View File

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

View File

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

View File

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