Skip to content

Detect usage of npm or yarn in the project when asking to install more packages #288

@stof

Description

@stof

Currently, Encore always assumes yarn is used to add packages (with inconsistencies when the error does not come from Encore itself, see #57).

This causes confusion for users using npm instead of yarn (see #287).

When starting to work on Encore, yarn was considered superior to npm, because we compared it to version 3. With the version 5 of npm, the difference between both is smaller, so we should try to respect choices of the user.

Here is my proposal:

  • if the project contains a yarn.lock file, display the yarn command to the user
  • if the project contains a packages.lock file, display the npm command to the user
  • otherwise, display the yarn command (following our existing rule where we favor yarn)

The last point may be changed in the future once geowarin/friendly-errors-webpack-plugin#33 gets resolved, to fix #57 (if they display the yarn version only when having a yarn.lock file, we may want to do the same, as running Yarn without lock file is not recommended anyway)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions