Permalink
Browse files

Merge branch 'master' of git://github.com/bmeck/npm into bmeck-search

  • Loading branch information...
2 parents 73d63d1 + ee75881 commit 0a7c4832df9107a1f46259ca9dc97a0b6c388f67 @isaacs isaacs committed Jul 11, 2010
Showing with 2,406 additions and 1,060 deletions.
  1. +3 −0 .gitignore
  2. +17 −8 Makefile
  3. +7 −19 README.md
  4. +31 −13 cli.js
  5. +11 −17 doc/adduser.md
  6. +27 −0 doc/future-ideas/deploy.md
  7. +23 −0 doc/future-ideas/remote.md
  8. +58 −0 doc/future-ideas/site.md
  9. +31 −9 doc/help.md
  10. +98 −40 doc/json.md
  11. +123 −6 doc/list.md
  12. +9 −0 doc/npm.md
  13. +0 −24 doc/search.md
  14. +36 −0 html/index.html
  15. BIN html/npm-fin.png
  16. BIN html/npm-large.png
  17. BIN html/npm.png
  18. +47 −15 lib/adduser.js
  19. +10 −3 lib/build.js
  20. +3 −3 lib/config.js
  21. +0 −1 lib/help.js
  22. +48 −19 lib/install.js
  23. +9 −3 lib/link.js
  24. +303 −54 lib/ls.js
  25. +375 −0 lib/mustache.js
  26. +1 −0 lib/publish.js
  27. +1 −1 lib/uninstall.js
  28. +23 −0 lib/utils/default-config.js
  29. +22 −18 lib/utils/exec.js
  30. +5 −5 lib/utils/fetch.js
  31. +20 −36 lib/utils/ini.js
  32. +3 −6 lib/utils/lifecycle.js
  33. +39 −0 lib/utils/promise-chain.js
  34. +27 −0 lib/utils/prompt.js
  35. +65 −46 lib/utils/read-json.js
  36. +53 −14 lib/utils/registry/adduser.js
  37. +12 −10 lib/utils/registry/request.js
  38. +6 −2 lib/utils/semver.js
  39. +4 −0 lib/utils/set.js
  40. +5 −4 man/activate.1
  41. +10 −29 man/adduser.1
  42. +8 −9 man/build.1
  43. +18 −24 man/cache.1
  44. +34 −52 man/coding-style.1
  45. +31 −40 man/config.1
  46. +5 −5 man/deactivate.1
  47. +51 −68 man/developers.1
  48. +14 −17 man/folders.1
  49. +49 −0 man/future-ideas/deploy.1
  50. +27 −0 man/future-ideas/remote.1
  51. +63 −0 man/future-ideas/site.1
  52. +7 −22 man/help.1
  53. +28 −34 man/install.1
  54. +133 −104 man/json.1
  55. +6 −8 man/link.1
  56. +22 −13 man/list.1
  57. +6 −8 man/ln.1
  58. +22 −13 man/ls.1
  59. +84 −83 man/npm.1
  60. +8 −9 man/publish.1
  61. +9 −15 man/registry.1
  62. +8 −6 man/restart.1
  63. +6 −7 man/rm.1
  64. +33 −43 man/scripts.1
  65. +0 −33 man/search.1
  66. +6 −5 man/start.1
  67. +6 −5 man/stop.1
  68. +7 −9 man/tag.1
  69. +6 −5 man/test.1
  70. +6 −7 man/uninstall.1
  71. +5 −5 man/unpublish.1
  72. +10 −3 npm.js
  73. +6 −2 package.json
  74. +2 −1 scripts/install-docs.js
  75. +9 −0 scripts/install.sh
  76. +7 −0 test/common.js
  77. +1 −0 test/packages/mjsunit.runner/package.json
  78. +96 −0 test/run.sh
  79. +2 −0 test/test-npm-installed.js
View
@@ -0,0 +1,3 @@
+output.log
+test/root
+test/bin
View
@@ -1,8 +1,11 @@
-docs = $(shell ls doc/*.md \
- |sed 's|.md|.1|g' \
- |sed 's|doc/|man/|g' \
- )
+docs = $(shell find doc -name '*.md' \
+ |sed 's|.md|.1|g' \
+ |sed 's|doc/|man/|g' \
+ )
+doc_subfolders = $(shell find doc -type d \
+ |sed 's|doc/|man/|g' \
+ )
install-stable:
./cli.js --auto-activate always install npm@stable
@@ -17,13 +20,19 @@ uninstall:
./cli.js cache clean
./cli.js rm npm
-man:
- @mkdir man
+man: $(doc_subfolders)
+ @if ! test -d man ; then mkdir -p man ; fi
doc: man $(docs)
@true
man/%.1: doc/%.md
- ronn --roff $< > $@
+ ronn --roff --pipe $< > $@
-.PHONY: install install-stable link doc clean uninstall
+man/%/: doc/%/
+ @if ! test -d $@ ; then mkdir -p $@ ; fi
+
+test:
+ ./test/run.sh
+
+.PHONY: install install-stable link doc clean uninstall test
View
@@ -6,19 +6,15 @@ More info available via `man npm`.
## Simple Install
-To install npm, create a folder where you want to put the code, and then
-cd there, and do this:
+To install npm, do this:
- curl -L http://github.com/isaacs/npm/tarball/master | tar xz --strip 1
- cd npm
- make
+ curl http://npmjs.org/install.sh | sh
If it dies with a "Permission Denied" or EACCESS error, then that probably
means that you are running node in a shared root-owned location. In that
-case, you'll have to use sudo, and it'll behave like a multi-user app.
+case, you'll have to use sudo.
-You can customize this behavior by using the `root` and `binroot` config
-options. See npm-config(1)
+ curl http://npmjs.org/install.sh | sudo sh
## More Fancy Installing
@@ -55,17 +51,9 @@ Or, if that fails,
Check out the [docs](http://github.com/isaacs/npm/blob/master/doc/).
+You can use the [npm help](http://github.com/isaacs/npm/blob/master/doc/help.md#readme)
+command to read any of them.
+
If you're a developer, and you want to use npm to publish your program,
you should
[read this](http://github.com/isaacs/npm/blob/master/doc/developers.md#readme)
-
-## A note about password security
-
-In order to publish your packages, you must have your auth info
-saved into your .npmrc file. If Cipher and Decipher are supported
-in the "crypto" module, then npm will use them. However, as of
-node 0.1.95, these functions aren't integrated yet.
-
-You can get around this by doing:
-
- npm install crypto@0.0.5
View
44 cli.js
@@ -2,13 +2,16 @@
// don't assume that npm is installed in any particular spot, since this
// might conceivably be a bootstrap attempt.
+var log = require("./lib/utils/log")
+
+log("ok", "it worked if it ends with")
+
var fs = require("fs")
, path = require("path")
, sys = require("sys")
, npm = require("./npm")
// supported commands.
- , log = require("./lib/utils/log")
, argv = process.argv.slice(2)
, arg = ""
@@ -19,7 +22,6 @@ var fs = require("fs")
, flagsDone
log(sys.inspect(argv), "cli")
-log(npm.version, "version")
while (arg = argv.shift()) {
if (!command && (arg in npm.commands)) {
@@ -41,9 +43,19 @@ if (key) conf[key] = true
npm.argv = arglist
for (var k in conf) npm.config.set(k, conf[k])
-process.addListener("uncaughtException", errorHandler)
+var vindex = arglist.indexOf("-v")
+ , printVersion = vindex !== -1 || conf.version
+if (printVersion) {
+ sys.puts(npm.version)
+ if (vindex !== -1) arglist.splice(vindex, 1)
+} else log(npm.version, "version")
+
+process.on("uncaughtException", errorHandler)
+process.on("exit", function () { if (!itWorked) log("not ok") })
+
+var itWorked = false
-if (!command) {
+if (!command) { if (!printVersion) {
// npm.commands.help([arglist.join(" ")])
if (arglist.length) log(arglist, "unknown command")
sys.error( "What do you want me to do?\n\n"
@@ -52,16 +64,22 @@ if (!command) {
+ "Check 'man npm' or 'man npm-help' for more information\n\n"
+ "This is supposed to happen. "
)
-} else npm.commands[command](arglist, errorHandler)
+ process.exit(1)
+}} else npm.commands[command](arglist, errorHandler)
function errorHandler (er) {
- if (er) {
- sys.error("")
- log(er, "!")
- sys.error("")
- log("try running: 'npm help "+command+"'", "failure")
- log("Report this *entire* log at <http://github.com/isaacs/npm/issues>", "failure")
- log("or email it to <npm-@googlegroups.com>", "failure")
- } else log("ok")
+ if (!er) {
+ itWorked = true
+ log("ok")
+ if (npm.SHOULD_EXIT) process.exit()
+ return
+ }
+ sys.error("")
+ log(er, "!")
+ sys.error("")
+ log("try running: 'npm help "+command+"'", "failure")
+ log("Report this *entire* log at <http://github.com/isaacs/npm/issues>", "failure")
+ log("or email it to <npm-@googlegroups.com>", "failure")
+ process.exit(1)
}
View
@@ -3,26 +3,20 @@ npm-adduser(1) -- Add a registry user account
## SYNOPSIS
- npm adduser <username> <password> <email>
+ npm adduser
## DESCRIPTION
-Create a user named `<username>` in the npm registry, and save the
-credentials to the `.npmrc` file. Note that this leaves the password
-in your `.bash_history`, and it is currently stored in the clear in
-the config file. So, don't use a password you care too much about.
+Create or verify a user named `<username>` in the npm registry, and
+save the credentials to the `.npmrc` file.
-For now, if you somehow break your `.npmrc` file, and have forgotten your
-password, you're boned. Send an email to i@izs.me and I'll delete the
-record from the registry so that you can re-add it.
+The username, password, and email are read in from prompts. This command
+cannot be scripted. If you think you need to script the creation of new
+users, or the authorization of existing ones, without human intervention,
+please rethink your use case. That's a very bad idea.
-If you break your `.npmrc` file, but you remember your password, you
-can put your user auth back by using the `base64` program like so:
+You may use this command to change your email address, but not username
+or password.
- npm config set auth $( echo user:pass | base64 )
-
-Install base64 using whichever method you normally use to put programs on
-your computer. (apt-get, homebrew, macports, yum, or just download the
-code and build it yourself.)
-
-Or bug me to to remove your account, and then recreate it.
+You may use this command multiple times with the same user account to
+authorize on a new machine.
View
@@ -0,0 +1,27 @@
+npm-deploy(1) -- Deploy a package to a remote host
+==================================================
+
+## FUTURE
+
+This functionality does not yet exist.
+
+## SUMMARY
+
+ npm deploy <pkg> [--host <hostname>]
+
+## DESCRIPTION
+
+This is a porcelain command. It is equivalent to doing:
+
+ npm publish --registry $(npm config get host) <pkg>
+ npm remote install <pkg-name>@<pkg-version>
+
+That is, it first publishes the package to the server specified
+by the `host` config, and then remotely installs that package
+on the host.
+
+## SEE ALSO
+
+* npm-remote(1)
+* npm-site(1)
+* npm-publish(1)
View
@@ -0,0 +1,23 @@
+npm-remote(1) -- Execute commands on a remote machine
+=====================================================
+
+## FUTURE
+
+This functionality does not yet exist.
+
+## SYNOPSIS
+
+ npm remote <commands>
+
+## DESCRIPTION
+
+Run a command on a remote npm site instance.
+
+In order to do this, the current authenticated user must be in
+the "admin" list on the server, and it must be running with https
+support.
+
+It uses the `host` config to know where to do things.
+
+
+
View
@@ -0,0 +1,58 @@
+npm-site(1) -- Run the npm web site
+===================================
+
+## FUTURE
+
+This functionality does not yet exist.
+
+## SYNOPSIS
+
+ npm site [ start | stop ]
+
+## DESCRIPTION
+
+This starts up npm in "site" mode. The following configs are relevant,
+and can either be specified in the `.npmrc` file, or as command line
+options.
+
+* userfile:
+ A file containing the encrypted authorization info for all users. If
+ specified, then this is used for `npm adduser` requests
+ to this registry.
+* admin:
+ A comma-delimited list of admin users. All of these must already be
+ in the local adduser config. If there is no admin, then the site will
+ not allow remote management. All admin usernames must already be
+ in the userfile, and a userfile must be specified.
+* listen:
+ Ports to listen on for WS requests. The first number is for http,
+ the second for https, and the third for secure TCP. Set any to "-",
+ or omit, to use the default.
+ Defaults to "80,443,15443"
+* registry:
+ If a package is not found, then its contents will be fetched from the
+ upstream registry, and cached for future retrieval.
+
+ isaacs: Make sure that this does loop-detection, so that a "ring" of
+ registries can work as a distributed network. Also, once we have
+ support for checking multiple registries, you could have a distribution
+ ring that secondarily depends on some other upstream resource.
+
+The content for the site is stored in the npm cache directory, which is
+inside the folder used for the `root` setting, at `{root}/.npm/.cache`.
+It is organized in a simple hierarchical folder structure corresponding
+to the web service URLs that npm uses.
+
+## TCP Server
+
+The TCP server starts up to support the `npm remote` command, if there is
+a valid admin userlist.
+
+## NOTE
+
+This also is what happens when you do `npm start npm`.
+
+## SEE ALSO
+
+* npm-remote(1)
+* npm-config(1)
View
@@ -5,16 +5,38 @@ npm-help(1) -- Get help about npm commands
npm help <section>
-Where `<section>` is one of:
-`activate`, `adduser`, `build`, `config`, `deactivate`, `folders`, `help`
-(this page), `install`, `json`, `link` (or `ln`), `list` (or `ls`), `npm`,
-`publish`, `registry`, `scripts`, `tag`, `uninstall` (or `rm`),
-`developers`, `coding-style`
+Where `<section>` is one of:
+activate
+adduser
+build
+cache
+coding-style
+config
+deactivate
+developers
+folders
+help
+install
+json
+link
+list
+ln
+ls
+npm
+publish
+registry
+restart
+rm
+scripts
+start
+stop
+tag
+test
+uninstall
+unpublish
-Note that you can get the exact same help content by doing:
-
- man npm-<section>
## Todo
-It'd be nice if this page was automatically generated.
+It'd be nice if this page was automatically generated so that it stays
+up to date better.
Oops, something went wrong.

0 comments on commit 0a7c483

Please sign in to comment.