This repository has been archived by the owner on May 4, 2024. It is now read-only.
FIX don’t crash on non-string ‘bin’ entries #54
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've run read-package-json against every version of every package on npm and discovered an edge case where it throws an uncatchable exception when
bin
entry of package.json isn't a string. The exception stack trace is:Here's a repro online. That one old version of
mstrwebci
is just one example, there's other problematic versions of this package and other packages.This Pull Request catches the exact exception and simply ignores the bin key. It could be made better to warn about the issue, but for our use on https://tonicdev.com we don't need fine-grained warnings (we just clean up bad package.json's to make them usable if possible).
Passing test included.