berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: `yarn workspaces list` shows folder names, not workspace names

Open jbzcooper opened this issue 2 years ago • 4 comments

Self-service

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

Describe the bug

Given a yarn workspace setup where the package names are different from the folder's they are in When a user enters the yarn workspaces list command Then we expect the workspace names to be returned.

Actual result: the folder names are returned.

To reproduce

  1. Create a new yarn project following these instructions https://classic.yarnpkg.com/lang/en/docs/workspaces/
  2. In the workspace-a folder, modify the name property of the package.json file to: "a-workspace"
  3. At the command prompt enter: yarn workspaces list

Expected result: a-workspace workspace-b

Actual result: workspace-a workspace b

Environment

System:
1. Zorin OS 16 (5.13.0-52-generic 20.04.1-Ubuntu)
2. Windows 10.0.19044
Binaries:
machine: /home/xxx/.nvm/versions/node/v16.13.0/bin/yarn version 1.22.15
project: <proj folder>/.yarn/yarn-3.2.1.cjs

Additional context

No response

jbzcooper avatar Jul 12 '22 21:07 jbzcooper

you probably need to run yarn at the root for these changes to take effect.

DhirajBhakta avatar Jul 13 '22 15:07 DhirajBhakta

Also, isn't this yarn1.x ? https://github.com/yarnpkg/yarn/issues Looks like only yarn berry (2.x) issues are tracked here

DhirajBhakta avatar Jul 13 '22 15:07 DhirajBhakta

Also, isn't this yarn1.x ? https://github.com/yarnpkg/yarn/issues Looks like only yarn berry (2.x) issues are tracked here

No, as you can see I'm running yarn CLI 1.22.15 globally but using 3.2.1 for the project.

jbzcooper avatar Jul 13 '22 16:07 jbzcooper

you probably need to run yarn at the root for these changes to take effect.

This doesn't change the behavior.

jbzcooper avatar Jul 13 '22 16:07 jbzcooper

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! 🌟

yarnbot avatar Aug 12 '22 17:08 yarnbot

This is still the issue.

For comparison -- when you run yarn workspaces list --json, you get the list of JSON objects with location and name, for example {"location":"packages/backend", "name": "@org/secret-project"}.

But when you run yarn workspaces list, you don't get:

@org/secret-project

You get:

packages/backend

IMO this is wrong, because all the yarn commands that acknowledge the concept of workspaces work on their names, not locations. And the need of using --json output (which BTW is not a valid JSON), just to get the names of the workspaces feels wrong. Names should be the default output of yarn workspaces list.

akwodkiewicz avatar Nov 06 '23 14:11 akwodkiewicz