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 ls --since REF --json returns empty string with no changed packages instead of empty array #1945

Closed
bdwain opened this issue Feb 26, 2019 · 3 comments

Comments

@bdwain
Copy link
Contributor

bdwain commented Feb 26, 2019

Expected Behavior

lerna ls --since REF --json prints [] if there are no changed packages

Current Behavior

lerna ls --since REF --json prints an empty string if there are no changed packages

Possible Solution

not sure off the top of my head but i'd be happy to do a pr to fix it

Steps to Reproduce (for bugs)

on master, run lerna ls --since master --json

Context

i have a script that runs this to get changed packages. It needs a special case to handle no packages which is unnecessary

the behavior seems to have changed recently. it used to return a non-zero exit code if there were no unchanged packages, which also seemed wrong.

Your Environment

Executable Version
lerna --version 3.13.0
yarn --version 1.12.3
node --version 10.14.2
OS Version
NAME VERSION
@evocateur
Copy link
Member

lerna ls has never exited non-zero with no results. lerna changed does exit non-zero, as it was intended to be a filter for lerna publish in CI (for example). (lerna changed is equivalent to lerna ls --since)

ba54439 was a bit overzealously trying to avoid an empty console.log(). Perhaps testing result.text.length instead of result.count is more appropriate? It would still emit an empty array, in your case.

I have a fix forthcoming.

@evocateur
Copy link
Member

As for the non-zero exit with no results, that's a breaking change. I largely agree with it, btw, as it matches the behavior of grep with no results.

@bdwain
Copy link
Contributor Author

bdwain commented Feb 27, 2019

thanks!

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

No branches or pull requests

2 participants