diff options
Diffstat (limited to 'lib/utils/read-local-package.js')
-rw-r--r-- | lib/utils/read-local-package.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/utils/read-local-package.js b/lib/utils/read-local-package.js index c31bca994..21506ca18 100644 --- a/lib/utils/read-local-package.js +++ b/lib/utils/read-local-package.js @@ -1,11 +1,12 @@ const { resolve } = require('path') const readJson = require('read-package-json-fast') async function readLocalPackageName (npm) { - if (npm.flatOptions.global) + if (npm.config.get('global')) return - const filepath = resolve(npm.flatOptions.prefix, 'package.json') - return (await readJson(filepath)).name + const filepath = resolve(npm.prefix, 'package.json') + const json = await readJson(filepath) + return json.name } module.exports = readLocalPackageName |