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.44k stars 2.73k forks source link

Yarn install all missed dependencies when just Add a new one #8769

Open kosiakMD opened 2 years ago

kosiakMD commented 2 years ago

Problem:

I'm working on one CLI solution for our ecosystem and I need to install only selected dependencies with adding 1 by 1 or alltogether (yarn add packge1 packge2) npm works as I need, but yarn installs all not-installed dependencies from the package.json when I just add any new dependency

Is there some option to prevent it?

What I have:

yarn -v 1.22.11

package.json:

"dependencies": {
    "apollo-enchanted-cache-inmemory": "^1.2.0", // not installed
    "colors": "^1.4.0"
  },

What I do:

$ yarn add security-holder

What I expect

apollo-enchanted-cache-inmemory is not installed

yarn add v1.22.11
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ security-holder@1.0.1
info All dependencies
└─ security-holder@1.0.1
✨  Done in 2.10s.

What I receive

apollo-enchanted-cache-inmemory is installed

yarn add v1.22.11
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
info Direct dependencies
├─ apollo-enchanted-cache-inmemory@1.2.0
└─ security-holder@1.0.1
info All dependencies
├─ apollo-enchanted-cache-inmemory@1.2.0
└─ security-holder@1.0.1
✨  Done in 2.65s.
Kulakoff1988 commented 2 years ago

I have the same in v1.22.15