Open jakemac53 opened 2 months ago
Hmm... we removed all support for .packages, including cleanup some versions ago. Maybe we should reinstate the cleanup...
Not sure this has anything to do with workspaces. Either we clean .packages or we don't. Updating title
Not sure this has anything to do with workspaces. Either we clean .packages or we don't. Updating title
It matters in the context of workspaces because when you migrate to them you get broken by the leftover .packages
files which now take priority.
No - leftover .packages anywhere in your project - workspaces or not - will confuse tools that still recognize them.
I think it is rather rare that you migrate from such an old dart sdk that it creates .packages files, and at the same time add workspaces.
That said, I'm not against the idea - I see no reason old .packages files should stay around.
No - leftover .packages anywhere in your project - workspaces or not - will confuse tools that still recognize them.
The canonical logic (as implemented in package:package_config) will always prefer a .dart_tool/package_config.json
file if one exists next to a .packages
file. This was very intentionally designed such that the world wouldn't break during the transition.
In my case my .packages
files were >2 years old. They just never caused an issue and being hidden files I never noticed them.
(although, fwiw I did file an issue on package:package_config to stop looking for .packages
files by default because I do think that is a bug that it still does respect them)
files by default because I do think that is a bug that it still does respect them
Yeah, I agree!
Yeah, I agree!
Feel free to voice your support on https://github.com/dart-lang/package_config/issues/158 haha.
Related to https://github.com/dart-lang/package_config/issues/158
I recently ran into an issue when trying the new formatter in a workspace repo. All packages were being parsed with language version 2.7, which was highly confusing. It turns out, there were old
.packages
files in all the sub-packages, which no longer had a.dart_tool/package_config.json
file (it was now one directory up). The presence of these.packages
files alone caused a fallback behavior where every package is set to language version 2.7, and they fail to parse new syntax.I think we should both fix the issue in package_config (so it doesn't support these files at all), as well as have pub clean up any old
.packages
files it finds - at least when it goes through deleting the.dart_tool/package_config.json
files, but maybe just more generally.