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

package-id.js « utils « lib - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4048aee4f73807da816ddb754fd04606e8587f67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict'
var moduleName = require('./module-name.js')

module.exports = function (tree) {
  var pkg = tree.package || tree
  // FIXME: Excluding the '@' here is cleaning up after the mess that
  // read-package-json makes. =(
  if (pkg._id && pkg._id !== '@')
    return pkg._id
  var name = moduleName(tree)
  if (pkg.version)
    return name + '@' + pkg.version
  else
    return name
}