8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9848db commit b5a7dcfCopy full SHA for b5a7dcf
source/util.js
@@ -7,15 +7,17 @@ const pMemoize = require('p-memoize');
7
const ow = require('ow');
8
const pkgDir = require('pkg-dir');
9
10
-exports.readPkg = (packagePath = pkgDir.sync()) => {
+exports.readPkg = packagePath => {
11
+ packagePath = packagePath ? pkgDir.sync(packagePath) : pkgDir.sync();
12
+
13
+ if (!packagePath) {
14
+ throw new Error('No `package.json` found. Make sure the current directory is a valid package.');
15
+ }
16
17
const {packageJson} = readPkgUp.sync({
18
cwd: packagePath
19
});
20
- if (!packageJson) {
- throw new Error(`No package.json found. Make sure ${packagePath} is a valid package`);
- }
-
21
return packageJson;
22
};
23
0 commit comments