When two workspaces are in separate hierarchies and need to reference a common patch as a dependency, I use the relative path to the patch directory. However, in this situation, syncpack does not correctly identify that the different patch paths are actually the same due to their directory locations. As a result, running yarn run syncpack list-mismatches will generate an error.
Steps to reproduce:
Make sure you have a patches/ folder a the root of your project.
Create a package.json at the root of your project and add a patch to a dependency (example root-proj/package.json), say "react-dom" referencing a patch from the patches/ folder..
Create a workspace inside a folder from the root and add a package.json (example root-proj/workspace-1/package.json). Add "react-dom" as a dependency and map its version to the relative path of the patch with ../patches so that it references the same patch as above.
Run yarn run syncpack list-mismatches
The output should be similar to:
✘ react-dom has mismatched versions which syncpack cannot fix
--
patch:react-dom@16.11.0#patches/react-dom+16.11.0.patch in dependencies of package.json
patch:react-dom@16.11.0#../patches/react-dom+16.11.0.patch in dependencies of workspace-1/package.json
Description
When two workspaces are in separate hierarchies and need to reference a common patch as a dependency, I use the relative path to the patch directory. However, in this situation, syncpack does not correctly identify that the different patch paths are actually the same due to their directory locations. As a result, running
yarn run syncpack list-mismatches
will generate an error.Steps to reproduce:
Make sure you have a
patches/
folder a the root of your project.Create a
package.json
at the root of your project and add a patch to a dependency (exampleroot-proj/package.json
), say "react-dom" referencing a patch from thepatches/
folder..Create a workspace inside a folder from the root and add a
package.json
(exampleroot-proj/workspace-1/package.json
). Add "react-dom" as a dependency and map its version to the relative path of the patch with../patches
so that it references the same patch as above.Run
yarn run syncpack list-mismatches
The output should be similar to:
env: syncpack: 9.8.6 node: 14.19.0 yarn: 3.2.2 os: Mac Ventura 13.3.1
Thanks for looking into this!