fix: improve error messages when files are missing or mismatched #122
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.
Fixes #121
Problem
Errors are most helpful when they give the user information about how to self-resolve them, without needing to search too deep. When the dist files cannot be matched to src files, the error right now alerts the user to that, but doesn't tell them what it expects. This requires them to go look elsewhere to realize the extension mappings or that the bare names must match.
Solution
We can be a little more verbose with our error messages:
This should create errors which give the users immediate solutions if they are using pkgroll for the first time.
NOTE: I also rewrote a
for + if
statement into asome
statement because I find that easier to reason about. Feel free to undo that if you have strong opinions.NOTE: I also had to jump through hoops to get the linter happy because it wouldn't let me multi-line an arrow, but also complained it was over 100 chars, but also wouldn't let me use ext as a name. So I ended up grabbing the actual prop we care about.