2011-11-27 01:21:03 +08:00
<!doctype html>
< html >
< title > registry< / title >
< meta http-equiv = "content-type" value = "text/html;utf-8" >
2012-08-02 10:10:42 +08:00
< link rel = "stylesheet" type = "text/css" href = "../static/style.css" >
2011-11-27 01:21:03 +08:00
< body >
< div id = "wrapper" >
< h1 > < a href = "../doc/registry.html" > registry< / a > < / h1 > < p > The JavaScript Package Registry< / p >
< h2 id = "DESCRIPTION" > DESCRIPTION< / h2 >
< p > To resolve packages by name and version, npm talks to a registry website
that implements the CommonJS Package Registry specification for reading
package info.< / p >
2012-08-07 04:07:31 +08:00
< p > Additionally, npm' s package registry implementation supports several
2011-11-27 01:21:03 +08:00
write APIs as well, to allow for publishing packages and managing user
account information.< / p >
< p > The official public npm registry is at < a href = "http://registry.npmjs.org/" > http://registry.npmjs.org/< / a > . It
is powered by a CouchDB database at
2011-12-01 08:45:26 +08:00
< a href = "http://isaacs.iriscouch.com/registry" > http://isaacs.iriscouch.com/registry< / a > . The code for the couchapp is
2011-11-27 01:21:03 +08:00
available at < a href = "http://github.com/isaacs/npmjs.org" > http://github.com/isaacs/npmjs.org< / a > . npm user accounts
2011-12-01 08:45:26 +08:00
are CouchDB users, stored in the < a href = "http://isaacs.iriscouch.com/_users" > http://isaacs.iriscouch.com/_users< / a >
2011-11-27 01:21:03 +08:00
database.< / p >
< p > The registry URL is supplied by the < code > registry< / code > config parameter. See
2012-08-07 04:07:31 +08:00
< code > < a href = "../doc/config.html" > config(1)< / a > < / code > for more on managing npm' s configuration.< / p >
2011-11-27 01:21:03 +08:00
< h2 id = "Can-I-run-my-own-private-registry" > Can I run my own private registry?< / h2 >
< p > Yes!< / p >
< p > The easiest way is to replicate the couch database, and use the same (or
similar) design doc to implement the APIs.< / p >
< p > If you set up continuous replication from the official CouchDB, and then
2012-08-07 04:07:31 +08:00
set your internal CouchDB as the registry config, then you' ll be able
2011-11-27 01:21:03 +08:00
to read any published packages, in addition to your private ones, and by
default will only publish internally. If you then want to publish a
package for the whole world to see, you can simply override the
< code > --registry< / code > config for that command.< / p >
2012-08-07 04:07:31 +08:00
< h2 id = "I-don-t-want-my-package-published-in-the-official-registry-It-s-private" > I don' t want my package published in the official registry. It' s private.< / h2 >
2011-11-27 01:21:03 +08:00
2012-08-07 04:07:31 +08:00
< p > Set < code > " private" : true< / code > in your package.json to prevent it from being
2011-11-27 01:21:03 +08:00
published at all, or
2012-08-07 04:07:31 +08:00
< code > " publishConfig" :{" registry" :" http://my-internal-registry.local" }< / code >
2011-11-27 01:21:03 +08:00
to force it to be published only to your internal registry.< / p >
< p > See < code > < a href = "../doc/json.html" > json(1)< / a > < / code > for more info on what goes in the package.json file.< / p >
< h2 id = "Will-you-replicate-from-my-registry-into-the-public-one" > Will you replicate from my registry into the public one?< / h2 >
< p > No. If you want things to be public, then publish them into the public
registry using npm. What little security there is would be for nought
otherwise.< / p >
< h2 id = "Do-I-have-to-use-couchdb-to-build-a-registry-that-npm-can-talk-to" > Do I have to use couchdb to build a registry that npm can talk to?< / h2 >
2012-08-07 04:07:31 +08:00
< p > No, but it' s way easier.< / p >
2011-11-27 01:21:03 +08:00
< h2 id = "I-published-something-elsewhere-and-want-to-tell-the-npm-registry-about-it" > I published something elsewhere, and want to tell the npm registry about it.< / h2 >
2012-08-07 04:07:31 +08:00
< p > That is supported, but not using the npm client. You' ll have to get
2011-11-27 01:21:03 +08:00
your hands dirty and do some HTTP. The request looks something like
this:< / p >
< pre > < code > PUT /my-foreign-package
content-type:application/json
accept:application/json
authorization:Basic $base_64_encoded
2012-08-07 04:07:31 +08:00
{ " name" :" my-foreign-package"
, " maintainers" :[" owner" ," usernames" ]
, " description" :" A package that is hosted elsewhere"
, " keywords" :[" nih" ," my cheese smells the best" ]
, " url" :" http://my-different-registry.com/blerg/my-local-package"
2011-11-27 01:21:03 +08:00
}< / code > < / pre >
< p > (Keywords and description are optional, but recommended. Name,
maintainers, and url are required.)< / p >
2012-08-07 04:07:31 +08:00
< p > Then, when a user tries to install " my-foreign-package" , it' ll redirect
to your registry. If that doesn' t resolve to a valid package entry,
then it' ll fail, so please make sure that you understand the spec, and
2011-11-27 01:21:03 +08:00
ask for help on the < a href = "mailto:npm-@googlegroups.com" > npm-@googlegroups.com< / a > mailing list.< / p >
< h2 id = "Is-there-a-website-or-something-to-see-package-docs-and-such" > Is there a website or something to see package docs and such?< / h2 >
2012-12-22 00:42:29 +08:00
< p > Yes, head over to < a href = "https://npmjs.org/" > https://npmjs.org/< / a > < / p >
2011-11-27 01:21:03 +08:00
< h2 id = "SEE-ALSO" > SEE ALSO< / h2 >
2012-01-05 07:09:13 +08:00
< ul > < li > < a href = "../doc/config.html" > config(1)< / a > < / li > < li > < a href = "../doc/developers.html" > developers(1)< / a > < / li > < li > < a href = "../doc/disputes.html" > disputes(1)< / a > < / li > < / ul >
2011-11-27 01:21:03 +08:00
< / div >
2013-02-20 05:18:36 +08:00
< p id = "footer" > registry — npm@1.2.12< / p >
2011-11-27 01:21:03 +08:00
< script >
;(function () {
var wrapper = document.getElementById("wrapper")
var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
.filter(function (el) {
return el.parentNode === wrapper
& & el.tagName.match(/H[1-6]/)
& & el.id
})
var l = 2
, toc = document.createElement("ul")
toc.innerHTML = els.map(function (el) {
var i = el.tagName.charAt(1)
, out = ""
while (i > l) {
out += "< ul > "
l ++
}
while (i < l ) {
out += "< / ul > "
l --
}
out += "< li > < a href = '#" + el.id + "' > " +
( el.innerText || el.text || el.innerHTML)
+ "< / a > "
return out
}).join("\n")
toc.id = "toc"
document.body.appendChild(toc)
})()
< / script >
< / body > < / html >