Skip to content

Commit 2d802e9

Browse files
bdwainbestander
authored andcommitted
Isolated Workspaces Updates (#91)
1 parent fff8159 commit 2d802e9

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

accepted/0000-isolated-workspaces.md

+7-21
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ relevant yarn commands should be able to be run with an `--isolated` flag.
3232

3333
Relevant commands (based on current functionality) include
3434
- install
35+
- add
3536
- upgrade
3637
- upgrade-interactive
3738
- outdated
@@ -46,37 +47,30 @@ If you run a command with the isolated flag and are in a workspaceDir, it will r
4647

4748
If you run a command with the isolated flag but you are at the rootDir (or any other directory not underneath a workspaceDir), it will give an error saying that the isolated flag can only be used inside an individual workspace.
4849

49-
## Command behavior
50+
## Command behavior with isolated flag
5051
### install
51-
#### With isolated flag
5252
Install only that package's dependencies, and do not hoist them to the rootDir. Install dependencies on other
5353
workspaces from registry instead of using the local version.
5454

5555
It should still use the rootDir's lockfile since adding lockfiles for each workspace will cause conflicts
5656
across workspaces. Since other workspaces will not be in the lockfile, it should determine their versions as if it was
5757
installing without a lockfile (by taking the newest version that matches their semver).
5858

59-
#### Changes to current (non-isolated) behavior
60-
If a dependency was previously installed in a workspaceDir (from an isolated installation) and will be hoisted, delete it from the workspaceDir. This should not be a breaking change since the end result would be the same as if the isolated flag did not exist or if you were installing from scratch.
59+
Since install will not take into account other workspaces, it would change the lockfile if allowed to. To avoid this, it should prevent lockfile changes as if `--pure-lockfile` was passed. This behavior should be documented clearly with the option.
60+
61+
### add
62+
Add the dependency to the workspace's package.json and add update yarn.lock (at the root) to take this new dependency into account. Install the dependency (and any new transitive dependencies) in the workspace's node_modules folder.
6163

6264
### upgrade
63-
#### With isolated flag
6465
Upgrade all dependencies of the workspace in the root yarn.lock, respecting semvers of the current workspace and also
6566
every other workspaces. Install all dependencies for the current workspace in its node_modules, not hoisting anything
66-
to the root. Take the latest matching versions from the registry for all dependencies on other workspaces.
67-
68-
#### Changes to current behavior.
69-
Deleting modules installed at an individual workspaceDir if they are going to be hoisted (similar to changes for `install`).
67+
to the root. Take the latest matching versions from the registry for all dependencies on other workspaces. Do not install dependencies for other workspaces that are not needed for the current one.
7068

7169
### upgrade-interactive
72-
#### With isolated flag
7370
Interactive version of an isolated upgrade. Bring up the interactive prompt, only showing the workspace's dependencies.
7471
Record upgrades in the root yarn.lock. Install all dependencies for the current workspace in its node_modules, not hoisting anything
7572
to the root. Take the latest matching versions from the registry for all dependencies on other workspaces.
7673

77-
#### Changes to current behavior.
78-
None except the changes to `upgrade`. Still just an interactive version of `upgrade`.
79-
8074
### outdated
8175
#### With isolated flag
8276
Should show the list of packages that upgrade-interactive would show with isolated flag.
@@ -85,20 +79,12 @@ Should show the list of packages that upgrade-interactive would show with isolat
8579
None.
8680

8781
### check
88-
#### With isolated flag
8982
Verify the workspace's package.json against the root yarn.lock file. Use the workspace node_modules (not hoisted) when looking
9083
at actual package contents.
9184

92-
#### Changes to current behavior.
93-
None.
94-
9585
### list
96-
#### With isolated flag
9786
List only dependencies needed by the current workspace.
9887

99-
#### Changes to current behavior.
100-
None.
101-
10288
# How We Teach This
10389

10490
*What names and terminology work best for these concepts and why?*

0 commit comments

Comments
 (0)