"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/tag.js" (8 Mar 2017, 1111 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // turns out tagging isn't very complicated
    2 // all the smarts are in the couch.
    3 module.exports = tag
    4 tag.usage = '[DEPRECATED] npm tag <name>@<version> [<tag>]' +
    5             '\nSee `dist-tag`'
    6 
    7 tag.completion = require('./unpublish.js').completion
    8 
    9 var npm = require('./npm.js')
   10 var mapToRegistry = require('./utils/map-to-registry.js')
   11 var npa = require('npm-package-arg')
   12 var semver = require('semver')
   13 var log = require('npmlog')
   14 
   15 function tag (args, cb) {
   16   var thing = npa(args.shift() || '')
   17   var project = thing.name
   18   var version = thing.rawSpec
   19   var t = args.shift() || npm.config.get('tag')
   20 
   21   t = t.trim()
   22 
   23   if (!project || !version || !t) return cb('Usage:\n' + tag.usage)
   24 
   25   if (semver.validRange(t)) {
   26     var er = new Error('Tag name must not be a valid SemVer range: ' + t)
   27     return cb(er)
   28   }
   29 
   30   log.warn('tag', 'This command is deprecated. Use `npm dist-tag` instead.')
   31 
   32   mapToRegistry(project, npm.config, function (er, uri, auth) {
   33     if (er) return cb(er)
   34 
   35     var params = {
   36       version: version,
   37       tag: t,
   38       auth: auth
   39     }
   40     npm.registry.tag(uri, params, cb)
   41   })
   42 }