yarnpkg / berry

πŸ“¦πŸˆ Active development trunk for Yarn βš’
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.42k stars 1.11k forks source link

[Bug?]: git+ssh:// protocol works with yarn 1.22.19 workspaces but will not correctly detect dependencies with yarn 3.2.4. #5055

Open JMS-1 opened 1 year ago

JMS-1 commented 1 year ago

Self-service

Describe the bug

We would like to use the git[+ssh]:// protocol to cross reference repositories in a mono-rep. All repositories are git submodules. With yarn 3.2.4 dependencies between respositories are no longer detected. yarn 1.22.19 works fine.

To reproduce

I created a GITHUB Respository for reproduction. First the error itself (linux dev env):

git clone git@github.com:JMS-1/repro-ws.git --recursive cd repro-ws ./reset

You can see that repro-lib-1 does not create a symbolic link to the folder in the mono-rep. You can check the yarn.lock created to see that indeed there are two separate instance of repro-lib-1. Another indication is the execution order.

watch -n 0.1 yarn workspaces foreach --topological-dev -p -iv exec pwd

Shows alternation in order between lib-1 and lib-2.

Now you can go back back to yarn 1 by removing .yarnrc.yml and the packageManger field from the package.json. ./reset now shows hat all folders are correctly linked. Again checking yarn.lock looks very different but better. The manual test shows a stable execution order as well.

yarn workspaces run

As it should lib-1 is ALWAYS considered to run first.

Environment

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
  Binaries:
    Node: 18.12.1 - /tmp/xfs-a34de361/node
    Yarn: 3.2.4 - /tmp/xfs-a34de361/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm

Additional context

No response

JMS-1 commented 1 year ago

I'm wrong concerning yarn 1: it LOOKS as if it's working but it isn't! lib-2 gehts a COPY of lib-1 in its on node_modules which will break developing correctly in the mono-rep.

So maybe this is not a bug but somehow "by design": should yarn workspaces in any version work with git:// dependencies at all?

Sorry

Jochen