Skip to content

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

Open
sglim wants to merge 1 commit intoyarnpkg:masterfrom
sglim:master
Open

Use cwd node_modules/.bin entry first in workspace#8591
sglim wants to merge 1 commit intoyarnpkg:masterfrom
sglim:master

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