Skip to content

Commit

Permalink
wip: fixed bug with bundled workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzy committed Jan 25, 2023
1 parent 1e635a5 commit ea39f75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions workspaces/arborist/lib/arborist/isolated-reifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ module.exports = cls => class IsolatedReifier extends cls {
path: join(proxiedIdealTree.root.localPath, location),
realpath: join(proxiedIdealTree.root.localPath, location),
resolved: node.resolved,
version: pkg.version,
package: pkg,
}
newChild.target = newChild
Expand Down Expand Up @@ -354,6 +355,7 @@ module.exports = cls => class IsolatedReifier extends cls {
return
}
memo.add(key)

let from, nmFolder
if (externalEdge) {
const fromLocation = join('node_modules', '.store', key, 'node_modules', node.name)
Expand All @@ -367,8 +369,9 @@ module.exports = cls => class IsolatedReifier extends cls {
const processDeps = (dep, optional, external) => {
optional = !!optional
external = !!external
const binNames = dep.package.bin && Object.keys(dep.package.bin) || []

const location = join(nmFolder, dep.name)
const binNames = dep.package.bin && Object.keys(dep.package.bin) || []
const toKey = getKey(dep)

let target
Expand All @@ -393,7 +396,7 @@ module.exports = cls => class IsolatedReifier extends cls {
binPaths: [],
isTop: false,
optional,
location: join(nmFolder, dep.name),
location: location,
path: join(dep.root.localPath, nmFolder, dep.name),
realpath: target.path,
name: toKey,
Expand Down Expand Up @@ -434,6 +437,9 @@ module.exports = cls => class IsolatedReifier extends cls {
}

processEdges(proxiedIdealTree, false)
for (const node of proxiedIdealTree.workspaces) {
processEdges(node, false)
}
root.children.forEach(c => c.parent = root)
root.children.forEach(c => c.root = root)
root.root = root
Expand Down
4 changes: 2 additions & 2 deletions workspaces/arborist/lib/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ module.exports = cls => class Reifier extends cls {
if (registryResolved) {
res = `${node.name}@${registryResolved}`
}
} else if (node.packageName && node.version) {
res = `${node.packageName}@${node.version}`
} else if (node.package.name && node.version) {
res = `${node.package.name}@${node.version}`
}

// no idea what this thing is. remove it from the tree.
Expand Down

0 comments on commit ea39f75

Please sign in to comment.