sindresorhus / meow

🐈 CLI app helper
MIT License
3.54k stars 151 forks source link

Gracefully handle package.json not being found #167

Closed ryanrhee closed 4 years ago

ryanrhee commented 4 years ago

read-pkg-up's sync() can return undefined. If that happens, we try to index into .packageJson, which fails.

Making the index operation null-safe makes execution continue on with pkg being set to an empty object, which is what seems to be the original intent.

sindresorhus commented 4 years ago

You cannot use this syntax. It's not supported in all the supported Node.js versions.