berry
berry copied to clipboard
[Bug?]: `yarn upgrade-interactive` incorrectly parses aliased packages
Self-service
- [X] I'd be willing to implement a fix
Describe the bug
yarn upgrade-interactive
incorrectly parses aliased packages
To reproduce
Sorry, I don't know how to do an interactive plugin reproduction via Sherlock, so I put together a git repo with the minimal code:
https://github.com/kkirsche/yarn-issue-repro
This includes an image of the actual output
To reproduce:
git clone https://github.com/kkirsche/yarn-issue-repro.git
cd yarn-issue-repro
yarn install
yarn upgrade-interactive
This is using the following package.json:
{
"dependencies": {
"buffer": "npm:buffer-browserify@^0.2.5"
},
"packageManager": "[email protected]"
}
Environment
System:
OS: macOS 12.4
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 16.15.1 - /private/var/folders/62/793fz95j5856gz_3gz6yrlv80000gq/T/xfs-99a9dab4/node
Yarn: 3.2.1 - /private/var/folders/62/793fz95j5856gz_3gz6yrlv80000gq/T/xfs-99a9dab4/yarn
npm: 8.13.1 - ~/.asdf/plugins/nodejs/shims/npm
Additional context
I believe the following lines are where this stems from, but need to verify it:
https://github.com/yarnpkg/berry/blob/master/packages/plugin-interactive-tools/sources/commands/upgrade-interactive.tsx#L324-L334
Does anyone have tips for how to run the plugin directly?
Hi! 👋
This issue looks stale, and doesn't feature the reproducible
label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).
Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃
If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded
label. Thanks for helping us triaging our repository! 🌟
Not all things can be reproduced with Sherlock with its current documentation and the maintainer team hasn't even acknowledged the issue.
If using a bot like this, there is a two-way contract between end-users and maintainers, where maintainers are saying we will acknowledge the validity of issues in this time frame and users will make a best effort to provide reproductions.
The same thing happens to yarn outdated
Verified that interactive commands like upgrade-interactive
can't be used in Sherlock.
Code
await packageJsonAndInstall({
devDependencies: {
[`buffer`]: `npm:buffer-browserify@^0.2.5`
}
});
await yarn(`upgrade-interactive`);
Output
Error: Command failed: /home/sandbox/.nvm/versions/node/v16.15.1/bin/node /sandbox/berry/scripts/actions/../run-yarn.js upgrade-interactive
Internal Error: Interactive commands can only be used inside a TTY environment
at Object.checkRequirements (/sandbox/berry/.yarn/__virtual__/@yarnpkg-libui-virtual-5798c7b6cc/1/packages/yarnpkg-libui/sources/libuiUtils.ts:12:11)
at UpgradeInteractiveCommand.execute (/sandbox/berry/packages/plugin-interactive-tools/sources/commands/upgrade-interactive.tsx:42:16)
at UpgradeInteractiveCommand.validateAndExecute (/sandbox/berry/.yarn/__virtual__/clipanion-virtual-9b3ecfaf21/0/cache/clipanion-npm-3.2.0-rc.10-b702c05bd9-d3b6454c9e.zip/node_modules/clipanion/lib/advanced/Command.js:67:37)
at /sandbox/berry/.yarn/__virtual__/clipanion-virtual-9b3ecfaf21/0/cache/clipanion-npm-3.2.0-rc.10-b702c05bd9-d3b6454c9e.zip/node_modules/clipanion/lib/advanced/Cli.js:222:53
at noopCaptureActivator (/sandbox/berry/.yarn/__virtual__/clipanion-virtual-9b3ecfaf21/0/cache/clipanion-npm-3.2.0-rc.10-b702c05bd9-d3b6454c9e.zip/node_modules/clipanion/lib/advanced/Cli.js:448:12)
at Cli.run (/sandbox/berry/.yarn/__virtual__/clipanion-virtual-9b3ecfaf21/0/cache/clipanion-npm-3.2.0-rc.10-b702c05bd9-d3b6454c9e.zip/node_modules/clipanion/lib/advanced/Cli.js:222:30)
at Cli.runExit (/sandbox/berry/.yarn/__virtual__/clipanion-virtual-9b3ecfaf21/0/cache/clipanion-npm-3.2.0-rc.10-b702c05bd9-d3b6454c9e.zip/node_modules/clipanion/lib/advanced/Cli.js:231:39)
at exec (/sandbox/berry/packages/yarnpkg-cli/sources/main.ts:159:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at run (/sandbox/berry/packages/yarnpkg-cli/sources/main.ts:48:7)
at ChildProcess.exithandler (node:child_process:398:12)
at ChildProcess.emit (node:events:527:28)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
https://github.com/kkirsche/yarn-issue-repro
Yarn maintainers need to add upholded
label to this issue, since it's reproducible in provided repro.