diff options
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/ping.js | 4 | ||||
-rw-r--r-- | lib/utils/read-local-package.js | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/utils/ping.js b/lib/utils/ping.js index f5f7fcc6a..00956d0c1 100644 --- a/lib/utils/ping.js +++ b/lib/utils/ping.js @@ -1,7 +1,7 @@ // ping the npm registry // used by the ping and doctor commands const fetch = require('npm-registry-fetch') -module.exports = async (opts) => { - const res = await fetch('/-/ping?write=true', opts) +module.exports = async (flatOptions) => { + const res = await fetch('/-/ping?write=true', flatOptions) return res.json().catch(() => ({})) } 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 |