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

feat: call process.exit(1) during postinstall #1

Merged
merged 1 commit into from
Feb 25, 2019
Merged

Conversation

dmbch
Copy link
Member

@dmbch dmbch commented Feb 24, 2019

yarn does not allow postinstall scripts to write to stdout/stderr. This prevents us from informing users about package duplicates. Apparently, crashing the installation is all we can do in this case.

This PR adds support for this exact use case.

@dmbch dmbch requested review from jhiode and ZauberNerd February 24, 2019 22:39
@@ -64,6 +64,12 @@ if (require.main === module) {
// eslint-disable-next-line no-console
console.warn('Duplicate: %s', duplicate);
});
if (
duplicates.length &&
process.env.npm_lifecycle_event === 'postinstall'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this env variable also set when using yarn?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I checked.

@dmbch dmbch merged commit beea182 into master Feb 25, 2019
@dmbch dmbch deleted the crash-install branch February 25, 2019 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants