Browse files

Merge branch 'api-doc' into api-doc2

Conflicts:
	Makefile
	doc/cli/find.md
	lib/help.js
	man/man1/adduser.1
	man/man1/bin.1
	man/man1/build.1
	man/man1/bundle.1
	man/man1/cache.1
	man/man1/changelog.1
	man/man1/coding-style.1
	man/man1/completion.1
	man/man1/config.1
	man/man1/developers.1
	man/man1/docs.1
	man/man1/faq.1
	man/man1/find.1
	man/man1/folders.1
	man/man1/get.1
	man/man1/global.1
	man/man1/help-search.1
	man/man1/home.1
	man/man1/init.1
	man/man1/install.1
	man/man1/json.1
	man/man1/link.1
	man/man1/ln.1
	man/man1/npm.1
	man/man1/outdated.1
	man/man1/prefix.1
	man/man1/registry.1
	man/man1/removing-npm.1
	man/man1/rm.1
	man/man1/root.1
	man/man1/run-script.1
	man/man1/scripts.1
	man/man1/search.1
	man/man1/semver.1
	man/man1/set.1
	man/man1/tag.1
	man/man1/uninstall.1
	man/man1/update.1
	man/man1/version.1
	man/man1/whoami.1
	man/man3/author.3
	man/man3/deprecate.3
	man/man3/edit.3
	man/man3/explore.3
	man/man3/list.3
	man/man3/ls.3
	man/man3/owner.3
	man/man3/pack.3
	man/man3/prune.3
	man/man3/publish.3
	man/man3/rebuild.3
	man/man3/restart.3
	man/man3/start.3
	man/man3/stop.3
	man/man3/submodule.3
	man/man3/test.3
	man/man3/unpublish.3
	man/man3/view.3
	npm.js
  • Loading branch information...
2 parents a726b94 + 12e22fb commit 308dd4254715f7845a1d2f84b05bc51cfb018890 @isaacs isaacs committed Sep 24, 2011
Showing with 1,369 additions and 51 deletions.
  1. +3 −2 .gitignore
  2. +55 −22 Makefile
  3. 0 doc/{ → api}/author.md
  4. +15 −0 doc/api/bin.md
  5. +70 −0 doc/api/commands.md
  6. +26 −0 doc/api/config.md
  7. +20 −0 doc/api/deprecate.md
  8. +19 −0 doc/api/docs.md
  9. +24 −0 doc/api/edit.md
  10. +18 −0 doc/api/explore.md
  11. +1 −0 doc/api/find.md
  12. 0 doc/{ → api}/get.md
  13. +30 −0 doc/api/help-search.md
  14. 0 doc/{ → api}/home.md
  15. +29 −0 doc/api/init.md
  16. +19 −0 doc/api/install.md
  17. +33 −0 doc/api/link.md
  18. +1 −0 doc/api/list.md
  19. +1 −0 doc/api/ln.md
  20. +26 −0 doc/api/load.md
  21. +50 −0 doc/api/ls.md
  22. +30 −0 doc/api/npm.md
  23. +13 −0 doc/api/outdated.md
  24. +31 −0 doc/api/owner.md
  25. +19 −0 doc/api/pack.md
  26. +15 −0 doc/api/prefix.md
  27. +17 −0 doc/api/prune.md
  28. +30 −0 doc/api/publish.md
  29. +16 −0 doc/api/rebuild.md
  30. +22 −0 doc/api/restart.md
  31. +1 −0 doc/api/rm.md
  32. +15 −0 doc/api/root.md
  33. +27 −0 doc/api/run-script.md
  34. +35 −0 doc/api/search.md
  35. 0 doc/{ → api}/set.md
  36. +13 −0 doc/api/start.md
  37. +13 −0 doc/api/stop.md
  38. +28 −0 doc/api/submodule.md
  39. +23 −0 doc/api/tag.md
  40. +16 −0 doc/api/test.md
  41. +16 −0 doc/api/uninstall.md
  42. +20 −0 doc/api/unpublish.md
  43. +11 −0 doc/api/update.md
  44. +18 −0 doc/api/version.md
  45. +82 −0 doc/api/view.md
  46. +15 −0 doc/api/whoami.md
  47. 0 doc/{ → cli}/adduser.md
  48. +1 −0 doc/cli/author.md
  49. 0 doc/{ → cli}/bin.md
  50. 0 doc/{ → cli}/build.md
  51. 0 doc/{ → cli}/bundle.md
  52. 0 doc/{ → cli}/cache.md
  53. 0 doc/{ → cli}/changelog.md
  54. 0 doc/{ → cli}/coding-style.md
  55. 0 doc/{ → cli}/completion.md
  56. 0 doc/{ → cli}/config.md
  57. 0 doc/{ → cli}/deprecate.md
  58. 0 doc/{ → cli}/developers.md
  59. 0 doc/{ → cli}/docs.md
  60. 0 doc/{ → cli}/edit.md
  61. 0 doc/{ → cli}/explore.md
  62. 0 doc/{ → cli}/faq.md
  63. +1 −0 doc/cli/find.md
  64. 0 doc/{ → cli}/folders.md
  65. +1 −0 doc/cli/get.md
  66. 0 doc/{ → cli}/global.md
  67. 0 doc/{ → cli}/help-search.md
  68. +1 −0 doc/cli/home.md
  69. 0 doc/{ → cli}/init.md
  70. 0 doc/{ → cli}/install.md
  71. 0 doc/{ → cli}/json.md
  72. 0 doc/{ → cli}/link.md
  73. 0 doc/{ → cli}/list.md
  74. 0 doc/{ → cli}/ln.md
  75. 0 doc/{ → cli}/ls.md
  76. 0 doc/{ → cli}/npm.md
  77. 0 doc/{ → cli}/outdated.md
  78. 0 doc/{ → cli}/owner.md
  79. 0 doc/{ → cli}/pack.md
  80. 0 doc/{ → cli}/prefix.md
  81. 0 doc/{ → cli}/prune.md
  82. 0 doc/{ → cli}/publish.md
  83. 0 doc/{ → cli}/rebuild.md
  84. 0 doc/{ → cli}/registry.md
  85. 0 doc/{ → cli}/removing-npm.md
  86. 0 doc/{ → cli}/restart.md
  87. 0 doc/{ → cli}/rm.md
  88. 0 doc/{ → cli}/root.md
  89. 0 doc/{ → cli}/run-script.md
  90. 0 doc/{ → cli}/scripts.md
  91. 0 doc/{ → cli}/search.md
  92. 0 doc/{ → cli}/semver.md
  93. +1 −0 doc/cli/set.md
  94. 0 doc/{ → cli}/start.md
  95. 0 doc/{ → cli}/stop.md
  96. 0 doc/{ → cli}/submodule.md
  97. 0 doc/{ → cli}/tag.md
  98. 0 doc/{ → cli}/test.md
  99. 0 doc/{ → cli}/uninstall.md
  100. 0 doc/{ → cli}/unpublish.md
  101. 0 doc/{ → cli}/update.md
  102. 0 doc/{ → cli}/version.md
  103. 0 doc/{ → cli}/view.md
  104. 0 doc/{ → cli}/whoami.md
  105. BIN html/api/GubbleBum-Blocky.ttf
  106. +336 −0 html/api/style.css
  107. +12 −2 lib/help-search.js
  108. +33 −12 lib/help.js
  109. +1 −0 npm.js
  110. +1 −1 package.json
  111. +15 −12 scripts/doc-build.sh
View
5 .gitignore
@@ -8,6 +8,7 @@ test/root
node_modules/ronn
node_modules/.bin
npm-debug.log
+html/api/*.html
html/doc/*.html
-man1/*.1
-doc/index.md
+man/
+doc/*/index.md
View
77 Makefile
@@ -2,22 +2,30 @@ SHELL = bash
markdowns = $(shell find doc -name '*.md' | grep -v 'index') README.md
-mandocs = $(shell find doc -name '*.md' \
- |grep -v 'index.md' \
- |sed 's|.md|.1|g' \
- |sed 's|doc/|man1/|g' ) \
- man1/README.1 \
- man1/index.1
-
-htmldocs = $(shell find doc -name '*.md' \
- |grep -v 'index.md' \
- |sed 's|.md|.html|g' \
- |sed 's|doc/|html/doc/|g' ) \
- html/doc/README.html \
- html/doc/index.html
-
-doc_subfolders = $(shell find doc -type d \
- |sed 's|doc/|man1/|g' )
+cli_mandocs = $(shell find doc/cli -name '*.md' \
+ |sed 's|.md|.1|g' \
+ |sed 's|doc/cli/|man/man1/|g' ) \
+ man/man1/README.1 \
+ man/man1/index.1
+
+api_mandocs = $(shell find doc/api -name '*.md' \
+ |sed 's|.md|.3|g' \
+ |sed 's|doc/api/|man/man3/|g' )
+
+cli_htmldocs = $(shell find doc/cli -name '*.md' \
+ |grep -v 'index.md' \
+ |sed 's|.md|.html|g' \
+ |sed 's|doc/cli/|html/doc/|g' ) \
+ html/doc/README.html \
+ html/doc/index.html
+
+api_htmldocs = $(shell find doc/api -name '*.md' \
+ |sed 's|.md|.html|g' \
+ |sed 's|doc/api/|html/api/|g' )
+
+mandocs = $(api_mandocs) $(cli_mandocs)
+
+htmldocs = $(api_htmldocs) $(cli_htmldocs)
all: submodules doc
@@ -49,26 +57,50 @@ doc: node_modules/ronn $(mandocs) $(htmldocs)
docclean: doc-clean
doc-clean:
- rm -rf node_modules/ronn doc/index.md $(mandocs) $(htmldocs) &>/dev/null || true
+ rm -rf \
+ node_modules/ronn \
+ doc/cli/index.md \
+ doc/api/index.md \
+ $(api_mandocs) \
+ $(cli_mandocs) \
+ $(api_htmldocs) \
+ $(cli_htmldocs) \
+ &>/dev/null || true
node_modules/ronn:
node cli.js install git+https://github.com/isaacs/ronnjs.git
# use `npm install ronn` for this to work.
-man1/README.1: README.md scripts/doc-build.sh package.json
+man/man1/README.1: README.md scripts/doc-build.sh package.json
+ scripts/doc-build.sh $< $@
+
+man/man1/%.1: doc/%.md scripts/doc-build.sh package.json
scripts/doc-build.sh $< $@
-man1/%.1: doc/%.md scripts/doc-build.sh package.json
+man/man3/%.3: doc/api/%.md man/man3 node_modules/ronn
scripts/doc-build.sh $< $@
html/doc/README.html: README.md html/dochead.html html/docfoot.html scripts/doc-build.sh package.json
scripts/doc-build.sh $< $@
-html/doc/%.html: doc/%.md html/dochead.html html/docfoot.html scripts/doc-build.sh package.json
+html/doc/%.html: doc/cli/%.md html/dochead.html html/docfoot.html scripts/doc-build.sh package.json
scripts/doc-build.sh $< $@
-doc/index.md: $(markdowns) scripts/index-build.js scripts/doc-build.sh package.json
- node scripts/index-build.js > doc/index.md
+html/api/%.html: doc/api/%.md html/dochead.html html/docfoot.html scripts/doc-build.sh package.json
+ scripts/doc-build.sh $< $@
+
+doc/cli/index.md: $(markdowns) scripts/index-build.js scripts/doc-build.sh package.json
+ node scripts/index-build.js > $@
+
+doc: man
+
+man: $(cli_docs) $(api_docs)
+
+man/man1:
+ [ -d man/man1 ] || mkdir -p man/man1
+
+man/man3:
+ [ -d man/man3 ] || mkdir -p man/man3
test: submodules
node cli.js test
@@ -86,6 +118,7 @@ publish: link
docpublish: doc-publish
doc-publish: doc
rsync -vazu --stats --no-implied-dirs --delete html/doc/ npmjs.org:/var/www/npmjs.org/public/doc
+ rsync -vazu --stats --no-implied-dirs --delete html/api/ npmjs.org:/var/www/npmjs.org/public/api
sandwich:
@[ $$(whoami) = "root" ] && (echo "ok"; echo "ham" > sandwich) || echo "make it yourself"
View
0 doc/author.md → doc/api/author.md
File renamed without changes.
View
15 doc/api/bin.md
@@ -0,0 +1,15 @@
+npm-bin(3) -- Display npm bin folder
+====================================
+
+## SYNOPSIS
+
+ npm.commands.bin(args, callback)
+
+## DESCRIPTION
+
+Print the folder where npm will install executables.
+
+'args' is never used and callback is never called with data.
+'args' must be present or things will break.
+
+This function is not useful programmatically.
View
70 doc/api/commands.md
@@ -0,0 +1,70 @@
+npm-commands(3) -- npm commands
+===============================
+
+## SYNOPSIS
+
+ npm.commands.<command>(args, callback)
+
+## DESCRIPTION
+
+npm comes with a full set of commands, and each of the commands takes a
+similar set of arguments.
+
+In general, all commands on the command object take an **array** of positional
+argument **strings**. The last argument to any function is a callback. Some
+commands are special and take other optional arguments.
+
+All commands have their own man page. See `man npm-<command>` for command-line
+usage, or `man 3 npm-<command>` for programmatic usage.
+
+## COMMANDS
+
+### install
+
+Install a package.
+
+* "install"
+* "uninstall"
+ "cache"
+* "config"
+* "set"
+* "get"
+* "update"
+* "outdated"
+* "prune"
+* "submodule"
+* "pack"
+
+* "rebuild"
+* "link"
+
+* "publish"
+* "tag"
+ "adduser"
+* "unpublish"
+* "owner"
+* "deprecate"
+
+ "help"
+* "help-search"
+* "ls"
+* "search"
+* "view"
+* "init"
+* "version"
+* "edit"
+* "explore"
+* "docs"
+ "faq"
+* "root"
+* "prefix"
+* "bin"
+* "whoami"
+
+* "test"
+* "stop"
+* "start"
+* "restart"
+* "run-script"
+ "completion"
+
View
26 doc/api/config.md
@@ -0,0 +1,26 @@
+npm-config(3) -- Manage the npm configuration file
+==================================================
+
+## SYNOPSIS
+
+ npm.commands.config(args, callback)
+
+## DESCRIPTION
+
+This function acts much the same way as the command-line version. The first
+element in the array tells config what to do. Possible values are:
+
+* 'set':
+ Sets a config parameter. The second element in 'args' is interpreted as the
+ key, and the third element is interpreted as the value.
+* 'get':
+ Gets the value of a config parameter. The second element in 'args' is the
+ key to get the value of.
+* 'delete' ('rm' or 'del'):
+ Deletes a parameter from the config. The second element in 'args' is the
+ key to delete.
+* 'list' ('ls'):
+ Show all configs that aren't secret. No parameters necessary.
+* 'edit':
+ Opens the config file in the default editor. This command isn't very useful
+ programmatically, but it is made available.
View
20 doc/api/deprecate.md
@@ -0,0 +1,20 @@
+npm-deprecate(3) -- Deprecate a version of a package
+====================================================
+
+## SYNOPSIS
+
+ npm.commands.deprecate(args, callback)
+
+## DESCRIPTION
+
+This command will update the npm registry entry for a package, providing
+a deprecation warning to all who attempt to install it.
+
+The 'args' parameter must have exactly two elements:
+
+* package@version:
+ To specify a range, wrap the version in quotes (e.g. pkg@"< 1.2")
+* message
+
+Note that you must be the package owner to deprecate something. See the
+`owner` and `adduser` help topics.
View
19 doc/api/docs.md
@@ -0,0 +1,19 @@
+npm-docs(3) -- Docs for a package in a web browser maybe
+========================================================
+
+## SYNOPSIS
+
+ npm.commands.docs(package, callback)
+
+## DESCRIPTION
+
+This command tries to guess at the likely location of a package's
+documentation URL, and then tries to open it using the `--browser`
+config param.
+
+Like other commands, the first parameter is an array. This command only
+uses the first element, which is expected to be a package name with an
+optional version number.
+
+This command will launch a browser, so this command may not be the most
+friendly for programmatic use.
View
24 doc/api/edit.md
@@ -0,0 +1,24 @@
+npm-edit(3) -- Edit an installed package
+========================================
+
+## SYNOPSIS
+
+ npm.commands.edit(package, callback)
+
+## DESCRIPTION
+
+Opens the package folder in the default editor (or whatever you've
+configured as the npm `editor` config -- see `npm help config`.)
+
+After it has been edited, the package is rebuilt so as to pick up any
+changes in compiled packages.
+
+For instance, you can do `npm install connect` to install connect
+into your package, and then `npm.commands.edit(["connect"], callback)`
+to make a few changes to your locally installed copy.
+
+The first parameter is a string array with a single element, the package
+to open. The package can optionally have a version number attached.
+
+Since this command opens an editor in a new process, be careful about where
+and how this is used.
View
18 doc/api/explore.md
@@ -0,0 +1,18 @@
+npm-explore(3) -- Browse an installed package
+=============================================
+
+## SYNOPSIS
+
+ npm.commands.explore(args, callback)
+
+## DESCRIPTION
+
+Spawn a subshell in the directory of the installed package specified.
+
+If a command is specified, then it is run in the subshell, which then
+immediately terminates.
+
+Note that the package is *not* automatically rebuilt afterwards, so be
+sure to use `npm rebuild <pkg>` if you make any changes.
+
+The first element in the 'args' parameter must be a package name. After that is the optional command, which can be any number of strings. All of the strings will be combined into one, space-delimited command.
View
1 doc/api/find.md
View
0 doc/get.md → doc/api/get.md
File renamed without changes.
View
30 doc/api/help-search.md
@@ -0,0 +1,30 @@
+npm-help-search(3) -- Search the help pages
+===========================================
+
+## SYNOPSIS
+
+ npm.commands.helpSearch(args, [silent,] callback)
+
+## DESCRIPTION
+
+This command is rarely useful, but it exists in the rare case that it is.
+
+This command takes an array of search terms and returns the help pages that
+match in order of best match.
+
+If there is only one match, then npm displays that help section. If there
+are multiple results, the results are printed to the screen formatted and the
+array of results is returned. Each result is an object with these properties:
+
+* hits:
+ A map of args to number of hits on that arg. For example, {"npm": 3}
+* found:
+ Total number of unique args that matched.
+* totalHits:
+ Total number of hits.
+* lines:
+ An array of all matching lines (and some adjacent lines).
+* file:
+ Name of the file that matched
+
+The silent parameter is not neccessary not used, but it may in the future.
View
0 doc/home.md → doc/api/home.md
File renamed without changes.
View
29 doc/api/init.md
@@ -0,0 +1,29 @@
+npm init(3) -- Interactively create a package.json file
+=======================================================
+
+## SYNOPSIS
+
+ npm.commands.init(args, callback)
+
+## DESCRIPTION
+
+This will ask you a bunch of questions, and then write a package.json for you.
+
+It attempts to make reasonable guesses about what you want things to be set to,
+and then writes a package.json file with the options you've selected.
+
+If you already have a package.json file, it'll read that first, and default to
+the options in there.
+
+It is strictly additive, so it does not delete options from your package.json
+without a really good reason to do so.
+
+Since this function expects to be run on the command-line, it doesn't work very
+well as a programmatically. The best option is to roll your own, and since
+JavaScript makes it stupid simple to output formatted JSON, that is the
+preferred method. If you're sure you want to handle command-line prompting,
+then go ahead and use this programmatically.
+
+## SEE ALSO
+
+npm-json(1)
View
19 doc/api/install.md
@@ -0,0 +1,19 @@
+npm-install(3) -- install a package programmatically
+====================================================
+
+## SYNOPSIS
+
+ npm.commands.install([where,] packages, callback)
+
+## DESCRIPTION
+
+This acts much the same ways as installing on the command-line.
+
+The 'where' parameter is optional and only used internally, and it specifies
+where the packages should be installed to.
+
+The 'packages' parameter is an array of strings. Each element in the array is
+the name of a package to be installed.
+
+Finally, 'callback' is a function that will be called when all packages have been
+installed or when an error has been encountered.
View
33 doc/api/link.md
@@ -0,0 +1,33 @@
+npm-link(3) -- Symlink a package folder
+=======================================
+
+## SYNOPSIS
+
+ npm.command.link(callback)
+ npm.command.link(packages, callback)
+
+## DESCRIPTION
+
+Package linking is a two-step process.
+
+Without parameters, link will create a globally-installed
+symbolic link from `prefix/package-name` to the current folder.
+
+With a parameters, link will create a symlink from the local `node_modules`
+folder to the global symlink.
+
+When creating tarballs for `npm publish`, the linked packages are
+"snapshotted" to their current state by resolving the symbolic links.
+
+This is
+handy for installing your own stuff, so that you can work on it and test it
+iteratively without having to continually rebuild.
+
+For example:
+
+ npm.commands.link(cb) # creates global link from the cwd
+ # (say redis package)
+ npm.commands.link('redis', cb) # link-install the package
+
+Now, any changes to the redis package will be reflected in
+the package in the current working directory
View
1 doc/api/list.md
View
1 doc/api/ln.md
View
26 doc/api/load.md
@@ -0,0 +1,26 @@
+npm-load(3) -- Load config settings
+===================================
+
+## SYNOPSIS
+
+ npm.load(conf, cb)
+
+## DESCRIPTION
+
+npm.load() must be called before any other function call. Both parameters are
+optional, but the second is recommended.
+
+The first parameter is an object hash of command-line config params, and the
+second parameter is a callback that will be called when npm is loaded and
+ready to serve.
+
+The first parameter should follow a similar structure as the package.json
+config object.
+
+For example, to emulate the --dev flag, pass an object that looks like this:
+
+ {
+ "dev": true
+ }
+
+For a list of all the available command-line configs, see `npm help config`
View
50 doc/api/ls.md
@@ -0,0 +1,50 @@
+npm-ls(3) -- List installed packages
+======================================
+
+## SYNOPSIS
+
+ npm.commands.ls(args, [silent,] callback)
+
+## DESCRIPTION
+
+This command will print to stdout all the versions of packages that are
+installed, as well as their dependencies, in a tree-structure. It will also
+return that data using the callback.
+
+This command does not take any arguments, but args must be defined.
+Beyond that, if any arguments are passed in, npm will politely warn that it
+does not take positional arguments, though you may set config flags
+like with any other command, such as `global` to list global packages.
+
+It will print out extraneous, missing, and invalid packages.
+
+If the silent parameter is set to true, nothing will be output to the screen,
+but the data will still be returned.
+
+## CONFIGURATION
+
+### long
+
+* Default: false
+* Type: Boolean
+
+Show extended information.
+
+### parseable
+
+* Default: false
+* Type: Boolean
+
+Show parseable output instead of tree view.
+
+### global
+
+* Default: false
+* Type: Boolean
+
+List packages in the global install prefix instead of in the current
+project.
+
+Note, if parseable is set or long isn't set, then duplicates will be trimmed.
+This means that if a submodule a same dependency as a parent module, then the
+dependency will only be output once.
View
30 doc/api/npm.md
@@ -0,0 +1,30 @@
+npm(3) -- node package manager
+==============================
+
+## SYNOPSIS
+
+ var npm = require("npm")
+ npm.load(configObject, function (er, npm) {
+ // use the npm object, now that it's loaded.
+ })
+
+## DESCRIPTION
+
+Since you're looking at this man page, you are probably wanting to integrate
+npm into your program. To find documentation of the npm command line
+client, then use `npm help npm` or `man npm`.
+
+Every time you use npm, you must call `npm.load()` with an object hash of
+command-line configs. After that, each of the functions are accessible in the
+commands object: `npm.commands.<cmd>` Check out `npm help config` or
+for all available options.
+
+All commands on the command object take an **array** of positional argument
+**strings**. The last argument to any function is a callback. Some commands are
+special and take other optional arguments.
+
+Configs cannot currently be set on a per function basis, as each call to
+npm.config.set will change the value for *all* npm commands in that process.
+
+To find API documentation for a specific command, try the man pages first.
+
View
13 doc/api/outdated.md
@@ -0,0 +1,13 @@
+npm-outdated(3) -- Check for outdated packages
+==============================================
+
+## SYNOPSIS
+
+ npm.commands.outdated([packages,] callback)
+
+## DESCRIPTION
+
+This command will check the registry to see if the specified packages are
+currently outdated.
+
+If the 'packages' parameter is left out, npm will check all packages.
View
31 doc/api/owner.md
@@ -0,0 +1,31 @@
+npm-owner(3) -- Manage package owners
+=====================================
+
+## SYNOPSIS
+
+ npm.commands.owner(args, callback)
+
+## DESCRIPTION
+
+The first element of the 'args' parameter defines what to do, and the subsequent
+elements depend on the action. Possible values for the action are (order of
+parameters are given in parenthesis):
+
+* ls (package):
+ List all the users who have access to modify a package and push new versions.
+ Handy when you need to know who to bug for help.
+* add (user, package):
+ Add a new user as a maintainer of a package. This user is enabled to modify
+ metadata, publish new versions, and add other owners.
+* rm (user, package):
+ Remove a user from the package owner list. This immediately revokes their
+ privileges.
+
+Note that there is only one level of access. Either you can modify a package,
+or you can't. Future versions may contain more fine-grained access levels, but
+that is not implemented at this time.
+
+## SEE ALSO
+
+* npm-publish(3)
+* npm-registry(1)
View
19 doc/api/pack.md
@@ -0,0 +1,19 @@
+npm-pack(3) -- Create a tarball from a package
+==============================================
+
+## SYNOPSIS
+
+ npm.commands.pack([packages,] callback)
+
+## DESCRIPTION
+
+For anything that's installable (that is, a package folder, tarball,
+tarball url, name@tag, name@version, or name), this command will fetch
+it to the cache, and then copy the tarball to the current working
+directory as `<name>-<version>.tgz`, and then write the filenames out to
+stdout.
+
+If the same package is specified multiple times, then the file will be
+overwritten the second time.
+
+If no arguments are supplied, then npm packs the current package folder.
View
15 doc/api/prefix.md
@@ -0,0 +1,15 @@
+npm-prefix(3) -- Display prefix
+===============================
+
+## SYNOPSIS
+
+ npm.commands.prefix(args, callback)
+
+## DESCRIPTION
+
+Print the prefix to standard out.
+
+'args' is never used and callback is never called with data.
+'args' must be present or things will break.
+
+This function is not useful programmatically
View
17 doc/api/prune.md
@@ -0,0 +1,17 @@
+npm-prune(3) -- Remove extraneous packages
+==========================================
+
+## SYNOPSIS
+
+ npm.commands.prune([packages,] callback)
+
+## DESCRIPTION
+
+This command removes "extraneous" packages.
+
+The first parameter is optional, and it specifies packages to be removed.
+
+No packages are specified, then all packages will be checked.
+
+Extraneous packages are packages that are not listed on the parent
+package's dependencies list.
View
30 doc/api/publish.md
@@ -0,0 +1,30 @@
+npm-publish(3) -- Publish a package
+===================================
+
+## SYNOPSIS
+
+ npm.commands.publish([packages,] callback)
+
+## DESCRIPTION
+
+Publishes a package to the registry so that it can be installed by name.
+Possible values in the 'packages' array are:
+
+* `<folder>`:
+ A folder containing a package.json file
+
+* `<tarball>`:
+ A url or file path to a gzipped tar archive containing a single folder
+ with a package.json file inside.
+
+If the package array is empty, npm will try to publish something in the
+current working directory.
+
+This command could fails if one of the packages specified already exists in
+the registry. Overwrites when the "force" environment variable is set.
+
+## SEE ALSO
+
+* npm-registry(1)
+* npm-adduser(1)
+* npm-owner(3)
View
16 doc/api/rebuild.md
@@ -0,0 +1,16 @@
+npm-rebuild(3) -- Rebuild a package
+===================================
+
+## SYNOPSIS
+
+ npm.commands.rebuild([packages,] callback)
+
+## DESCRIPTION
+
+This command runs the `npm build` command on each of the matched packages. This is useful
+when you install a new version of node, and must recompile all your C++ addons with
+the new binary. If no 'packages' parameter is specify, every package will be rebuilt.
+
+## CONFIGURATION
+
+See `npm help build`
View
22 doc/api/restart.md
@@ -0,0 +1,22 @@
+npm-restart(3) -- Start a package
+=================================
+
+## SYNOPSIS
+
+ npm.commands.restart(packages, callback)
+
+## DESCRIPTION
+
+This runs a package's "restart" script, if one was provided.
+Otherwise it runs package's "stop" script, if one was provided, and then
+the "start" script.
+
+If no version is specified, then it restarts the "active" version.
+
+npm can run tests on multiple packages. Just specify multiple packages
+in the `packages` parameter.
+
+## SEE ALSO
+
+* npm-start(3)
+* npm-stop(3)
View
1 doc/api/rm.md
View
15 doc/api/root.md
@@ -0,0 +1,15 @@
+npm-root(3) -- Display npm root
+===============================
+
+## SYNOPSIS
+
+ npm.commands.root(args, callback)
+
+## DESCRIPTION
+
+Print the effective `node_modules` folder to standard out.
+
+'args' is never used and callback is never called with data.
+'args' must be present or things will break.
+
+This function is not useful programmatically.
View
27 doc/api/run-script.md
@@ -0,0 +1,27 @@
+npm-run-script(3) -- Run arbitrary package scripts
+==================================================
+
+## SYNOPSIS
+
+ npm.commands.run-script(args, callback)
+
+## DESCRIPTION
+
+This runs an arbitrary command from a package's "scripts" object.
+
+It is used by the test, start, restart, and stop commands, but can be
+called directly, as well.
+
+The 'args' parameter is an array of strings. Behavior depends on the number
+of elements. If there is only one element, npm assumes that the element
+represents a command to be run on the local repository. If there is more than
+one element, then the first is assumed to be the package and the second is
+assumed to be the command to run. All other elements are ignored.
+
+## SEE ALSO
+
+* npm-scripts(1)
+* npm-test(3)
+* npm-start(3)
+* npm-restart(3)
+* npm-stop(3)
View
35 doc/api/search.md
@@ -0,0 +1,35 @@
+npm-search(3) -- Search for packages
+====================================
+
+## SYNOPSIS
+
+ npm.commands.search(searchTerms, [silent,] [staleness,] callback)
+
+## DESCRIPTION
+
+Search the registry for packages matching the search terms. The available parameters are:
+
+* searchTerms:
+ Array of search terms. These terms are case-insensitive.
+* silent:
+ If true, npm will not log anything to the console.
+* staleness:
+ This is the threshold for stale packages. "Fresh" packages are not refreshed
+ from the registry. This value is measured in seconds.
+* callback:
+ Returns an object where each key is the name of a package, and the value
+ is information about that package along with a 'words' property, which is
+ a space-delimited string of all of the interesting words in that package.
+ The only properties included are those that are searched, which generally include:
+
+ * name
+ * description
+ * maintainers
+ * url
+ * keywords
+
+A search on the registry excludes any result that does not match all of the
+search terms. It also removes any items from the results that contain an
+excluded term (the "searchexclude" config). The search is case insensitive
+and doesn't try to read your mind (it doesn't do any verb tense matching or the
+like).
View
0 doc/set.md → doc/api/set.md
File renamed without changes.
View
13 doc/api/start.md
@@ -0,0 +1,13 @@
+npm-start(3) -- Start a package
+===============================
+
+## SYNOPSIS
+
+ npm.commands.start(packages, callback)
+
+## DESCRIPTION
+
+This runs a package's "start" script, if one was provided.
+
+npm can run tests on multiple packages. Just specify multiple packages
+in the `packages` parameter.
View
13 doc/api/stop.md
@@ -0,0 +1,13 @@
+npm-stop(3) -- Stop a package
+=============================
+
+## SYNOPSIS
+
+ npm.commands.stop(packages, callback)
+
+## DESCRIPTION
+
+This runs a package's "stop" script, if one was provided.
+
+npm can run stop on multiple packages. Just specify multiple packages
+in the `packages` parameter.
View
28 doc/api/submodule.md
@@ -0,0 +1,28 @@
+npm-submodule(3) -- Add a package as a git submodule
+====================================================
+
+## SYNOPSIS
+
+ npm.commands.submodule(packages, callback)
+
+## DESCRIPTION
+
+For each package specified, npm will check if it has a git repository url
+in its package.json description then add it as a git submodule at
+`node_modules/<pkg name>`.
+
+This is a convenience only. From then on, it's up to you to manage
+updates by using the appropriate git commands. npm will stubbornly
+refuse to update, modify, or remove anything with a `.git` subfolder
+in it.
+
+This command also does not install missing dependencies, if the package
+does not include them in its git repository. If `npm ls` reports that
+things are missing, you can either install, link, or submodule them yourself,
+or you can do `npm explore <pkgname> -- npm install` to install the
+dependencies into the submodule folder.
+
+## SEE ALSO
+
+* npm help json
+* git help submodule
View
23 doc/api/tag.md
@@ -0,0 +1,23 @@
+npm-tag(3) -- Tag a published version
+=====================================
+
+## SYNOPSIS
+
+ npm.commands.tag(package@version, tag, callback)
+
+## DESCRIPTION
+
+Tags the specified version of the package with the specified tag, or the
+`--tag` config if not specified.
+
+The 'package@version' is an array of strings, but only the first two elements are
+currently used.
+
+The first element must be in the form package@version, where package
+is the package name and version is the version number (much like installing a
+specific version).
+
+The second element is the name of the tag to tag this version with. If this
+parameter is missing or falsey (empty), the default froom the config will be
+used. For more information about how to set this config, check
+`man 3 npm-config` for programmatic usage or `man npm-config` for cli usage.
View
16 doc/api/test.md
@@ -0,0 +1,16 @@
+npm-test(3) -- Test a package
+=============================
+
+## SYNOPSIS
+
+ npm.commands.test(packages, callback)
+
+## DESCRIPTION
+
+This runs a package's "test" script, if one was provided.
+
+To run tests as a condition of installation, set the `npat` config to
+true.
+
+npm can run tests on multiple packages. Just specify multiple packages
+in the `packages` parameter.
View
16 doc/api/uninstall.md
@@ -0,0 +1,16 @@
+npm-uninstall(3) -- uninstall a package programmatically
+========================================================
+
+## SYNOPSIS
+
+ npm.commands.uninstall(packages, callback)
+
+## DESCRIPTION
+
+This acts much the same ways as uninstalling on the command-line.
+
+The 'packages' parameter is an array of strings. Each element in the array is
+the name of a package to be uninstalled.
+
+Finally, 'callback' is a function that will be called when all packages have been
+uninstalled or when an error has been encountered.
View
20 doc/api/unpublish.md
@@ -0,0 +1,20 @@
+npm-unpublish(3) -- Remove a package from the registry
+======================================================
+
+## SYNOPSIS
+
+ npm.commands.unpublish(package, callback)
+
+## DESCRIPTION
+
+This removes a package version from the registry, deleting its
+entry and removing the tarball.
+
+The package parameter must be defined.
+
+Only the first element in the package parameter is used. If there is no first
+element, then npm assumes that the package at the current working directory
+is what is meant.
+
+If no version is specified, or if all versions are removed then
+the root package entry is removed from the registry entirely.
View
11 doc/api/update.md
@@ -0,0 +1,11 @@
+npm-update(3) -- Update a package
+=================================
+
+## SYNOPSIS
+ npm.commands.update(packages, callback)
+
+# DESCRIPTION
+
+Updates a package, upgrading it to the latest version. It also installs any missing packages.
+
+The 'packages' argument is an array of packages to update. The 'callback' parameter will be called when done or when an error occurs.
View
18 doc/api/version.md
@@ -0,0 +1,18 @@
+npm-version(3) -- Bump a package version
+========================================
+
+## SYNOPSIS
+
+ npm.commands.version(newversion, callback)
+
+## DESCRIPTION
+
+Run this in a package directory to bump the version and write the new
+data back to the package.json file.
+
+If run in a git repo, it will also create a version commit and tag, and
+fail if the repo is not clean.
+
+Like all other commands, this function takes a string array as its first
+parameter. The difference, however, is this function will fail if it does
+not have exactly one element. The only element should be a version number.
View
82 doc/api/view.md
@@ -0,0 +1,82 @@
+npm-view(3) -- View registry info
+=================================
+
+## SYNOPSIS
+
+ npm.commands.view(args, [silent,] callback)
+
+## DESCRIPTION
+
+This command shows data about a package and prints it to the stream
+referenced by the `outfd` config, which defaults to stdout.
+
+The "args" parameter is an ordered list that closely resembles the command-line
+usage. The elements should be ordered such that the first element is
+the package and version (package@version). The version is optional. After that,
+the rest of the parameters are fields with optional subfields ("field.subfield")
+which can be used to get only the information desired from the registry.
+
+The callback will be passed all of the data returned by the query.
+
+For example, to get the package registry entry for the `connect` package,
+you can do this:
+
+ npm.commands.view(["connect"], callback)
+
+If no version is specified, "latest" is assumed.
+
+Field names can be specified after the package descriptor.
+For example, to show the dependencies of the `ronn` package at version
+0.3.5, you could do the following:
+
+ npm.commands.view(["ronn@0.3.5", "dependencies"], callback)
+
+You can view child field by separating them with a period.
+To view the git repository URL for the latest version of npm, you could
+do this:
+
+ npm.commands.view(["npm", "repository.url"], callback)
+
+For fields that are arrays, requesting a non-numeric field will return
+all of the values from the objects in the list. For example, to get all
+the contributor names for the "express" project, you can do this:
+
+ npm.commands.view(["express", "contributors.email"], callback)
+
+You may also use numeric indices in square braces to specifically select
+an item in an array field. To just get the email address of the first
+contributor in the list, you can do this:
+
+ npm.commands.view(["express", "contributors[0].email"], callback)
+
+Multiple fields may be specified, and will be printed one after another.
+For exampls, to get all the contributor names and email addresses, you
+can do this:
+
+ npm.commands.view(["express", "contributors.name", "contributors.email"], callback)
+
+"Person" fields are shown as a string if they would be shown as an
+object. So, for example, this will show the list of npm contributors in
+the shortened string format. (See `npm help json` for more on this.)
+
+ npm.commands.view(["npm", "contributors"], callback)
+
+If a version range is provided, then data will be printed for every
+matching version of the package. This will show which version of jsdom
+was required by each matching version of yui3:
+
+ npm.commands.view(["yui3@'>0.5.4'", "dependencies.jsdom"], callback)
+
+## OUTPUT
+
+If only a single string field for a single version is output, then it
+will not be colorized or quoted, so as to enable piping the output to
+another command.
+
+If the version range matches multiple versions, than each printed value
+will be prefixed with the version it applies to.
+
+If multiple fields are requested, than each of them are prefixed with
+the field name.
+
+Console output can be disabled by setting the 'silent' parameter to true.
View
15 doc/api/whoami.md
@@ -0,0 +1,15 @@
+npm-whoami(3) -- Display npm username
+=====================================
+
+## SYNOPSIS
+
+ npm.commands.whoami(args, callback)
+
+## DESCRIPTION
+
+Print the `username` config to standard output.
+
+'args' is never used and callback is never called with data.
+'args' must be present or things will break.
+
+This function is not useful programmatically
View
0 doc/adduser.md → doc/cli/adduser.md
File renamed without changes.
View
1 doc/cli/author.md
View
0 doc/bin.md → doc/cli/bin.md
File renamed without changes.
View
0 doc/build.md → doc/cli/build.md
File renamed without changes.
View
0 doc/bundle.md → doc/cli/bundle.md
File renamed without changes.
View
0 doc/cache.md → doc/cli/cache.md
File renamed without changes.
View
0 doc/changelog.md → doc/cli/changelog.md
File renamed without changes.
View
0 doc/coding-style.md → doc/cli/coding-style.md
File renamed without changes.
View
0 doc/completion.md → doc/cli/completion.md
File renamed without changes.
View
0 doc/config.md → doc/cli/config.md
File renamed without changes.
View
0 doc/deprecate.md → doc/cli/deprecate.md
File renamed without changes.
View
0 doc/developers.md → doc/cli/developers.md
File renamed without changes.
View
0 doc/docs.md → doc/cli/docs.md
File renamed without changes.
View
0 doc/edit.md → doc/cli/edit.md
File renamed without changes.
View
0 doc/explore.md → doc/cli/explore.md
File renamed without changes.
View
0 doc/faq.md → doc/cli/faq.md
File renamed without changes.
View
1 doc/cli/find.md
View
0 doc/folders.md → doc/cli/folders.md
File renamed without changes.
View
1 doc/cli/get.md
View
0 doc/global.md → doc/cli/global.md
File renamed without changes.
View
0 doc/help-search.md → doc/cli/help-search.md
File renamed without changes.
View
1 doc/cli/home.md
View
0 doc/init.md → doc/cli/init.md
File renamed without changes.
View
0 doc/install.md → doc/cli/install.md
File renamed without changes.
View
0 doc/json.md → doc/cli/json.md
File renamed without changes.
View
0 doc/link.md → doc/cli/link.md
File renamed without changes.
View
0 doc/list.md → doc/cli/list.md
File renamed without changes.
View
0 doc/ln.md → doc/cli/ln.md
File renamed without changes.
View
0 doc/ls.md → doc/cli/ls.md
File renamed without changes.
View
0 doc/npm.md → doc/cli/npm.md
File renamed without changes.
View
0 doc/outdated.md → doc/cli/outdated.md
File renamed without changes.
View
0 doc/owner.md → doc/cli/owner.md
File renamed without changes.
View
0 doc/pack.md → doc/cli/pack.md
File renamed without changes.
View
0 doc/prefix.md → doc/cli/prefix.md
File renamed without changes.
View
0 doc/prune.md → doc/cli/prune.md
File renamed without changes.
View
0 doc/publish.md → doc/cli/publish.md
File renamed without changes.
View
0 doc/rebuild.md → doc/cli/rebuild.md
File renamed without changes.
View
0 doc/registry.md → doc/cli/registry.md
File renamed without changes.
View
0 doc/removing-npm.md → doc/cli/removing-npm.md
File renamed without changes.
View
0 doc/restart.md → doc/cli/restart.md
File renamed without changes.
View
0 doc/rm.md → doc/cli/rm.md
File renamed without changes.
View
0 doc/root.md → doc/cli/root.md
File renamed without changes.
View
0 doc/run-script.md → doc/cli/run-script.md
File renamed without changes.
View
0 doc/scripts.md → doc/cli/scripts.md
File renamed without changes.
View
0 doc/search.md → doc/cli/search.md
File renamed without changes.
View
0 doc/semver.md → doc/cli/semver.md
File renamed without changes.
View
1 doc/cli/set.md
View
0 doc/start.md → doc/cli/start.md
File renamed without changes.
View
0 doc/stop.md → doc/cli/stop.md
File renamed without changes.
View
0 doc/submodule.md → doc/cli/submodule.md
File renamed without changes.
View
0 doc/tag.md → doc/cli/tag.md
File renamed without changes.
View
0 doc/test.md → doc/cli/test.md
File renamed without changes.
View
0 doc/uninstall.md → doc/cli/uninstall.md
File renamed without changes.
View
0 doc/unpublish.md → doc/cli/unpublish.md
File renamed without changes.
View
0 doc/update.md → doc/cli/update.md
File renamed without changes.
View
0 doc/version.md → doc/cli/version.md
File renamed without changes.
View
0 doc/view.md → doc/cli/view.md
File renamed without changes.
View
0 doc/whoami.md → doc/cli/whoami.md
File renamed without changes.
View
BIN html/api/GubbleBum-Blocky.ttf
Binary file not shown.
View
336 html/api/style.css
@@ -0,0 +1,336 @@
+
+/* reset */
+* {
+ margin:0;
+ padding:0;
+ border:none;
+ font-family:inherit;
+ font-size:inherit;
+ font-weight:inherit;
+}
+:target::before {
+ content:" >>> ";
+ position:absolute;
+ display:block;
+ opacity:0.5;
+ color:#f00;
+ margin:0 0 0 -2em;
+}
+abbr, acronym {
+ border-bottom:1px dotted #aaa;
+}
+kbd, code, pre {
+ font-family:monospace;
+ margin:0;
+ font-size:18px;
+ line-height:24px;
+ background:#eee;
+ outline:1px solid #ccc;
+}
+kbd code, kbd pre, kbd kbd,
+pre code, pre pre, pre kbd,
+code code, code pre, code kbd { outline: none }
+.dollar::before {
+ content:"$ ";
+ display:inline;
+}
+p, ul, ol, dl, pre {
+ margin:30px 0;
+ line-height:30px;
+}
+hr {
+ margin:30px auto 29px;
+ width:66%;
+ height:1px;
+ background:#aaa;
+}
+pre {
+ display:block;
+}
+dd :first-child {
+ margin-top:0;
+}
+
+body {
+ quotes:"" "" "" "";
+ width:666px;
+ margin:30px auto 120px;
+ font-family:Times New Roman, serif;
+ font-size:20px;
+ background:#fff;
+ line-height:30px;
+ color:#111;
+}
+
+blockquote {
+ position:relative;
+ font-size:16px;
+ line-height:30px;
+ font-weight:bold;
+ width:85%;
+ margin:0 auto;
+}
+blockquote::before {
+ font-size:90px;
+ display:block;
+ position:absolute;
+ top:20px;
+ right:100%;
+ content:"";
+ padding-right:10px;
+ color:#ccc;
+}
+.source cite::before {
+ content:"";
+}
+.source {
+ padding-left:20%;
+ margin-top:30px;
+}
+.source cite span {
+ font-style:normal;
+}
+blockquote p {
+ margin-bottom:0;
+}
+.quote blockquote {
+ font-weight:normal;
+}
+
+h1, h2, h3, h4, h5, h6, dt, #header {
+ font-family:serif;
+ font-size:20px;
+ font-weight:bold;
+}
+h2 {
+ background:#eee;
+}
+h1, h2 {
+ line-height:40px;
+}
+
+i, em, cite {
+ font-style:italic;
+}
+b, strong {
+ font-weight:bold;
+}
+i, em, cite, b, strong, small {
+ line-height:28px;
+}
+small, .small, .small *, aside {
+ font-style:italic;
+ color:#669;
+ font-size:18px;
+}
+spall a, .small a {
+ text-decoration:underline;
+}
+del {
+ text-decoration:line-through;
+}
+ins {
+ text-decoration:underline;
+}
+.alignright { display:block; float:right; margin-left:1em; }
+.alignleft { display:block; float:left; margin-right:1em; }
+
+q:before, q q q:before, q q q q q:before, q q q q q q q:before { content:""; }
+q q:before, q q q q:before, q q q q q q:before, q q q q q q q q:before { content:""; }
+q:after, q q q:after, q q q q q:after, q q q q q q q:after { content:""; }
+q q:after, q q q q:after, q q q q q q:after, q q q q q q q q:after { content:""; }
+
+a { color:#00f; text-decoration:none; }
+a:visited { color:#636; }
+a:hover, a:active { color:#900!important; text-decoration:underline; }
+
+h1 {
+ font-weight:bold;
+ background:#fff;
+}
+h1 a, h1 a:visited {
+ font-family:gubblefont, GubbleBum Blocky, GubbleBum, monospace;
+ font-size:60px;
+ color:#900;
+ display:block;
+}
+h1 a:focus, h1 a:hover, h1 a:active {
+ color:#f00!important;
+ text-decoration:none;
+}
+
+.navigation {
+ display:table;
+ width:100%;
+ margin:0 0 30px 0;
+ position:relative;
+}
+#nav-above {
+ margin-bottom:0;
+}
+.navigation .nav-previous {
+ display:table-cell;
+ text-align:left;
+ width:50%;
+}
+/* hang the » and « off into the margins */
+.navigation .nav-previous a:before, .navigation .nav-next a:after {
+ content: "«";
+ display:block;
+ height:30px;
+ margin-bottom:-30px;
+ text-decoration:none;
+ margin-left:-15px;
+}
+.navigation .nav-next a:after {
+ content: "»";
+ text-align:right;
+ margin-left:0;
+ margin-top:-30px;
+ margin-right:-15px;
+}
+
+
+.navigation .nav-next {
+ display:table-cell;
+ text-align:right;
+ width:50%;
+}
+.navigation a {
+ display:block;
+ width:100%;
+ height:100%;
+}
+
+input, button, textarea {
+ border:0;
+ line-height:30px;
+}
+textarea {
+ height:300px;
+}
+input {
+ height:30px;
+ line-height:30px;
+}
+input.submit, input#submit, input.button, button, input[type=submit] {
+ cursor:hand; cursor:pointer;
+ outline:1px solid #ccc;
+}
+
+#wrapper {
+ margin-bottom:90px;
+ position:relative;
+ z-index:1;
+ *zoom:1;
+ background:#fff;
+}
+#wrapper:after {
+ display:block;
+ content:".";
+ visibility:hidden;
+ width:0;
+ height:0;
+ clear:both;
+}
+
+.sidebar .xoxo > li {
+ float:left;
+ width:50%;
+}
+.sidebar li {
+ list-style:none;
+}
+.sidebar #elsewhere {
+ margin-left:-10%;
+ margin-right:-10%;
+}
+.sidebar #rss-links, .sidebar #twitter-feeds {
+ float:right;
+ clear:right;
+ width:20%;
+}
+.sidebar #comment {
+ clear:both;
+ float:none;
+ width:100%;
+}
+.sidebar #search {
+ clear:both;
+ float:none;
+ width:100%;
+}
+.sidebar #search h2 {
+ margin-left:40%;
+}
+.sidebar #search #s {
+ width:90%;
+ float:left;
+}
+.sidebar #search #searchsubmit {
+ width:10%;
+ float:right;
+}
+.sidebar * {
+ font-size:15px;
+ line-height:30px;
+}
+
+#footer, #footer * {
+ text-align:right;
+ font-size:16px;
+ color:#ccc;
+ font-style:italic;
+ word-spacing:1em;
+}
+
+#toc {
+ position:absolute;
+ top:0;
+ right:0;
+ padding:40px 0 40px 20px;
+ margin:0;
+ width:200px;
+ opacity:0.2;
+ z-index:-1;
+}
+#toc:hover {
+ opacity:1;
+ background:#fff;
+ z-index:999;
+}
+#toc ul {
+ padding:0;
+ margin:0;
+}
+#toc, #toc li {
+ list-style-type:none;
+ font-size:15px;
+ line-height:15px;
+}
+#toc li {
+ padding:0 0 0 10px;
+}
+#toc li a {
+ position:relative;
+ display:block;
+}
+
+@font-face {
+ font-family:gubblefont;
+ src: url(./GubbleBum-Blocky.ttf) format("truetype");
+}
+
+@media print {
+ a[href] {
+ color:inherit;
+ }
+ a[href]:after {
+ white-space:nowrap;
+ content:" " attr(href);
+ }
+ a[href^=\#], .navigation {
+ display:none;
+ }
+}
+
View
14 lib/help-search.js
@@ -5,7 +5,8 @@ var fs = require("graceful-fs")
, output = require("./utils/output.js")
, path = require("path")
, asyncMap = require("slide").asyncMap
- , docsPath = path.join(__dirname, "..", "doc")
+ , cliDocsPath = path.join(__dirname, "..", "doc", "cli")
+ , apiDocsPath = path.join(__dirname, "..", "doc", "api")
, log = require("./utils/log.js")
, npm = require("../npm.js")
@@ -15,6 +16,15 @@ function helpSearch (args, silent, cb) {
if (typeof cb !== "function") cb = silent, silent = false
if (!args.length) return cb(helpSearch.usage)
+ // see if we're actually searching the api docs.
+ var argv = npm.config.get("argv").cooked
+ , docsPath = cliDocsPath
+ , cmd = "help"
+ if (argv.length && argv[0].indexOf("api") !== -1) {
+ docsPath = apiDocsPath
+ cmd = "apihelp"
+ }
+
fs.readdir(docsPath, function(er, files) {
if (er) return log.er(cb, "Could not load documentation")(er)
@@ -122,7 +132,7 @@ function helpSearch (args, silent, cb) {
})
var out = results.map(function (res, i, results) {
- var out = "npm help "+res.file.replace(/\.md$/, "")
+ var out = "npm " + cmd + " "+res.file.replace(/\.md$/, "")
, r = Object.keys(res.hits).map(function (k) {
return k + ":" + res.hits[k]
}).sort(function (a, b) {
View
45 lib/help.js
@@ -3,18 +3,31 @@ module.exports = help
help.completion = function (opts, cb) {
if (opts.conf.argv.remain.length > 2) return cb(null, [])
- getSections(cb)
+ var num = 1
+ if (-1 !== opts.conf.argv.remain[1].indexOf("api")) num = 3
+ getSections(num, cb)
}
var fs = require("graceful-fs")
, path = require("path")
, exec = require("./utils/exec.js")
, npm = require("../npm.js")
, output = require("./utils/output.js")
+ , log = require("./utils/log.js")
function help (args, cb) {
- if (args.length > 1 && args[0]) return npm.commands["help-search"](args, cb)
+ var num = 1
+ , argv = npm.config.get("argv").cooked
+ if (argv.length && -1 !== argv[0].indexOf("api")) {
+ num = 3
+ }
+
+ if (args.length > 1 && args[0]) {
+ return npm.commands["help-search"](args, num, cb)
+ }
+
var section = args[0]
+
if (section) {
if ( npm.config.get("usage")
&& npm.commands[section]
@@ -23,17 +36,21 @@ function help (args, cb) {
npm.config.set("loglevel", "silent")
return output.write(npm.commands[section].usage, cb)
}
- var sectionPath = path.resolve(__dirname, "..", "man1", section+".1")
+ var sectionPath = path.join( __dirname, "..", "man", "man" + num
+ , section + "." + num)
, htmlPath = path.resolve( __dirname, "..", "html"
- , "doc", section+".html" )
+ , num === 3 ? "api" : "doc"
+ , section+".html" )
return fs.stat
( sectionPath
, function (e, o) {
if (e) return npm.commands["help-search"](args, cb)
- var manpath = path.join(__dirname, "..")
+ var manpath = path.join(__dirname, "..", "man")
, env = {}
- Object.keys(process.env).forEach(function (i) { env[i] = process.env[i] })
+ Object.keys(process.env).forEach(function (i) {
+ env[i] = process.env[i]
+ })
env.MANPATH = manpath
var viewer = npm.config.get("viewer")
switch (viewer) {
@@ -55,7 +72,7 @@ function help (args, cb) {
}
break
default:
- exec("man", [section], env, true, cb)
+ exec("man", [num, section], env, true, cb)
}
}
)
@@ -118,12 +135,16 @@ function wrap (arr) {
return out.join("\n ").substr(2)
}
-function getSections(cb) {
- fs.readdir(path.join(__dirname, "../man1/"), function (er, files) {
+function getSections (num, cb) {
+ if (typeof cb !== "function") cb = num, num = 1
+
+ var mp = path.join(__dirname, "../man/man" + num + "/")
+ , cleaner = new RegExp("\\." + num + "$")
+ fs.readdir(mp, function (er, files) {
if (er) return cb(er)
- var sectionList = files.concat("help.1")
- .filter(function (s) { return s.match(/\.1$/) })
- .map(function (s) { return s.replace(/\.1$/, '')})
+ var sectionList = files.concat("help." + num)
+ .filter(function (s) { return s.match(cleaner) })
+ .map(function (s) { return s.replace(cleaner, "")})
cb(null, sectionList)
})
}
View
1 npm.js
@@ -70,6 +70,7 @@ var commandCache = {}
, "author" : "owner"
, "home" : "docs"
, "unstar": "star" // same function
+ , "apihelp" : "help"
}
, aliasNames = Object.keys(aliases)
View
2 package.json
@@ -15,7 +15,7 @@
, "web" : "http://github.com/isaacs/npm/issues"
}
, "directories" : { "doc" : "./doc"