Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nx): allow text lockfile for bun #29423

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ludicast
Copy link

@ludicast ludicast commented Dec 19, 2024

Current Behavior

Nx does not respect a bun.lock, which is the new lockfile for bun (currently available and to be the default in bun 1.2)

The text-lockfile will allow dependabot to run, as well as prevent the merge conflicts caused with a binary lockfile.

Expected Behavior

Nx will respect a bun.lock

Note that we are still defaulting to the bun.lockb style here for generators, this is just to allow repos containing bun.lock. After bun.lock becomes the default there should be a second PR to make it the default for generators.

Related Issue(s)

Fixes #29422

Copy link

vercel bot commented Dec 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Dec 19, 2024 3:55pm

Copy link

nx-cloud bot commented Dec 19, 2024

View your CI Pipeline Execution ↗ for commit 7e78976.

Command Status Duration Result
nx documentation --no-dte ❌ Failed 26s View ↗

☁️ Nx Cloud last updated this comment at 2024-12-19 15:58:43 UTC

@ludicast
Copy link
Author

cc @Jordan-Hall

return existsSync(join(dir, 'bun.lockb'))
? 'bun'
: existsSync(join(dir, 'yarn.lock'))
return existsSync(join(dir, 'yarn.lock'))
? 'yarn'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made yarn the first lockfile just to make the bun/pnpm indentation identical for multiple lockfiles

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e bun/pnpm indentation identical for multiple lockfiles

Doesnt bun current support to yarn lock still, This is why bun came frist

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, great point, will reverse

@Jordan-Hall
Copy link
Contributor

Jordan-Hall commented Dec 19, 2024

@ludicast This is a good start but personally I would change the interface. We need to keep bun lock first because bun still goes to yarn with additional parm.

I think its best to include a parser and writer as part of this PR.

I did some work on this in preparation a while ago. Feel free to take a look at interface changes

#28119

It also a branch from #27820 to add bun pack @ludicast can you add pack support too.

@Jordan-Hall
Copy link
Contributor

Added the PR back for pack as their no breaking change. #29426 I should of never pulled the PR tbf

@ludicast
Copy link
Author

ludicast commented Dec 19, 2024

@ludicast This is a good start but personally I would change the interface. We need to keep bun lock first because bun still goes to yarn with additional parm.

thanks for info - changed the ordering back

I think its best to include a parser and writer as part of this PR.

we could but was thinking for that as a follow-on. I believe the format is jsonc (which isn't compatible with json.parse in vanilla js) so might want to avoid dealing with that in this PR (though now thinking that nx does parse a similar style in schemas anyways). esp the part of writing that lockfile (since .lock is a few days old and might surprise folks).

I did some work on this in preparation a while ago. Feel free to take a look at interface changes

thanks @Jordan-Hall - gave it a look


update - guess I prob can use the json-c parser if installed then

import { parse, printParseErrorCode, stripComments } from 'jsonc-parser';

@ludicast ludicast changed the title Allow text lockfile for bun feat(nx): allow text lockfile for bun Dec 19, 2024
@ludicast
Copy link
Author

ludicast commented Dec 19, 2024

@Jordan-Hall - if by parser you mean writing something in the vein of https://github.com/nrwl/nx/blob/master/packages/nx/src/plugins/js/lock-file/yarn-parser.ts it def would need to be a follow-on (it's enough code to get caught up in PR purgatory)

@Jordan-Hall
Copy link
Contributor

Yes i was because as you can see from the PR i did their loads of work needs to be done. I dont think just adding new vars is the right idea. If not can you at least do the grunt work without that section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants