When running np in a project without package.json it throws a cryptic error: Cannot read property 'version' of undefined.
I propose two things:
No package.json found, are you in the right project?.package.json file once, and and validating that there is one before passing it to the ui and index files.I have a PR ready to send to address this but I'd like to sign off on the correct error message first, or if this is even worth pursuing :)
Solution 1 looks good to me.
My proposal was actually two-fold, I'd like to prevent implementing the undefined check in multiple places, since currently readPkgUp.sync().pkg is called in both ui.js and index.js separately.
Is there a particular reason for that?
Oh ok, missed that. Was on my mobile device so difficult to catch that :).
You are right, I think it would make more sense to read the pkg once in cli.js and pass it downstream to the UI and to np. Feel free to send the PR :).
Most helpful comment
Solution 1 looks good to me.