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

[PR #5829/4c4ef80c backport][stable-6] yarn: Fix state=latest not working with global=true #5992

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Feb 13, 2023

This is a backport of PR #5829 as merged into main (4c4ef80).

SUMMARY

Fixes #5712.

  • Updates _exec to support running Yarn commands that wouldn't ordinarily be available with yarn global by setting the working directory to the path from yarn global dir instead.
  • Updates list_outdated to use this new functionality when invoking yarn outdated.
  • Updates list_outdated to check for actual errors in stderr output instead of failing on the presence of anything in stderr. This is b/c the Yarn global package.json has no license field, causing a warning to be logged to stderr when invoking yarn outdated in that directory.

Through testing, found a couple more related bugs to fix (see comments below):

  • Replaces the hardcoded DEFAULT_GLOBAL_INSTALLATION_PATH with code to check the output of yarn global dir, as the default path may be different when the use is root, or when the user has set YARN_GLOBAL_FOLDER or the corresponding config flag.
  • Updates list to function correctly for packages without binaries (regular libraries) when global=true by invoking yarn list without global, the same way I did for yarn outdated above.

And finally, added tests for all the above cases. Previously, there were no tests for global=true at all.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

yarn

ADDITIONAL INFORMATION

Before:

image

After:

image

* Yarn module: fix state=latest not working with global=true

* fix whitespace

* add changelog fragment

* add integration test cases

* add only tests for this PR (install+upgrade)

* fix assuming default global dir

* fix list() not working when global=true and name a package with no binary

* remove ignores

* whitespace

* Update changelogs/fragments/5829-fix-yarn-global.yml

Co-authored-by: Felix Fontein <[email protected]>

* Update changelogs/fragments/5829-fix-yarn-global.yml

Co-authored-by: Alexei Znamensky <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Alexei Znamensky <[email protected]>
(cherry picked from commit 4c4ef80)
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added backport bug This issue/PR relates to a bug integration tests/integration language module module new_contributor Help guide this first time contributor packaging plugins plugin (any type) tests tests labels Feb 13, 2023
@felixfontein felixfontein merged commit 4f71c93 into stable-6 Feb 13, 2023
@felixfontein felixfontein deleted the patchback/backports/stable-6/4c4ef80ca9518792bc4e0551864a7929254a27a0/pr-5829 branch February 13, 2023 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug integration tests/integration language module module new_contributor Help guide this first time contributor packaging plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants