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

Use cwd node_modules/.bin entry first in workspace #8591

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sglim
Copy link

@sglim sglim commented Mar 3, 2021

  • If there are multiple project which has dependency for the different
    version of 3rd party modules, only workspace root .bin was resolved.
  • This change fixes this bug by changing order of bin entries when
    resolving binary locations which are in several different package
    folders
  • See https://github.com/sglim/yarn-workspace-bin-bug to reproduce the
    bug

Summary

As-is
'yarn bin myBin' always returns node_modules/.bin in workspace root

To-Bo
'yarn bin myBin' returns workspace-*/node_modules/.bin respectively

Test plan

Create two project which has 'binary', my_project_with_bin/v1 with cli_v1.js, my_project_with_bin/v2 with cli_v2.js, respectively.
Also, create a workspace with two workspace projects: 'workspace-1', 'workspace-2'. 'workspace-1' depends on my_project_with_bin:v1, 'workspace-2' depends on my_project_with_bin:v2 as well.

Install them in workspace, .bin will be create in each workspace-* folder.
Check the result of output buffer report contains workspace-* folder in binary path.

- If there are multiple project which has dependency for the different
  version of 3rd party modules, only workspace root .bin was resolved.
- This change fixes this bug by changing order of bin entries when
  resolving binary locations which are in several different package
  folders
- See https://github.com/sglim/yarn-workspace-bin-bug to reproduce the
  bug
@sglim
Copy link
Author

sglim commented Mar 3, 2021

This PR is fix for the issue: #8590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant