mirror of
https://github.com/zhigang1992/npm.git
synced 2026-04-29 04:25:30 +08:00
18
node_modules/npm-registry-client/lib/publish.js
generated
vendored
18
node_modules/npm-registry-client/lib/publish.js
generated
vendored
@@ -106,14 +106,17 @@ function putFirst (data, tardata, stat, username, email, cb) {
|
||||
function putNext(newVersion, root, current, cb) {
|
||||
// already have the tardata on the root object
|
||||
// just merge in existing stuff
|
||||
// if the version already exists, and not a --force, then raise error
|
||||
var force = this.conf.get('force')
|
||||
var curVers = Object.keys(current.versions || {}).map(function (v) {
|
||||
return semver.clean(v, true)
|
||||
})
|
||||
}).concat(Object.keys(current.time || {}).map(function(v) {
|
||||
if (semver.valid(v, true))
|
||||
return semver.clean(v, true)
|
||||
}).filter(function(v) {
|
||||
return v
|
||||
}))
|
||||
|
||||
if (!force && curVers.indexOf(newVersion) !== -1) {
|
||||
return cb(conflictError(root.name))
|
||||
if (curVers.indexOf(newVersion) !== -1) {
|
||||
return cb(conflictError(root.name, newVersion))
|
||||
}
|
||||
|
||||
current.versions[newVersion] = root.versions[newVersion]
|
||||
@@ -143,9 +146,10 @@ function putNext(newVersion, root, current, cb) {
|
||||
this.request("PUT", root.name, current, cb)
|
||||
}
|
||||
|
||||
function conflictError (pkgid) {
|
||||
var e = new Error("cannot modify existing version")
|
||||
function conflictError (pkgid, version) {
|
||||
var e = new Error("cannot modify pre-existing version")
|
||||
e.code = "EPUBLISHCONFLICT"
|
||||
e.pkgid = pkgid
|
||||
e.version = version
|
||||
return e
|
||||
}
|
||||
|
||||
10
node_modules/npm-registry-client/package.json
generated
vendored
10
node_modules/npm-registry-client/package.json
generated
vendored
@@ -6,7 +6,7 @@
|
||||
},
|
||||
"name": "npm-registry-client",
|
||||
"description": "Client for the npm registry",
|
||||
"version": "0.3.6",
|
||||
"version": "0.4.0",
|
||||
"repository": {
|
||||
"url": "git://github.com/isaacs/npm-registry-client"
|
||||
},
|
||||
@@ -38,6 +38,10 @@
|
||||
"url": "https://github.com/isaacs/npm-registry-client/issues"
|
||||
},
|
||||
"homepage": "https://github.com/isaacs/npm-registry-client",
|
||||
"_id": "npm-registry-client@0.3.6",
|
||||
"_from": "npm-registry-client@latest"
|
||||
"_id": "npm-registry-client@0.4.0",
|
||||
"dist": {
|
||||
"shasum": "30d0c178b7f2e54183a6a3fc9fe4071eb10290bf"
|
||||
},
|
||||
"_from": "npm-registry-client@0.4.0",
|
||||
"_resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-0.4.0.tgz"
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
"chownr": "0",
|
||||
"npmlog": "0.0.6",
|
||||
"ansi": "~0.2.1",
|
||||
"npm-registry-client": "~0.3.6",
|
||||
"npm-registry-client": "~0.4.0",
|
||||
"read-package-json": "~1.1.7",
|
||||
"read-installed": "~0.2.2",
|
||||
"glob": "~3.2.6",
|
||||
|
||||
Reference in New Issue
Block a user