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

lerna run: Don't error if no scoped packages are matched #859

Closed
treshugart opened this issue May 31, 2017 · 3 comments
Closed

lerna run: Don't error if no scoped packages are matched #859

treshugart opened this issue May 31, 2017 · 3 comments

Comments

@treshugart
Copy link
Contributor

I'm implementing #822 and have been attempting to integrate it into our workflow. However, I'm running into some issues where I want to scope some commands using that flag (--since) but don't want it to error if no packages are run.

In thinking about this, I'm not sure it's valuable to ever exit with non-zero if no scoped packages are matched; it doesn't seem like an exceptional state. Warning might be fine, but even then, it's fairly clear when no packages are matched.

Expected Behavior

I would expect to be able to run lerna run something --scope some-unmatched-package without errors.

This is also inconsistent with how scoping is applied to built-in Lerna commands as well as exec. For example, bootstrap and ls don't error if a filtering option doesn't match any packages, it just logs that it didn't run in any packages.

Current Behavior

The command errors. This means you can't do something like lerna run eslint --since this-branch to only lint against changed files, it will fail linting if no packages have been changed.

To work around this you can do something like lerna exec --since ref -- eslint.

Possible Solution

The built-in commands log how many packages a command was run in, so maybe we can follow suit here for run.

Steps to Reproduce (for bugs)

n/a

Context

This seems only an issue for lerna run, so to work around it you could use exec, but it feels odd to have to do something like lerna exec --scope package -- npm run test.

Your Environment

n/a

@evocateur evocateur changed the title Don't error if no scoped packages are matched run/exec: Don't error if no scoped packages are matched Jun 6, 2017
@evocateur evocateur changed the title run/exec: Don't error if no scoped packages are matched lerna run: Don't error if no scoped packages are matched Jun 6, 2017
@evocateur
Copy link
Member

The inconsistency between scoped ls/bootstrap and run is certainly itchy. I am open to making it more consistent.

@evocateur
Copy link
Member

This was fixed waaaay back in v2.0.0 🤸‍♀️

@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants