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

Support for new bun.lock file #2782

Closed
shiroyasha9 opened this issue Dec 20, 2024 · 6 comments · Fixed by #2801 or expo/eas-build#482
Closed

Support for new bun.lock file #2782

shiroyasha9 opened this issue Dec 20, 2024 · 6 comments · Fixed by #2801 or expo/eas-build#482

Comments

@shiroyasha9
Copy link
Contributor

Build/Submit details page URL

https://expo.dev/accounts/mubin-memorang/projects/new-bun-lock/builds/9bdab95d-e384-4223-b82e-40ed9e6e7ffd

Summary

With Bun v1.1.39, Bun has introduced a new text based lockfile. This really helps our workflow during reviews to see what changed, and is also something that will be the new default with Bun 1.2 (this replaces the binary lockfile bun.lockb).

Right now, if you try to build the app with EAS using the new text based lockfile, EAS detects the project as yarn based, causing it to use yarn and create a lockfile from scratch.

image

This should not be the case, and it should also start detecting the bun.lock file as a bun project.

Managed or bare?

Managed

Environment

expo-env-info 1.2.1 environment info:
System:
OS: macOS 15.2
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.7.3 - ~/.nvm/versions/node/v21.7.3/bin/node
npm: 10.5.0 - ~/.nvm/versions/node/v21.7.3/bin/npm
Watchman: 2024.11.25.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.16.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 24.2, iOS 18.2, macOS 15.2, tvOS 18.2, visionOS 2.2, watchOS 11.2
Android SDK:
API Levels: 34, 35
Build Tools: 33.0.1, 34.0.0, 35.0.0, 35.0.0
System Images: android-34 | Google APIs ARM 64 v8a, android-34 | Google Play ARM 64 v8a
IDEs:
Android Studio: 2024.1 AI-241.18034.62.2411.12071903
Xcode: 16.2/16C5032a - /usr/bin/xcodebuild
npmPackages:
expo: ~52.0.20 => 52.0.21
expo-router: ~4.0.14 => 4.0.14
react: 18.3.1 => 18.3.1
react-dom: 18.3.1 => 18.3.1
react-native: 0.76.5 => 0.76.5
react-native-web: ~0.19.13 => 0.19.13
npmGlobalPackages:
eas-cli: 14.2.0
Expo Workflow: managed

Enabled experimental React Native Directory checks. Unset the EXPO_DOCTOR_ENABLE_DIRECTORY_CHECK environment variable to disable this check.

✔ Check package.json for common issues
✔ Check Expo config for common issues
✔ Check native tooling versions
✔ Check if the project meets version requirements for submission to app stores
✔ Check for common project setup issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for app config fields that may not be synced in a non-CNG project
✔ Check npm/ yarn versions
✔ Check for issues with Metro config
✔ Validate packages against React Native Directory package metadata
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that native modules do not use incompatible support packages
✔ Check for legacy global CLI installed locally
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check that packages match versions required by installed Expo SDK

Didn't find any issues with the project!

Error output

No response

Reproducible demo or steps to reproduce from a blank project

  • Clone https://github.com/shiroyasha9/expo-new-bun-lock (created using bun create expo-app and then migrated to use the new lockfile).
  • Change the projectId and owner in app.json to your credentials.
  • Run any of the build command e.g. eas build --platform ios --profile development-simulator.
@shiroyasha9 shiroyasha9 added the needs review Issue is ready to be reviewed by a maintainer label Dec 20, 2024
@szdziedzic szdziedzic added issue accepted eas build and removed needs review Issue is ready to be reviewed by a maintainer labels Dec 20, 2024
@expo-bot
Copy link
Contributor

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@CodeWithShreyans
Copy link

Same issue here

Sample failed run: https://github.com/CodeWithShreyans/guider/actions/runs/12439445332

@SergioGCarvalho
Copy link

same, using bun 1.1.40

byCedric added a commit to expo/expo that referenced this issue Jan 6, 2025
# Why

Bun v1.1.39 introduced a new text-based lockfile format (bun.lock) as an
alternative to the binary format (bun.lockb). This change adds support
for detecting and using both formats.

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

Similar to: expo/eas-cli#2782 (I am not sure
how EAS resolves the package manager, hopefully through Expo?)

# How

The changes were implemented by:

1. Adding support for both lockfile formats in the package manager
resolution logic:
   - Added `BUN_TEXT_LOCK_FILE` constant for the new 'bun.lock' format
   - Updated `resolvePackageManager` to check for both lockfile formats
- Modified the lockFiles record to support multiple lockfile paths per
package manager

2. Updated documentation:
   - Added new section about text-based lockfile in using-bun.mdx
   - Updated CLI help text to reflect support for both formats
   - Updated EAS build documentation to mention both lockfile formats

3. Added comprehensive test coverage:
   - Tests for text lockfile only
   - Tests for binary lockfile only
   - Tests for both lockfiles present
   - Tests for monorepo workspace scenarios

4. Updated cleanup utilities to handle both lockfile formats:
- Modified `reinstallPackagesAsync` to clean up both `bun.lock` and
`bun.lockb`
   - Updated gitignore to include both lockfile formats

# Test Plan

1. Basic functionality test:

```bash
expo/expo/packages/@expo/cli/build/bin/cli install @supabase/supabase-js
```

- Without changes: Incorrectly picks up npm as the package manager
- With changes: Correctly identifies bun as the package manager when
either `bun.lock` or `bun.lockb` is present

2. Automated tests:
- Added comprehensive test suite in `nodeManagers-test.ts` covering:
  - Package manager resolution with text lockfile
  - Package manager resolution with binary lockfile
  - Package manager resolution with both lockfiles
  - Monorepo workspace scenarios
  - Various lockfile combinations

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
-->

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)

---------

Co-authored-by: Cedric van Putten <[email protected]>
Kudo pushed a commit to expo/expo that referenced this issue Jan 7, 2025
Bun v1.1.39 introduced a new text-based lockfile format (bun.lock) as an
alternative to the binary format (bun.lockb). This change adds support
for detecting and using both formats.

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

Similar to: expo/eas-cli#2782 (I am not sure
how EAS resolves the package manager, hopefully through Expo?)

The changes were implemented by:

1. Adding support for both lockfile formats in the package manager
resolution logic:
   - Added `BUN_TEXT_LOCK_FILE` constant for the new 'bun.lock' format
   - Updated `resolvePackageManager` to check for both lockfile formats
- Modified the lockFiles record to support multiple lockfile paths per
package manager

2. Updated documentation:
   - Added new section about text-based lockfile in using-bun.mdx
   - Updated CLI help text to reflect support for both formats
   - Updated EAS build documentation to mention both lockfile formats

3. Added comprehensive test coverage:
   - Tests for text lockfile only
   - Tests for binary lockfile only
   - Tests for both lockfiles present
   - Tests for monorepo workspace scenarios

4. Updated cleanup utilities to handle both lockfile formats:
- Modified `reinstallPackagesAsync` to clean up both `bun.lock` and
`bun.lockb`
   - Updated gitignore to include both lockfile formats

1. Basic functionality test:

```bash
expo/expo/packages/@expo/cli/build/bin/cli install @supabase/supabase-js
```

- Without changes: Incorrectly picks up npm as the package manager
- With changes: Correctly identifies bun as the package manager when
either `bun.lock` or `bun.lockb` is present

2. Automated tests:
- Added comprehensive test suite in `nodeManagers-test.ts` covering:
  - Package manager resolution with text lockfile
  - Package manager resolution with binary lockfile
  - Package manager resolution with both lockfiles
  - Monorepo workspace scenarios
  - Various lockfile combinations

<!--
Please check the appropriate items below if they apply to your diff.
-->

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)

---------

Co-authored-by: Cedric van Putten <[email protected]>
(cherry picked from commit a96a6fe)
@Kudo Kudo closed this as completed in #2801 Jan 8, 2025
@Kudo Kudo closed this as completed in 5e02807 Jan 8, 2025
Kudo added a commit to expo/eas-build that referenced this issue Jan 8, 2025
…#482)

# Why

fixes expo/eas-cli#2782

# How

- `@expo/[email protected]` supports bun text-based lock file. this pr bumps the version
- replace `findWorkspaceRoot -> resolveWorkspaceRoot` because of breaking change from expo/expo#31124
- as new package-manager uses `node:fs` under the hood. it breaks jest tests, we have to replicate the [changes](expo/expo#31690) here
@Kudo
Copy link
Contributor

Kudo commented Jan 9, 2025

the updated @expo/package-manager is deployed to eas. please give it a try. thanks again to @tharakadesilva for the nice fix

@shiroyasha9
Copy link
Contributor Author

shiroyasha9 commented Jan 14, 2025

Thanks for the quick addition!

It works perfectly fine on EAS cloud builds, but if you try to build using --local flag, it still detects it as a yarn project. 😞

Cloud - https://expo.dev/accounts/mubin-memorang/projects/new-bun-lock/builds/a8f5d20f-20b8-4b20-9430-cbf48ba88103

Local

Image

Is there something extra that needs to be done for that? I have upgraded our app to the latest expo version.

@shiroyasha9
Copy link
Contributor Author

I opened up a PR for this supporting the new lock files on local builds as well - please take a look when you get a chance - #2817

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