Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
workspaces wip: cleaning up notes/todos
Browse files Browse the repository at this point in the history
  • Loading branch information
ruyadorno committed Apr 28, 2020
1 parent d11a86a commit 71d88a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
7 changes: 0 additions & 7 deletions lib/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,9 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl
.then(root => this[_global] ? root
: this[_updateAll] ? Shrinkwrap.reset({ path: this.path })
.then(meta => Object.assign(root, {meta}))
// TODO: after load virtual we need to reload the mapWorkspaces
: this.loadVirtual({ root }))

// TODO: workspaces part2: create the edges in between workspace deps
.then(tree => this[_mapWorkspaces](tree))
// TODO: maybe only load/map workspaces here instead of _rootNodeFromPackage ?
// we're going to do it here again regardless in order to support overriding
// workspaces saved in a virtual tree
.then(tree => {
// null the virtual tree, because we're about to hack away at it
// if you want another one, load another copy.
Expand Down Expand Up @@ -614,7 +609,6 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl
[_linkFromSpec] (name, spec, parent, edge) {
const realpath = spec.fetchSpec
const { legacyPeerDeps } = this
// TODO: if theres a workspace then put a workspace on it in order to support nested workspaces
return rpj(realpath + '/package.json').catch(() => ({})).then(pkg => {
const link = new Link({ name, parent, realpath, pkg, legacyPeerDeps })
this[_linkNodes].add(link)
Expand Down Expand Up @@ -829,7 +823,6 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl
peerEntryEdge && peerEntryEdge.from === target
)

// TODO: maybe don't hoist workspace dependencies by default?
const entryEdge = peerEntryEdge || edge

// has child by that name already
Expand Down
13 changes: 5 additions & 8 deletions notes/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,17 @@ NOTE:
2. include workspaces map into package-lock files
3. loadVirtual reads from the lock file and put nodes in the right place

### Load Actual

1. How to represent workspaces relationship in the lockfiles?
2. Insert workspace nodes

### Reify

1. Correctly symlink workspaces to its dependants `node_modules`

## Open Ended Questions

- Is there any meaningful difference for running `npm install <spec>` vs `npm install` ?
- Anything needed for `npm update` ?
- Maybe do not hoist workspace dependencies by default?

## Missing build ideal tree tests
## Missing:
- Nested workspaces
- Relationship between `file:` deps and workspaces
- Add support to `mapWorkspaces` in buildIdealTree `_linkFromSpec`
- Tests
- Test case with a mixed relationship between `file:` deps and workspaces

0 comments on commit 71d88a3

Please sign in to comment.