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

CLI: Improve yarn/pnpm workspaces support for adding dependencies in CLI #21331

Merged

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Mar 1, 2023

Closes #20556

What I did

  • I added detection for workspace root for yarn 1 and yarn 2 and pnpm, to our CLI
  • I refactored our code a bit, to use installArgs only for addition flags.
  • I ended up keeping the existing "ignore workspace" flag for Yarn1.

How to test

This would require testing outside of the monorepo, in projects setup as a monorepo with the respective package managers.

I'd expect the install step to succeed now, because storybook CLI should now pass the correct flag to the package manager to set it up to allow installation into the workspace root.

I could not find if npm also required such a flag:
https://docs.npmjs.com/cli/v9/commands/npm-install#workspaces

@ndelangen ndelangen self-assigned this Mar 1, 2023
@ndelangen ndelangen requested a review from JReinhold March 1, 2023 14:09
@shilman shilman changed the title CLI: add better support for workspaces for pnpm and yarn when adding storybook/dependencies in CLI CLI: Add better yarn/pnpm workspaces support for adding dependencies in CLI Mar 1, 2023
@shilman shilman changed the title CLI: Add better yarn/pnpm workspaces support for adding dependencies in CLI CLI: Improve yarn/pnpm workspaces support for adding dependencies in CLI Mar 1, 2023
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @yannbf mind testing this out in some workspaces once it's released in 20m?

@shilman shilman merged commit 0735a76 into next Mar 1, 2023
@shilman shilman deleted the norbert/20556-add-workspace-flag-to-packagemanagers-in-cli branch March 1, 2023 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Storybook automigration fails to install dependencies in pnpm workspace
2 participants