-
Notifications
You must be signed in to change notification settings - Fork 215
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
request: pub workspaces #747
Comments
It is indeed planned, thanks for opening an issue so that we can track it! |
Related: dart-lang/pub#4376 |
Related (globbing in workspace definition, which would make future migrations easier): dart-lang/pub#4391 |
I can see how globs are nice to have for this use case, but I wouldn't consider it a blocker. I'd love to use melos + workspaces sooner rather than waiting for this that isn't even such a big inconvenience. |
@Leptopoda I agree, it's not a blocker, possibly we could even write a simple migration script for it. |
Do Melos and Pub workspaces work together right now? Has anybody gotten a repo migrated by hand? A few weeks back I took a stab at migrating a repo and couldn't get everything to work. I cannot remember for sure, but I think my blocker ultimately was the Flutter toolchain not handling Pub workspaces, though believe some Melos commands were confused by the dep overrides being elsewhere. Is there a sense of what needs to be done for Melos and Pub workspaces to coexist? |
@xaethos it shouldn't be a problem for them to co-exist already afaik. With the workspaces we can simplify a lot of our code in Melos and remove the packages config from melos.yaml though, and that needs some work. |
What I have done so far:
Et voilà. The current stable flutter version is broken for workspaces and last time I checked master it was also not working. I found |
finally workspace is released to stable version 3.27: |
I hope
|
Yeah, that's true. We should keep bootstrap, but as an optional step. I'm pretty busy currently, so if there is anyone else that would like to be assigned to this issue, give me a ping! |
If anyone is looking for a working example of a migration, I've got this PR: lishaduck/legacy_checks#38. |
“melos bootstrap” command cannot be executed by you, right? (“melos bootstrap” command creates a ‘pubspec_overrides.yaml’ file for each module. Because of this, pub workspaces do not function properly) |
Right. You call |
Thanks @lishaduck but I used the 'melos bootstrap' command because it also generates *.iml files specific to modules in IntelliJ. Additionally, when I run build_runner in the root directory, it still doesn't detect the modules - I need to go to the relevant module directory and run build_runner there. Hopefully this will be resolved soon.. |
Yeah, I use VS Code, which doesn't need them. What'd I'd probably do is run bootstrap, run
I'd think that's the expected behavior? Just make a melos task to run it all concurrently. |
Actually, I already have the melos run command as shown below, but due to bootstrap pub workspaces, this command cannot be executed, so it doesn't apply to all modules. I'm in a dilemma in such a situation :) gen:all:
name: gen
description: Generate all files
run: "dart run build_runner build -d --low-resources-mode"
packageFilters:
dependsOn:
- "build_runner"
exec:
concurrency: 4
failFast: true |
What's the error? (I haven't migrated my |
Problem: Due to the issue mentioned here, Melos does not recognize my modules, so I cannot run my Melos scripts for my modules. |
Can you just copy+paste the error message? That message doesn't provide an error nor does it mention Melos failing to recognize modules. |
Melos needs to recognize the modules, which requires running the |
I don't think so... it just uses a glob in the melos.yaml, right? |
Correct, there is no caching of the package list when bootstrapping. |
@lishaduck @spydon You are right; I noticed the issue was different. After enabling pub workspaces, I removed the build_runner dependency from the modules because it is sufficient to use it only in the root workspace. I realized that the gen:all script doesn’t recognize the modules because it depends on build_runner.. |
The PR to migrate Melos to Pub Workspaces is now out, feel free to review it! (#816) Tomorrow I'll create a pre-release so that you can try it out in your projects. |
I just published Melos v7.0.0-dev.1 enabling the Pub Workspaces feature, please try it out so that we can iron out any potential problems! 🙂 |
If you want to add find . -type f -name "pubspec.yaml" -exec sed -i '/^name:/a resolution: workspace' {} + and to get all your find . -name "pubspec.yaml" -exec dirname {} + | sed 's|^\./||' Remember that the |
If anyone is curious how a migration might look like, this is what it looked like for the Flame monorepo: |
Oh, and in case anyone is using |
<!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Description Since we now declare the packages in the `workspace` section in the `pubspec.yaml` file we'll move the rest of the config in there too, under it's own `melos` section. This is common practice for other dart tools too and the Dart team knows about it. Continues on the #747 effort. ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [x] ✨ `feat` -- New feature (non-breaking change which adds functionality) - [ ] 🛠️ `fix` -- Bug fix (non-breaking change which fixes an issue) - [x] ❌ `!` -- Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 `refactor` -- Code refactor - [ ] ✅ `ci` -- Build configuration change - [ ] 📝 `docs` -- Documentation - [ ] 🗑️ `chore` -- Chore
@lishaduck there was a release for |
I haven't tested it, but it shouldn't've fixed it. He bumped |
I'll keep this issue open until we have released 7.0.0 to stable. Do note that if you have |
Probably not related directly with melos but until Pub workspaces were introduced we used melos even in projects which are not monorepos. Why? Because every project has several "standartized" melos scripts such as setup, codegen.... However after Melos is migrated to support pub workspaces and removed melos.yaml we cant do that anymore as # Main pubpsec.yaml
workspace:
- .
.....
melos:
scripts:
....
Executing
EDIT: Of course we can solve it by restructuring project into "monorepo" |
Yeah, I think that is the only way currently with pub workspaces. |
@spydon Not sure (again) if I should create new issue for this. After we migrated single app project to newer melos (see previous comment) we cant run melos command inside "app" folder. Melos needs to be executed in root folder, where workspace pubspec.yaml is defined along with pubspec.lock. Otherwise melos looks for pubspec.lock inside app folder.
If I run melos run inside app folder I am getting
|
@petrnymsa hmm, I can't reproduce this. |
Hmm me neither in sandbox project. We are using FVM as well, maybe something is off there |
@petrnymsa what about if you add FVM to the MRE, is it reproducible then? |
@spydon unfortunately no, will let you know If I find a way to reproduce it |
@spydon Got it. During migration, we forgot melos inside dev_dependcies in app/pubspec.yaml. After removal, everything works. |
I got 7.0.0-dev.4 working. What work needs to be done before going stable? |
The shared dependencies feature needs some love, because if you set dependencies that don't work in there you won't be able to run it again to fix it, so it needs some kind of rollback feature. Other than that everything looks good so far! |
Thanks Lukes. Is there already a ticket for the required love?
From: Lukas Klingsbo ***@***.***>
Date: Wednesday, 22 January 2025 at 09:40
To: invertase/melos ***@***.***>
Cc: Mark Beij ***@***.***>, Manual ***@***.***>
Subject: Re: [invertase/melos] request: pub workspaces (Issue #747)
I got 7.0.0-dev.4<https://pub.dev/packages/melos/versions/7.0.0-dev.4> working. What work needs to be done before going stable?
The shared dependencies feature needs some love, because if you set dependencies that don't work in there you won't be able to run it again to fix it, so it needs some kind of rollback feature.
Other than that everything looks good so far!
—
Reply to this email directly, view it on GitHub<#747 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AE24VANDEZUV5M46EO6K6ID2L6NUHAVCNFSM6AAAAABMFFNAPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBXGI3TQOBZGU>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
7.0.0-dev.5 is now out and it has the shared dependencies rollback feature included. |
Is there an existing feature request for this?
Command
No response
Description
Once Pub Workspaces land in stable, it would be great if Melos replaced
dependency_overrides
generation in favor of Pub Workspaces.I believe this is planned, but I didn't see an issue.
Reasoning
Pub Workspaces enable a single analyzer scope, which both improves performance and reduces the maintenance burden on the Melos team.
Additional context and comments
Thanks for melos! It works great!
The text was updated successfully, but these errors were encountered: