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

[Feature] Yarn workspaces focus - allow root ident as well as named workspace #6230

Open
2 tasks done
alexg-axis opened this issue Apr 16, 2024 · 2 comments
Open
2 tasks done
Labels
enhancement New feature or request waiting for feedback Will autoclose in a while unless more data are provided

Comments

@alexg-axis
Copy link

  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

As a developer using yarn workspaces I reuse configuration for linting in the root-level workspace, whilst tests and business logic lies in one or more workspaces.

When installing dependencies in the CI I therefore want to yarn workspaces focus on the root as well as one or more workspaces.

I do not want to get the following error.

Internal Error: Workspace not found (.)
    at Pt.getWorkspaceByIdent (/path/to/code/.yarn/releases/yarn-4.1.1.cjs:210:3092)
    at /path/to/code/.yarn/releases/yarn-4.1.1.cjs:729:12945
    at Array.map (<anonymous>)
    at ng.execute (/path/to/code/.yarn/releases/yarn-4.1.1.cjs:729:12936)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ng.validateAndExecute (/path/to/code/.yarn/releases/yarn-4.1.1.cjs:94:787)
    at async as.run (/path/to/code/.yarn/releases/yarn-4.1.1.cjs:98:3250)
    at async sSt (/path/to/code/.yarn/releases/yarn-4.1.1.cjs:734:11303)
    at async nk (/path/to/code/.yarn/releases/yarn-4.1.1.cjs:734:11659)

Describe the solution you'd like

As yarn workspaces list lists the root workspace as . I want to be able to run yarn workspaces focus . foo bar in order to focus on the root, foo and bar workspaces.

Describe the drawbacks of your solution

There may be compatibility concerns if . is not already a reserved workspace name.

Describe alternatives you've considered

I've tried running the CI in different steps, i.e. running yarn workspaces focus to focus on the root first, run linting and then yarn workspaces focus foo to focus on the foo workspace and run its test. Unfortunately this becomes a hassle when there are many steps, making it required to focus several different times, rather than just installing the dependencies that are required once ahead of time. Furthermore, as private packages require additional authentication, the scope of authentication needs to be valid for longer.

@alexg-axis alexg-axis added the enhancement New feature or request label Apr 16, 2024
@arcanis
Copy link
Member

arcanis commented Apr 16, 2024

Just give a name to your root workspace and you should be able to reference that.

@arcanis arcanis added the waiting for feedback Will autoclose in a while unless more data are provided label Apr 16, 2024
@alexg-axis
Copy link
Author

Thanks for the quick response, @arcanis. That works well for my purposes. I guess I was a bit confused by the name being replaced by "." and not showing up by itself when running yarn workspaces list. If I use the --json flag, however, the name shows up and makes it clear that "." was just the location.

I'm fine closing this as it's already available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting for feedback Will autoclose in a while unless more data are provided
Projects
None yet
Development

No branches or pull requests

2 participants