| 1 |
diff --git a/index.js b/index.js |
| 2 |
index f860af4d2..27c4ce21d 100644 |
| 3 |
--- a/index.js |
| 4 |
+++ b/index.js |
| 5 |
@@ -57,8 +57,18 @@ class PackageGraph extends Map { |
| 6 |
// Yarn decided to ignore https://github.com/npm/npm/pull/15900 and implemented "link:" |
| 7 |
// As they apparently have no intention of being compatible, we have to do it for them. |
| 8 |
// @see https://github.com/yarnpkg/yarn/issues/4212 |
| 9 |
- const spec = graphDependencies[depName].replace(/^link:/, "file:"); |
| 10 |
+ let spec = graphDependencies[depName].replace(/^link:/, "file:"); |
| 11 |
+ |
| 12 |
+ // npa doesn't support the explicit workspace: protocol, supported by |
| 13 |
+ // pnpm and Yarn. |
| 14 |
+ // https://github.com/lerna/lerna/pull/2450 |
| 15 |
+ const explicitWorkspace = /^workspace:/.test(spec); |
| 16 |
+ if (explicitWorkspace) { |
| 17 |
+ spec = spec.replace(/^workspace:/, ""); |
| 18 |
+ } |
| 19 |
+ |
| 20 |
const resolved = npa.resolve(depName, spec, currentNode.location); |
| 21 |
+ resolved.explicitWorkspace = explicitWorkspace; |
| 22 |
|
| 23 |
if (!depNode) { |
| 24 |
// it's an external dependency, store the resolution and bail |