@@ -107,6 +107,47 @@ To use pub workspaces, all your workspace packages (but not your dependencies)
107
107
must have an SDK version constraint of `^3.6.0` or higher.
108
108
:: :
109
109
110
+ <a name='stray-files'></a>
111
+ # # Stray files
112
+
113
+ When you migrate an existing monorepo to use Pub workspaces, there will
114
+ be existing "stray" `pubspec.lock` and `.dart_tool/package_config.json` files
115
+ adjacent to each pubspec. These shadow the `pubspec.lock` and
116
+ ` .dart_tool/package_config.json` files placed next to the root.
117
+
118
+ Therefore, `pub get` will delete any `pubspec.lock` and
119
+ ` .dart_tool/package_config.json` located in directories between the root and
120
+ (including) any workspace package.
121
+
122
+ ` ` ` plaintext
123
+ /
124
+ pubspec.yaml # Root
125
+ packages/
126
+ pubspec.lock # Deleted by ` pub get`
127
+ .dart_tool/package_config.json # Deleted by `pub get`
128
+ foo/
129
+ pubspec.yaml # Workspace member
130
+ pubspec.lock # Deleted by `pub get`
131
+ .dart_tool/package_config.json # Deleted by `pub get`
132
+ ```
133
+
134
+ If any directory between the workspace root and a workspace package contains a
135
+ "stray" ` pubspec.yaml ` file that is not member of the workspace, ` pub get ` will
136
+ report an error and fail to resolve. This is because resolving such a ` pubspec.yaml ` would
137
+ create a ` .dart_tool/package_config.json ` file that shadows the one at the root.
138
+
139
+ For example:
140
+
141
+ ``` plaintext
142
+ /
143
+ pubspec.yaml # Root `workspace: ['foo/']`
144
+ packages/
145
+ pubspec.yaml # Not workspace member => error
146
+ foo/
147
+ pubspec.yaml # Workspace member
148
+ ```
149
+
150
+
110
151
## Interdependencies between workspace packages
111
152
112
153
If any of the workspace packages depend on each other, they will automatically
0 commit comments