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

Add an option to make yarn outdated return exit code "0" even in case of outdated libraries #7573

Open
vincentmigot opened this issue Sep 25, 2019 · 2 comments

Comments

@vincentmigot
Copy link

Do you want to request a feature or report a bug?

Feature.

What is the current behavior?

With outdated packages present, yarn outdated exits with 1

What is the expected behavior?

In my opinion, this feature is essentially useful to know that new versions of libraries are available.
If you rely on a framework or some other libraries you can't always have up to date library to their latest version, or you may have no time to upgrade them (in case of breaking changes by example).
That's perfectly normal in a production environment with various release lifecycles to do that.
But with this non-zero exit code, it breaks any automated build or CI system which rely on this exit code to know if the operation failed or not (in my case Maven and Jenkins).
Having outdated libraries IS NOT a failure, it's only an information.
I can understand that "yarn audit" command return non-zero status code because it's about security but not this one.

Saying that, I think that this command should at least provide an option to determine if outdated should return zero or non-zero exit code in case of presence of outdated libraries.

If you agreed with that statement or have any better solution I can found time to implement it and send a pull request.

#3483 (comment)

I also create a bug for npm because as far as I have found the --silent flag should exactly do what I want but it's not working:
https://npm.community/t/npm-outdated-should-have-an-option-to-have-non-zero-exit-code/10239

Please mention your node.js, yarn and operating system version.

OS: Ubuntu 18.04
Node: v11.6.0
Yarn: 1.18.0

@ivan-kolmychek
Copy link

Well, I created the #3483 because in some cases it makes sense to treat yarn outdated as critical check. But I do agree that it's not always the case. 👍

From my perspective, either flag to exit with 0 when there are outdated packages or a flag to exit with 1 in that case would solve the problem.

I personally would prefer having to specify an extra flag to show that I want to treat outdated packages as normal situation, in part because then the default behavior lines up with how npm outdated behaves. But that's my personal preference, and as long as there is a way to say "please exit with non-zero status code when there are outdated packages" I don't really care that much what is default behaviour.

@vincentmigot
Copy link
Author

Nice !
I think we shouldn't change the current behavior and have an extra flag to tread oudated package as a normal situation.

I'll make a PR in a few days in this this direction with the flag "--no-error-on-outdated"
I'm not sure if this flag label is good, tell me if you have any better naming.

I'll do the same for npm to keep consistency for this function on both tools.

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