Skip to content

Commit ef7ae5d

Browse files
ryanrheesindresorhus
andauthoredOct 28, 2020
Gracefully handle package.json not being found (#167)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
1 parent 49ce74d commit ef7ae5d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ const meow = (helpText, options) => {
9191
helpText = '';
9292
}
9393

94+
const foundPkg = readPkgUp.sync({
95+
cwd: parentDir,
96+
normalize: false
97+
});
98+
9499
options = {
95-
pkg: readPkgUp.sync({
96-
cwd: parentDir,
97-
normalize: false
98-
}).packageJson || {},
100+
pkg: foundPkg ? foundPkg.packageJson : {},
99101
argv: process.argv.slice(2),
100102
flags: {},
101103
inferType: false,

0 commit comments

Comments
 (0)
Please sign in to comment.