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 a flag to make jscodeshift return a 1 code when errors were found #416
Add a flag to make jscodeshift return a 1 code when errors were found #416
Conversation
Hi @marcodejongh! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@@ -298,6 +298,10 @@ function run(transformFile, paths, options) { | |||
process.stdout.write( | |||
'Time elapsed: ' + timeElapsed + 'seconds \n' | |||
); | |||
|
|||
if (options.failOnError && fileCounters.error > 0) { | |||
process.exit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably go below the temp.cleanupSync
call at least?
Is it possible to put the process.exit(1)
call in bin/jscodeshift.js
rather than in this file? I suspect this file is supposed to be reusable as a library and thus shouldn't be handling the exit here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point on moving the process.exit(1), it also didn't really belong in the if (!options.silent) {
statement.
On moving this to the bin, I think it makes sense to have it in this file since Runner.js already does many process stuff (see also the process.stdout). If you want to use this file in other JS code, the user can not pass in the failOnError flag.
But it looks like it passes back the stats to bin/jscodeshift, so it's easy to move there as well, it was just that bin/jscodeshift seemed like just the cli wrapper
@Daniel15 Any chance this could get another review? I'd love to be able to move us off of our fork of this library |
@marcodejongh Sorry for the delay! I'll take a look at this tomorrow morning :) |
Looks good. Thanks! |
Hello @Daniel15 , thanks for accepting this pull-request! Do we have an approx idea of when the new version will be released? Thank you! |
I'll try to push a new release tomorrow :) |
Sorry for the delay. Published this as 0.13.0. Thanks for your contribution! |
Fixes #194