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

fix: melos does not work in combination with Dart workspace #801

Closed
1 task done
DelcoigneYves opened this issue Dec 12, 2024 · 3 comments
Closed
1 task done

fix: melos does not work in combination with Dart workspace #801

DelcoigneYves opened this issue Dec 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@DelcoigneYves
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Version

6.2.0

Description

With release 3.27.0 of Flutter and the Dart 3.6.0 release, support was added for Dart workspaces.

This speeds up the analyzer, and keeps all dependency resolutions in a single place (the root of the repo).

For our large projects, we are dividing our apps in subpackages, and manage the shared dependencies through melos, as well add some custom scripts to the melos.yaml file.

When adding a Dart workspace to our repository, melos bootstrap fails with the following error:

Cannot override workspace packages.
Package `app_health` at `../../../packages/core/app_health` is overridden in `../../../packages/providers/api/pubspec.yaml`.
Failed to update packages.

I believe this error is due to this particular part in the workspaces documentation: we can only override a package once in a workspace. But, since melos creates a pubspec_overrides.yaml file for each subpackage, subpackages can be overridden multiple times.

Ideally, we could add a parameter to the melos.yaml file to configure where the pubspec_overrides should be created: for each package found, or only on the root level (or maybe even that is not needed, and we can just skip this step altogether).

Steps to reproduce

  1. Install and use Flutter 3.27.0
  2. Create a new monorepo with some subpackages depending on each other. It's important at least two subpackages depend on the same third subpackage.
  3. Configure a Dart workspace in the repo.
  4. Add melos to the repo.
  5. Run dart pub get
  6. Run melos bootstrap

Expected behavior

melos bootstrap should work together with Dart workspaces.

Screenshots

No response

Additional context and comments

No response

@DelcoigneYves DelcoigneYves added the bug Something isn't working label Dec 12, 2024
@spydon
Copy link
Collaborator

spydon commented Dec 12, 2024

Duplicate of #747

@spydon spydon marked this as a duplicate of #747 Dec 12, 2024
@spydon spydon closed this as completed Dec 12, 2024
@spydon
Copy link
Collaborator

spydon commented Dec 12, 2024

If you don't have any specific things in your bootstrap step I think you could just skip it and the rest of the melos commands should work.

@DelcoigneYves
Copy link
Author

Looked over it, apologies for the confusion! Indeed when trying again now, it seems to work, must have been a caching issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants