-
Notifications
You must be signed in to change notification settings - Fork 226
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
Pub workspaces: "pub deps" returns information for the whole workspace and not the current package #4330
Comments
I was not aware vscode depended on this. I thought it would be practical to show dependencies for each package in the workspace. The thing is that there is a single resolution covering all the workspace. Wondering what's the best path forward. Do we change this behavior going forward? Or add more information Can you detail more exactly what information VS code needs, and how it is used? I guess the biggest issue is the json output - maybe we can add to each dependency information about which package has it as direct dependency... Or what the "current" package is... |
We use it to render a tree of dependencies for each package in the workspace, broken down by direct/dev/transitive (and in the tooltip we'll show the shortest path to a dependency for transitive dependencies): I don't think anything should change here for workspaces, I think we want things to just work the same. Ideally, we'd still be able to just run a command for a single project and get back its data (because that way we don't need to teach more code about how workspaces work - we used this command instead of looking in Would it be possible to get the same info (in the same format) as before? If the default behaviour changes, I could pass different flags - but I'd prefer not to have to change this code to be workspace-aware if possible (IMO the less Dart-Code knows about package resolution, the better, because it has to work across many SDK versions and these kinds of things can change). |
Problem is that things have already changed in dart 3.5 - I think it is too late to revert this behavior. Also it is not clear what it means to only report deps for a single package in a workspace. As there will be shared dependencies across the shared dependencies. If we did #3795 this information would be available directly in package_config.json |
Are workspaces being advertised as ready for users in 3.5? If not, the impact of it changing here may be small. Could we have something back for 3.6? It's fine if it requires another flag or something if you don't want to change the default, but right now I don't think I can get the information I had before.
I'm not sure I understand why this changes anything (at least for what I'm using this for). My project still has a pubspec that defines dependencies and dev_depenencies. Which versions they get is now influenced by something external (the root workspace), but all of the information that applied before applies now - my project has a set of dependencies I might want to browse separately from all of the dependencies from the whole workspace.
Part of the reason for Dart-Code using this command was to protect us from changes to Although, it's not clear if you're noting this because you're suggesting I use it, or that |
package_config is documented here: https://github.com/dart-lang/language/blob/main/accepted/2.8/language-versioning/package-config-file-v2.md and should hopefully only add more information moving forward. You should be able to get the information by combining But we might still want to backtrack here, it is not clear that To me it seems slightly confusing that the output of @jonasfj might have something to add... |
I think workspace info could be useful, but I don't think that negates that it's useful to know about the deps of just this package. I'm not too concerned about the default behaviour so if using a flag to get the info for the current package seems best (or even a different command), that's fine by me. |
Any new thoughts on the above? I wonder if I should do something (for example disable the dependencies tree in workspaces) until it's clearer what the solution here will be. |
I think if each package provides a separate list of dependencies vs. dev-dependencies, then vscode could build a tree (maybe rather a forrest rooted in each workspace package) by following the For compatibility with older sdks, vscode would have to look at the |
Flutter also need to distinguish which are the real dependencies of a package (instead of take everything from the package_config): Currently the whole package_config is used to find the plugins: https://github.com/flutter/flutter/blob/2528fa95eb3f8e107b7e28651a61305d960eef85/packages/flutter_tools/lib/src/flutter_plugins.dart#L91 (within a workspace it's incorrect) |
Environment
Dart SDK version: 3.6.0-edge.0b965a1ac8370935ccefa7ca11076b79a2a73037 (main) (Mon Jul 22 08:59:36 2024 +0000) on "windows_x64"
Problem
Running
dart pub deps
in a project that's part of a pub workspace seems to just return the full information for the whole workspace and not only the dependencies for the current project.Expected behavior
Only information for the current projects dependencies should be returned, the same as if it wasn't part of a workspace.
Actual behavior
All dependencies from the workspace are returned.
VS Code uses this output for the dependencies tree, and it filters things based on the
kind
from the json output. However this seems to be quite incorrect for a Pub workspace, so the projects show some random set of dependencies instead of the actual dependencies.The text was updated successfully, but these errors were encountered: