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

bun: workspace support #24459

Open
rarkins opened this issue Sep 16, 2023 · 23 comments
Open

bun: workspace support #24459

rarkins opened this issue Sep 16, 2023 · 23 comments
Assignees
Labels
manager:bun priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)

Comments

@rarkins
Copy link
Collaborator

rarkins commented Sep 16, 2023

Describe the proposed change(s).

Use the workspaces field in package.json to detect workspace package.json files

The goal would be that a reproduction like renovate-reproductions/24459b#3 would show all three package files as "bun" and none as "npm".

Likely all work is contained to https://github.com/renovatebot/renovate/tree/main/lib/modules/manager/bun

Today Renovate's bun manager:

  • is triggered by a lock file
  • locates the adjacent package.json
  • parses the package.json
  • returns results for package.json + bun.lock(b)

What needs to be done is:

  • After parsing the package.json adjacent to the lock file, look for "workspaces" config inside the package.json
  • Locate any matching package.json deeper in the repo
  • For each of those, parse them as package.json and put the results into the returned "packageFiles", ensuring that the lockFiles correctly points to the top level lock file

This alone may be enough for it to work.

@rarkins rarkins added type:feature Feature (new functionality) priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:ready labels Sep 16, 2023
@rarkins rarkins added status:blocked Issue is blocked by another issue or external requirement and removed status:ready labels Sep 18, 2023
@The-Code-Monkey

This comment has been minimized.

@rarkins rarkins added auto:reproduction A minimal reproduction is necessary to proceed status:requirements Full requirements are not yet known, so implementation should not be started and removed status:blocked Issue is blocked by another issue or external requirement labels Sep 24, 2023
@github-actions

This comment has been minimized.

@rarkins

This comment has been minimized.

@The-Code-Monkey

This comment has been minimized.

@rarkins rarkins added status:blocked Issue is blocked by another issue or external requirement and removed status:requirements Full requirements are not yet known, so implementation should not be started labels Oct 1, 2023
@The-Code-Monkey
Copy link

https://github.com/The-Code-Monkey/bun-demo-monorepo

@rarkins this repo is a dummy repo for the bun mono repo support. I have setup renovate github bot on it too.

@rarkins
Copy link
Collaborator Author

rarkins commented Oct 2, 2023

Thanks, but unfortunately Renovate does not detect any dependencies to update according to the onboarding PR. If you replace ranges with fixed versions in the sub-package package.json then it should do it.

@The-Code-Monkey
Copy link

Ah ok, I have updated renovate to pin deps and will merge that PR once it does so. hope that helps.

@rarkins
Copy link
Collaborator Author

rarkins commented Oct 2, 2023

Well, it will pin them to the latest version, so still won't have any updates to make after that, but if we want a day or two after that..

@The-Code-Monkey
Copy link

@rarkins react has an open pr on the demo repo. Just so you are aware, I guess you can test now?

@rarkins rarkins added status:ready and removed auto:reproduction A minimal reproduction is necessary to proceed status:blocked Issue is blocked by another issue or external requirement labels Oct 5, 2023
@rarkins
Copy link
Collaborator Author

rarkins commented Oct 5, 2023

Reproduction forked to https://github.com/renovate-reproductions/24459

@Hebilicious
Copy link

Not sure if you still need some live repositories to investigate, but here's an example of one :

https://github.com/Hebilicious/vue-query-nuxt/blob/main/package.json

Note that I'm using a pnpm-workspace.yaml file for publishing packages only, it is bun monorepo. Would really appreciate proper support, even though sometimes some of the renovate PR randomly passes the tests 🤷🏽

@simonknittel
Copy link

simonknittel commented Mar 2, 2024

I've created the most simple repository for reproducing this: https://github.com/simonknittel/renovate-bun-workspaces

You'll see a package.json which uses workspaces. Each package (a and b) has dependencies which are outdated. Renovate successfully created pull requests for them, but they only update the corresponding package.json and not the bun.lockb of the root directory.

simonknittel added a commit to simonknittel/sinister-incorporated that referenced this issue Mar 2, 2024
@wladpaiva
Copy link

Used the same repro from @simonknittel but only added internal dependency from the root package.
https://github.com/wladpaiva/renovate-bun-workspaces

In this case, Renovate doesn't create any PR and dashboard detects dependencies like this:
image

...
DEBUG: Using file match: (^|/)\.vela\.ya?ml$ for manager velaci
DEBUG: Using file match: ^\.woodpecker(?:/[^/]+)?\.ya?ml$ for manager woodpecker
DEBUG: Matched 1 file(s) for manager bun: bun.lockb
DEBUG: Matched 3 file(s) for manager npm: package.json, packages/a/package.json, packages/b/package.json
DEBUG: npm file package.json has name "renovate-bun-workspaces"
DEBUG: npm file package.json has name "renovate-bun-workspaces"
DEBUG: npm file packages/a/package.json has name "a"
DEBUG: npm file packages/b/package.json has name "b"
DEBUG: Detecting pnpm Workspaces
DEBUG: Detecting workspaces
DEBUG: Finding locked versions
DEBUG: manager extract durations (ms)
DEBUG: Found bun package files
DEBUG: Found npm package files
DEBUG: Found 3 package file(s)
INFO: Dependency extraction complete
DEBUG: hostRules: no authentication for registry.npmjs.org
DEBUG: PackageFiles.add() - Package file saved for base branch
DEBUG: Package releases lookups complete
DEBUG: branchifyUpgrades
DEBUG: detectSemanticCommits()
DEBUG: getCommitMessages
DEBUG: semanticCommits: detected "unknown"
DEBUG: semanticCommits: disabled
DEBUG: 2 flattened updates found: zod, vitest
DEBUG: Returning 2 branch(es)
DEBUG: config.repoIsOnboarded=true
DEBUG: packageFiles with updates
DEBUG: detectSemanticCommits()
DEBUG: semanticCommits: returning "disabled" from cache
DEBUG: Repository timing splits (milliseconds)
DEBUG: Package cache statistics
DEBUG: http statistics
DEBUG: Package lookup durations
DEBUG: dns cache
INFO: Repository finished

@rarkins
Copy link
Collaborator Author

rarkins commented Apr 12, 2024

Latest reproduction forked to https://github.com/renovate-reproductions/24459b

@mstuercke
Copy link

Is there a workaround? Is it possible to force Renovate through the configuration to use bun instead of npm?

@rarkins
Copy link
Collaborator Author

rarkins commented Jun 6, 2024

No

@max-ae

This comment was marked as spam.

@Punie
Copy link

Punie commented Dec 17, 2024

Bun now supports a text-based lockfile starting as of version 1.39.0

https://bun.sh/blog/bun-lock-text-lockfile

@sebastianbuechler
Copy link

@rarkins
Copy link
Collaborator Author

rarkins commented Jan 18, 2025

@sebastianbuechler are you sure that PR adds any workspace specific logic?

@sebastianbuechler
Copy link

@sebastianbuechler are you sure that PR adds any workspace specific logic?

I think you misunderstood. I'm not claiming that it adds any workspace-specific logic, but it can be relevant for this feature as it's the implementation of the support for text-based lockfile mentioned previously by @Punie. This seems relevant as Renovate does not seem to be able to handle the binary bun.lockb file as mentioned by @simonknittel which would be the basis for workspace support.

@rarkins rarkins added type:feature Feature (new functionality) and removed type:feature Feature (new functionality) labels Jan 19, 2025
@nicksrandall
Copy link

Is there anything currently blocking this issue from being addressed? I'd be happy to help.

@rarkins
Copy link
Collaborator Author

rarkins commented Feb 13, 2025

I've written most of the logic for this and pushed into this WIP branch: https://github.com/renovatebot/renovate/compare/feat/24459-bun-workspaces-wip?expand=1

@nicksrandall please feel free to take over and submit a PR based on this work

Remaining to be done:

  • Any more manual testing or advanced use cases (e.g. do we care about internal relationships? There is some logic for that in the npm manager)
  • Unit test coverage

I've tested only against the reproduction here: https://github.com/renovate-reproductions/24459b/pulls?q=sort%3Aupdated-desc+is%3Apr+is%3Aopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manager:bun priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)
Projects
None yet
Development

No branches or pull requests