Skip to content

[CP] Pub delete stray package configs in directories between the package root and workspace packages #59650

@sigurdm

Description

@sigurdm

Commit(s) to merge

dart-lang/pub#4446
Rolled into main in: https://dart-review.googlesource.com/c/sdk/+/398400

Target

stable

Prepared changelist for beta/stable

https://dart-review.googlesource.com/c/sdk/+/399906

Issue Description

When migrating a monorepo to use pub workspaces one might have old .dart_tool/package_config.json files in directories between the workspace root and the workspace packages.

These will be picked up by the vm and analyzer, resulting in obscore error messages. This is hard to debug, as .dart_tool usually is hidden and gitignored. (see flutter/devtools#8211)

What is the fix

Delete the stray package_config files after resolution.

pubspec.lock files are also deleted.

If pubspec.yaml files are present in such directories, the resolution fails with an error message.

Why cherry-pick

pub workspaces are officially launching in 3.6, making that the point where users migrate to workspaces, and therefore the highest risk period for confusions like described above.

Risk

medium-low.

Issue link(s)

dart-lang/pub#4445

Extra Info

No response

Metadata

Metadata

Labels

area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.cherry-pick-approvedLabel for approved cherrypick requestcherry-pick-reviewIssue that need cherry pick triage to approvedart-cli-pubIssues related to the 'dart pub' tool

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions