Skip to content

Trailing slash breaks workspace features when yarn run inside workspace folder #5816

@j-maas

Description

@j-maas

Do you want to request a feature or report a bug?

Bug.

What is the current behavior?
When the workspaces definition contains a trailing slash, running e. g. yarn workspaces info in the root works just as expected. But when you cd into the workspace folder and run yarn workspaces info, it fails because it cannot detect that that folder is a workspace.

If the current behavior is a bug, please provide the steps to reproduce.

  1. Create a new project directory.
  2. Create a subdirectory called package.
  3. yarn init inside package/.
  4. yarn init in the root.
  5. Add package/ (with trailing slash) as a workspace to the root package.json.
    ...
    "workspaces": {
      "packages": [
        "package/"
      ],
    },
    ...
    
  6. Run yarn workspaces info in the root. => Outputs workspace list correctly.
  7. Run yarn workspaces info in package/. => Fails with
    yarn workspaces v1.6.0
    error Cannot find the root of your workspace - are you sure you're currently in a workspace?
    info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about this command.
    

What is the expected behavior?
Running yarn workspaces info should output the workspaces when run both inside root and package/.

If this behavior is intended, the documentation could reflect the reason why.

Please mention your node.js, yarn and operating system version.
Node v8.11.1
Yarn v1.6.0
Ubuntu 16.04 LTS

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions