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

Add BunLockfileUpdater #11300

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add BunLockfileUpdater #11300

wants to merge 2 commits into from

Conversation

markhallen
Copy link
Contributor

@markhallen markhallen commented Jan 14, 2025

What are you trying to accomplish?

This PR adds the updater for bun.lock files. A later PR will add support for legacy bun.lockb files.

We are currently limiting fetching the bun files with the experiment bun_updates as an experimental feature.

Anything you want to highlight for special attention from reviewers?

  • Fetching the bun.lock files is currently guarded by Experiments.enabled?(:bun_updates)

For wider context you can check #11209 or #11248

The ultimate plan is to use a new structure for multiple Javascript ecosystems similar to #1862.

This PR was put together before the change in approach. It was decided that we proceed with these PR's as-is.

We will then follow-up with a PR migrating to the new structure. This migration PR will then serve as an example for the migration of the other Javascript ecosystems.

How will you know you've accomplished your goal?

The new specs should pass and the existing specs should be unimpacted.

$ export LOCAL_GITHUB_ACCESS_TOKEN=$(gh auth token)
$ ./bin/docker-dev-shell npm_and_yarn --rebuild
$ ./bin/dry-run.rb npm_and_yarn ArnaudBarre/rds --dep=prettier --updater-options=bun_updates
 => bump prettier from 3.0.3 to 3.4.2

    ± package.json
    ~~~
    --- /tmp/original20250114-11-c8gkdh 2025-01-14 16:39:26.493629737 +0000
    +++ /tmp/updated20250114-11-j5y5pb  2025-01-14 16:39:26.493629737 +0000
    @@ -43,7 +43,7 @@
         "@types/react": "^18.3.11",
         "@types/ws": "^8.5.13",
         "eslint": "^9.17.0",
    -    "prettier": "3.0.3",
    +    "prettier": "3.4.2",
         "typescript": "~5.7"
       }
     }
    ~~~
    2 insertions (+), 2 deletions (-)

    ± bun.lock
    ~~~
    --- /tmp/original20250114-11-tamy7a 2025-01-14 16:39:26.493629737 +0000
    +++ /tmp/updated20250114-11-ok7q4b  2025-01-14 16:39:26.497629737 +0000
    @@ -21,7 +21,7 @@
             "@types/react": "^18.3.11",
             "@types/ws": "^8.5.13",
             "eslint": "^9.17.0",
    -        "prettier": "3.0.3",
    +        "prettier": "3.4.2",
             "typescript": "~5.7",
           },
           "peerDependencies": {
    @@ -412,7 +412,7 @@
     
         "prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
     
    -    "prettier": ["prettier@3.0.3", "", {}, "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg=="],
    +    "prettier": ["prettier@3.4.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ=="],
     
         "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
     
    ~~~
    3 insertions (+), 3 deletions (-)

c/o @Electroid, here is a random sample of repositories using bun.lock that you can try with the dry-run scripts:

./bin/dry-run.rb npm_and_yarn ArnaudBarre/rds --updater-options=bun_updates
./bin/dry-run.rb npm_and_yarn redphx/better-xcloud --updater-options=bun_updates
./bin/dry-run.rb npm_and_yarn stacksjs/qar --updater-options=bun_updates
./bin/dry-run.rb npm_and_yarn devSaifur/keeper --updater-options=bun_updates

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@markhallen markhallen requested a review from a team as a code owner January 14, 2025 15:44
Co-authored-by: Ashcon Partovi <ashcon@partovi.ne>
@markhallen markhallen force-pushed the add-bun-file-update-checker branch from be974c7 to 57a2acf Compare January 14, 2025 15:45
Comment on lines +255 to +256
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/PerceivedComplexity
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for the reviewer:

Normally I would refactor and remove these, but as we plan to swiftly follow up moving Bun to it's own ecosystem this will not be a problem.

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

Successfully merging this pull request may close these issues.

1 participant