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

Introduce -w global flag for running commands in workspaces #180

Open
3 tasks done
Not-Jayden opened this issue Oct 21, 2023 · 1 comment
Open
3 tasks done

Introduce -w global flag for running commands in workspaces #180

Not-Jayden opened this issue Oct 21, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Not-Jayden
Copy link

Clear and concise description of the problem

All package managers support some form of setting a workspace/package for running commands. It would be convenient to have this as a unified -w/--workspace flag, rather than having to figure out what package manager a workspace is using in order to run commands for specific workspaces.

If there is interest in this, I'd be willing to attempt a PR at implementing it.

Suggested solution

Introduce a global -w flag that lets you run commands based on a workspace name.

e.g. ni would be translated as:

ni -w packageA vite

# npm -w packageA i vite
# yarn workspace packageA add vite
# pnpm add vite --filter packageA
# (cd path/to/packageA bun add vite) (not sure yet what the best way to handle bun is as it doesn't allow you to just specify the workspace name)

There's probably some more considerations and complexity beyond the basic use case to figure out, such as:

  • Supporting defining multiple workspaces (-w packageA -w packageB)
  • supporting pattern matching for specific packages (-w @package/*)
    • This should provide support for running in all workspaces as well (-w *)
  • If -w diverges from the npm implementation (likely will), we'd probably want a different flag. Maybe just uppercase -W

Alternative

Continue just using the per-package way of doing things. They're not super standard between packages (especially bun), so maybe it does make sense to leave as is.

Additional context

No response

Validations

@Not-Jayden Not-Jayden added the enhancement New feature or request label Oct 21, 2023
@HawtinZeng
Copy link
Contributor

Wow, I think this idea is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants