yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.4k stars 2.72k forks source link

yarn install in a workspace should not install all workspaces dependencies #7453

Open bannier opened 5 years ago

bannier commented 5 years ago

Do you want to request a feature or report a bug? Bug

Current behavior

/package.json

{
  "private": true,
  "workspaces": ["workspace-a", "workspace-b"]
}

/workspace-a/package.json

{
  "name": "workspace-a",
  "version": "1.0.0"
}

/workspace-b/package.json

{
  "name": "workspace-b",
  "version": "1.0.0",
  "dependencies": {
    "cowsay": "^1.4.0"
  }
}

then

cd workspace-a
yarn

installs cowsay in /node_modules

.
├── node_modules
│   ├── cowsay
│   ├── ...
│   ├── workspace-a -> ../workspace-a
│   └── workspace-b -> ../workspace-b
├── package.json
├── workspace-a
│   └── package.json
├── workspace-b
│   ├── node_modules
│   └── package.json
└── yarn.lock

Expected behavior yarn install in workspace-a should not install cowsay in node_modules since it doesn't belong to workspace-a dependencies

Versions yarn 1.17.3 node v11.13.0 Ubuntu 18.04.2 LTS

rigwild commented 4 years ago

Bumping this issue up. Seems like it hasn't been noticed.