1 // turns out tagging isn't very complicated
2 // all the smarts are in the couch.
4 tag.usage = "npm tag <project>@<version> [<tag>]"
6 tag.completion = require("./unpublish.js").completion
8 var npm = require("./npm.js")
9 , mapToRegistry = require("./utils/map-to-registry.js")
10 , npa = require("npm-package-arg")
11 , semver = require("semver")
12 , log = require("npmlog")
14 function tag (args, cb) {
15 var thing = npa(args.shift() || "")
16 , project = thing.name
17 , version = thing.rawSpec
18 , t = args.shift() || npm.config.get("tag")
22 if (!project || !version || !t) return cb("Usage:\n"+tag.usage)
24 if (semver.validRange(t)) {
25 var er = new Error("Tag name must not be a valid SemVer range: " + t)
29 log.warn("tag", "This command is deprecated. Use `npm dist-tag` instead.")
31 mapToRegistry(project, npm.config, function (er, uri, auth) {
39 npm.registry.tag(uri, params, cb)