berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: frozen-lockfiles for file dependencies

Open furstenheim-goodnotes opened this issue 1 year ago โ€ข 0 comments

Self-service

  • [X] I'd be willing to implement a fix

Describe the bug

I have a project that has some file dependencies:

something like:

"dependencies": {
   "my-package": "../../some-other-package"
}

This is very handy to work in the monorepo.

In yarn v1 when using --frozen-lockfiles the changes in this repo were not marked as a failure and it just work.

In yarn v4, with --immutable the package is shaed and compared. Meaning that any change in my mono repo will make yarn --immutable fail.

Is there any way for me to get the old behavior?

To reproduce

## create a
mkdir a
cd a
touch a.js
cat << EOF > a.js
console.log(1)
EOF
yarn init
cd ..

## create b
mkdir b
yarn init
touch yarn.lock
cat << EOF > package.json
{
  "name": "b",
  "packageManager": "[email protected]",
  "dependencies": {
    "a": "../a"
  }
}
EOF
yarn
cd ..

## modify a
cd a
cat << EOF > a.js
console.log(2)
EOF
cd ..


## try to do yarn --immutable
cd b
yarn --immutable

Output

โžค YN0000: ยท Yarn 4.4.0
โžค YN0000: โ”Œ Resolution step
โžค YN0085: โ”‚ + a@file:../a#../a::hash=7ce741&locator=b%40workspace%3A.
โžค YN0085: โ”‚ - a@file:../a#../a::hash=e591a1&locator=b%40workspace%3A.
โžค YN0000: โ”” Completed

โžค YN0000: โ”Œ Post-resolution validation
โžค YN0000: โ”‚ @@ -6,10 +6,9 @@
โžค YN0000: โ”‚    cacheKey: 10c0
โžค YN0000: โ”‚  
โžค YN0000: โ”‚  "a@file:../a::locator=b%40workspace%3A.":
โžค YN0000: โ”‚    version: 0.0.0
โžค YN0028: โ”‚ -  resolution: "a@file:../a#../a::hash=e591a1&locator=b%40workspace%3A."
โžค YN0028: โ”‚ -  checksum: 10c0/4d22b6c39c81689f935221938e4485fe0b762e95309636b31a41e48a0572ee7e1e6685201210b8508e0b2c3eea3c257a3435253399828cb5580f99726d5b9998
โžค YN0028: โ”‚ +  resolution: "a@file:../a#../a::hash=7ce741&locator=b%40workspace%3A."
โžค YN0000: โ”‚    languageName: node
โžค YN0000: โ”‚    linkType: hard
โžค YN0000: โ”‚  
โžค YN0000: โ”‚  "b@workspace:.":
โžค YN0000: โ”‚ 
โžค YN0028: โ”‚ The lockfile would have been modified by this install, which is explicitly forbidden.
โžค YN0000: โ”” Completed
โžค YN0000: ยท Failed with errors in 0s 42ms

Environment

System:
    OS: Linux 6.8 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P
  Binaries:
    Node: 18.16.1 - /tmp/xfs-522f04d6/node
    Yarn: 4.4.0 - /tmp/xfs-522f04d6/yarn
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.1/bin/npm

Additional context

No response

furstenheim-goodnotes avatar Sep 05 '24 09:09 furstenheim-goodnotes