Welcome to mirror list, hosted at ThFree Co, Russian Federation.

read-local-package.js « utils « lib - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 21506ca180a0f31411855eb0d6198c2263d44fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
const { resolve } = require('path')
const readJson = require('read-package-json-fast')
async function readLocalPackageName (npm) {
  if (npm.config.get('global'))
    return

  const filepath = resolve(npm.prefix, 'package.json')
  const json = await readJson(filepath)
  return json.name
}

module.exports = readLocalPackageName