Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn update should use install instead of upgrade #26

Closed
krissss opened this issue Apr 10, 2019 · 6 comments
Closed

Yarn update should use install instead of upgrade #26

krissss opened this issue Apr 10, 2019 · 6 comments
Assignees
Labels
Milestone

Comments

@krissss
Copy link

krissss commented Apr 10, 2019

Upgrade will update all packages to lastest version.

Install not.

If I create a project, then I need add a package after few days. upgrade will update all packages, install will only install that package I need. I think install is correct.

@francoispluchino
Copy link
Member

The Yarn install command is used with the Composer install command. Otherwise, with the Composer update command, install command or the upgrade command of Yarn can be used, it depends if the node_modules folder is present (because the upgrade command of Yarn can not update the dependencies if they are not already installed, which is not the case of Composer for example).

You can see the code for:

However, it is possible to replace the commands of Yarn and NPM, so check if this is not the case in your configuration.

@krissss
Copy link
Author

krissss commented Apr 10, 2019

I known that.
But, composer require xx will trigger yarn update --non-interactive if the node_modules folder is present. Is this right?
If right, when I composer require one package (project already installed, and node_modules already exist), yarn will failed use yarn update --non-interactive

@francoispluchino
Copy link
Member

Yes, the Foxy update command is used for the require command of Composer, if the asset dependencies are already installed.

And indeed, the case of Yarn is that if there is a change of the dependencies, we must use the command install and not upgrade, which is not the case for NPM, which still accepts the update command.

@francoispluchino francoispluchino added this to the 1.0.5 milestone Apr 10, 2019
@francoispluchino
Copy link
Member

Small precision, the error Outdated lockfile. Please run 'yarn install' and try again. thrown when the version of a package changes, but not for adding or removing a package, the upgrade command works correctly.

It would be good to check if the folder is synchronized or not, to return the good command. To could help to do this detection, run the yarn check command before and check the command return an error.

@francoispluchino
Copy link
Member

Can you check if this commit fix your bug?

@krissss
Copy link
Author

krissss commented Apr 11, 2019

Fixed.

@krissss krissss closed this as completed Apr 11, 2019
@francoispluchino francoispluchino modified the milestones: 1.0.5, 1.0 May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants