Skip to content

Commit

Permalink
Gracefully handle package.json not being found (#167)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
  • Loading branch information
ryanrhee and sindresorhus committed Oct 28, 2020
1 parent 49ce74d commit ef7ae5d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.js
Expand Up @@ -91,11 +91,13 @@ const meow = (helpText, options) => {
helpText = '';
}

const foundPkg = readPkgUp.sync({
cwd: parentDir,
normalize: false
});

options = {
pkg: readPkgUp.sync({
cwd: parentDir,
normalize: false
}).packageJson || {},
pkg: foundPkg ? foundPkg.packageJson : {},
argv: process.argv.slice(2),
flags: {},
inferType: false,
Expand Down

0 comments on commit ef7ae5d

Please sign in to comment.