Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DaniGuardiola
Copy link
Member

@DaniGuardiola DaniGuardiola commented Jan 8, 2025

Just experimenting with Bun to see what's possible. This removes lerna as it's no longer necessary.

Tested:

  • all affected scripts (build, test, test-browser, clean, coverage, generate-images, etc)
  • most untouched scripts, but run with bun instead of npm (e.g. bun lint-fix
  • main ci tasks
  • plus ci
  • husky

Untested:

  • changeset script
  • reactnext ci
  • release ci
  • test-vo ci
  • vercel build
  • codesandbox?

To do still:

  • package patching
  • @wordpress/components thing
  • complete testing
  • update docs (contribution, etc)
  • double-check everything

Future ideas:

  • Replace vitest with bun test

@changeset-bot
Copy link

changeset-bot bot commented Jan 8, 2025

⚠️ No Changeset found

Latest commit: a5a0914

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@DaniGuardiola DaniGuardiola marked this pull request as draft January 8, 2025 22:24
@diegohaz
Copy link
Member

A global override might work too. If we add more packages that depend on Ariakit, we'll probably want to do the same for them.

@DaniGuardiola
Copy link
Member Author

Also, there's an error at the end of the website build, but since the site appears to build correctly, I'm unsure what it means

Code 0 means success, there's no error. It's just a log by Bun, probably because of the use of --filter to target the website worspace. A "meta-log" from the task runner, essentially.

@diegohaz
Copy link
Member

Also, there's an error at the end of the website build, but since the site appears to build correctly, I'm unsure what it means

Code 0 means success, there's no error. It's just a log by Bun, probably because of the use of --filter to target the website worspace. A "meta-log" from the task runner, essentially.

Yes, it was just strange that it was reported as an error:

Screenshot of Vercel logs with error saying, "website build: Exited with code 0"

@DaniGuardiola
Copy link
Member Author

DaniGuardiola commented Jan 10, 2025

Right, I guess it is being outputed to stderr. Weird thing is I don't see it locally. Well, if it works, I guess it's fine.

Re:override, can you think of a small change I can make in the source to produce a test error for the wp package? The goal is to have a way to verify that it's being run with the local version and not one from npm.

I have a theory that it might not be necessary at all, because it should already be using the workspace: protocol and the npm version isn't even installed Nvm just realized it should be getting installed along with wp components. Either way, it'll be helpful to have a way to verify it.

@DaniGuardiola
Copy link
Member Author

Doesn't look like the Codesandbox CI supports Bun at all (inferred from what I've seen in the docs, there's no way to install it). Might be better to just remove it. The stackblitz alternative depends on your own CI so it should be much easier to use. Maybe I'll try to get that done in a separate PR before merging this one.

@DaniGuardiola
Copy link
Member Author

Huh, did you delete your last comment with the trick to make tests fail? @diegohaz

I reloaded the issue and it's gone now.

@DaniGuardiola
Copy link
Member Author

Good news, seems like the override is entirely unnecessary. I used your trick to test. I'm gonna wait for CI to pass and then push a commit with the trick to verify that CI behavior is the same. But I think we're in the clear with that.

Remaining:

  • patch-package thing
  • CodeSandbox (maybe we just remove it here?)
  • test the untested stuff

@diegohaz
Copy link
Member

diegohaz commented Jan 10, 2025

Huh, did you delete your last comment with the trick to make tests fail? @diegohaz

I reloaded the issue and it's gone now.

Sorry, that information wasn't accurate.

If @wordpress/components relies on the same version as the local package, npm seems to automatically resolve it to the local package. The issue arises when there's a version mismatch. In that case, the remote npm package will be installed inside node_modules/@wordpress/components/node_modules.

This should make npm run test-chrome wordpress fail some tests. But I'm not sure how to manually trigger this while making overrides work simultaneously to verify if overrides are working.

If this is correct, it will become a problem if Ariakit 0.5.0 is released and @wordpress/components still depends on ^0.4.15.

@DaniGuardiola
Copy link
Member Author

Could it be replicated if I manually set the local version to 0.5 temporarily?

@diegohaz
Copy link
Member

I think it's easier if you install a version of @wordpress/components that depend on ariakit@^0.3 instead like @wordpress/[email protected]. I couldn't reproduce it consistently, though.

@DaniGuardiola
Copy link
Member Author

DaniGuardiola commented Jan 10, 2025

FWIW, I tweaked the package.json and ran bun i:

image

The trick still causes it to fail. Not sure if that's enough to verify but it seems like a good sign.

@DaniGuardiola
Copy link
Member Author

I'll leave figuring this out to you if you don't mind. I'm not aware of all the constrains here.

@DaniGuardiola
Copy link
Member Author

This in the bun.lock file is a bit sus:

image

@diegohaz
Copy link
Member

Here's how you can check if overrides is working using npm:

  1. Install @wordpress/[email protected] (which depends on @ariakit/react@^0.3):

    npm i @wordpress/[email protected]
  2. Verify whether the nested dependency has been overridden:

    test -e node_modules/@wordpress/components/node_modules/@ariakit/react/package.json && echo "duplicate dependency" || echo "hoisted dependency"

    If it outputs hoisted dependency, the overrides are working.

You can remove the overrides option and repeat the steps. It should output duplicate dependency.

@DaniGuardiola
Copy link
Member Author

DaniGuardiola commented Feb 8, 2025

Seems like patch-package works as it is. I've also read that the Bun patching implementation is a bit buggy still so we can just migrate in the future.

Update: migrated anyway, seems to work fine.

@DaniGuardiola
Copy link
Member Author

Blocked by oven-sh/bun#17192

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.

3 participants