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

[Bug?]: yarn up incorrectly updates dependencies using the link protocol #3102

Closed
1 task done
mskelton opened this issue Jul 7, 2021 · 3 comments
Closed
1 task done
Labels
bug Something isn't working reproducible This issue can be successfully reproduced

Comments

@mskelton
Copy link
Contributor

mskelton commented Jul 7, 2021

Self-service

  • I'd be willing to implement a fix

Describe the bug

When using the link: protocol for linking local packages (as described in the protocols docs), I noticed that running yarn up will incorrectly swap these dependencies for their registry equivalents.

I would expect yarn up to ignore dependencies listed with the link: protocol.

To reproduce

const {promises: {readFile}} = require(`fs`);

await packageJsonAndInstall({
  dependencies: {
    [`fixtures`]: `link:./fixtures`,
  }
});

await yarn(`up`, `fixtures`);

const pkgJson = JSON.parse(await readFile(`package.json`, `utf8`));
expect(pkgJson.dependencies.fixtures).toBe(`link:./fixtures`);

While this example is not a real world use case since I'm explicitly updating the dependency, this also occurs when using a wildcard such as yarn up '*' which is a real world use case for updating all deps.

Environment

System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Binaries:
Node: 14.17.1 - /private/var/folders/jh/s3v_qtkx501g98yxct1x4g3r634gd_/T/xfs-00f87514/node
Yarn: 2.4.2 - /private/var/folders/jh/s3v_qtkx501g98yxct1x4g3r634gd_/T/xfs-00f87514/yarn
npm: 6.14.13 - ~/.local/share/nvm/v14.17.1/bin/npm

Additional context

No response

@mskelton mskelton added the bug Something isn't working label Jul 7, 2021
@yarnbot yarnbot added the broken-repro The reproduction in this issue is broken label Jul 7, 2021
@yarnbot

This comment has been minimized.

@yarnbot yarnbot added reproducible This issue can be successfully reproduced and removed broken-repro The reproduction in this issue is broken labels Jul 7, 2021
@yarnbot
Copy link
Collaborator

yarnbot commented Jul 7, 2021

This issue reproduces on master:

Error: expect(received).toBe(expected) // Object.is equality

Expected: "link:./fixtures"
Received: "^0.0.2"
    at module.exports (evalmachine.<anonymous>:13:39)
    at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
    at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
    at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
    at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)

@merceyz
Copy link
Member

merceyz commented Jul 7, 2021

Duplicate of #1492

@merceyz merceyz marked this as a duplicate of #1492 Jul 7, 2021
@merceyz merceyz closed this as completed Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible This issue can be successfully reproduced
Projects
None yet
Development

No branches or pull requests

3 participants