-
Notifications
You must be signed in to change notification settings - Fork 62
Isaacs/reify add to workspaces #258
Conversation
This causes major problems when moving links and targets between trees. When we move the link from one tree to another, it pulls its target, out, meaning that the target ends up becoming orphaned. Say there is a matching link and target in two different trees, A and B, and we want to replace the link and target in one tree with the link and target in another. If we move the target A to tree B first, then it replaces the target B, and link B is updated to point to it. Then, we move link A to tree B, replacing link B. To do that, we move link B out of tree B, which _takes target B with it_, leaving the ported link A without a target in tree B.
This also corrects an issue where manually updating the package.json file would sometimes not be reified properly, if a new link target matches the one that was formerly reified.
Fixes sorting incorrectly when a dependency is set to an empty string
This is in preparation for the use case where explicitRequests includes edges from nodes other than the project root, so that we can add deps to workspaces.
This is really important for debugging when "have workspaces been loaded yet" is a relevant consideration.
nlf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoulder surfed while this was being done, changes make sense, a couple of super super tiny nits but functionally i think this is what we want 👍
| // used by Reify mixin | ||
| const _force = Symbol.for('force') | ||
| const _explicitRequests = Symbol.for('explicitRequests') | ||
| const _explicitRequests = Symbol('explicitRequests') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
total nit, but it probably makes sense to move this up to the private symbols above since it's no longer "used by Reify mixin"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point.
| const _getBundlesByDepth = Symbol('getBundlesByDepth') | ||
| const _registryResolved = Symbol('registryResolved') | ||
| const _addNodeToTrashList = Symbol('addNodeToTrashList') | ||
| const _workspaces = Symbol.for('workspaces') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, nit, but this should be below in the "defined by Ideal mixin"
|
checked on the one test failure, it was a socket timeout in the mock registry server which is.. interesting, but nothing of concern. |
|
Will this require us to pass in all workspaces if we want all workspaces acted on? The cli treats an empty array as "all workspaces" currently. I would say no, and hope that once we are crossing the line here to another module it should be very explicit, but just wanted to make sure we're all on the same page here. |
|
i feel like we should require passing in all of the workspaces by name to arborist, let the cli do that resolution since it needs to do it for other commands anyway. better to have that code live in one place imo |
|
The way you tell Arborist to act on all workspaces is you give it an array with the name of all the workspaces in it. If you don't provide a |
Support
arborist.buildIdealTree({ add: [pkg], workspaces: ['list', 'of', 'names'] })to add dependencies to the workspaces, instead of to the root project.Also fixes the bug where
npm lsreports workspace links as extraneous, even though they are clearly not extraneous.Based on #257, land that first.