This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a bunch of API docs. They aren't perfect, but they're a lot bet…
…ter than nothing
- Loading branch information
1 parent
a98be6a
commit 001b6d0
Showing
88 changed files
with
2,934 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
owner.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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" | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
ls.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
config.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
docs.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
ls.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
link.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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` |
Oops, something went wrong.