yarn install --flat should probably show the reason why a package is required

Created on 29 Mar 2017  ·  3Comments  ·  Source: yarnpkg/yarn

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

Feature

What is the current behavior?

When running yarn install --flat, yarn may ask multiple questions asking to resolve package versions. However, as it goes deeper down the rabbit whole, it may be beneficial to provide the user with more info as to why particular versions are presented as choices.

If the current behavior is a bug, please provide the steps to reproduce.

See dependencies from a current project. Testing-related dependencies are, sadly, outdated, other versions are more or less recent (no more than one week old :) )

Running yarn install --flat with the the deps in the linked file will ask numerous questions for almost every single dependency in the file. A sample:

info Unable to find a suitable version for "inferno", please choose one by typing one of the numbers below:
  1) "[email protected], inferno@^1.4.1, inferno@^1.1.1" which resolved to "1.4.1"
  2) "inferno@^1.5.4" which resolved to "1.5.4"
Answer?

info Unable to find a suitable version for "babel-core", please choose one by typing one of the numbers below:
  1) "[email protected]" which resolved to "6.23.1"
  2) "babel-core@^6.24.0, babel-core@^6.0.0" which resolved to "6.24.0"
Answer?

...etc...

_and_ nested dependencies:

info Unable to find a suitable version for "ansi-styles", please choose one by typing one of the numbers below:
  1) "ansi-styles@^2.2.1" which resolved to "2.2.1"
  2) "ansi-styles@~1.0.0" which resolved to "1.0.0"
  3) "ansi-styles@^3.0.0" which resolved to "3.0.0"
Answer?

info Unable to find a suitable version for "jsesc", please choose one by typing one of the numbers below:
  1) "jsesc@^1.3.0" which resolved to "1.3.0"
  2) "jsesc@~0.5.0" which resolved to "0.5.0"
Answer?

... etc ...

What is the expected behavior?

It would be nice to find out:

  • why these particular versions were selected
  • why these particular nested dependencies are required and why the conflict (a regular install generates 627 directories in node_modules, so there's no way of knowing a particular dependency at a glance)

The best way would probably be having h as an option to Answer? which would detail the whys and the hows

Please mention your node.js, yarn and operating system version.

> node -v
v6.9.1
> yarn -V
0.21.3
> system_profiler SPSoftwareDataType
      System Version: macOS 10.12.3 (16D32)
      Kernel Version: Darwin 16.4.0
cat-feature good first issue help wanted high-priority triaged

Most helpful comment

Marking as high-priority since people are switching over to Yarn from bower which did flat installs. I think this is an important user experience improvement.

All 3 comments

Marking as high-priority since people are switching over to Yarn from bower which did flat installs. I think this is an important user experience improvement.

So... Is this still high-priority?

The problem still exists !

Was this page helpful?
0 / 5 - 0 ratings