]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/man/man3/npm.3
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / man / man3 / npm.3
1 .TH "NPM" "3" "October 2016" "" ""
2 .SH "NAME"
3 \fBnpm\fR \- javascript package manager
4 .SH SYNOPSIS
5 .P
6 .RS 2
7 .nf
8 var npm = require("npm")
9 npm\.load([configObject, ]function (er, npm) {
10   // use the npm object, now that it's loaded\.
11
12   npm\.config\.set(key, val)
13   val = npm\.config\.get(key)
14
15   console\.log("prefix = %s", npm\.prefix)
16
17   npm\.commands\.install(["package"], cb)
18 })
19 .fi
20 .RE
21 .SH VERSION
22 .P
23 2.15.11
24 .SH DESCRIPTION
25 .P
26 This is the API documentation for npm\.
27 To find documentation of the command line
28 client, see npm help \fBnpm\fP\|\.
29 .P
30 Prior to using npm's commands, \fBnpm\.load()\fP must be called\.  If you provide
31 \fBconfigObject\fP as an object map of top\-level configs, they override the values
32 stored in the various config locations\. In the npm command line client, this
33 set of configs is parsed from the command line options\. Additional
34 configuration params are loaded from two configuration files\. See
35 npm help \fBnpm\-config\fP, npm help 7 \fBnpm\-config\fP, and npm help 5 \fBnpmrc\fP for more information\.
36 .P
37 After that, each of the functions are accessible in the
38 commands object: \fBnpm\.commands\.<cmd>\fP\|\.  See npm help 7 \fBnpm\-index\fP for a list of
39 all possible commands\.
40 .P
41 All commands on the command object take an \fBarray\fR of positional argument
42 \fBstrings\fR\|\. The last argument to any function is a callback\. Some
43 commands take other optional arguments\.
44 .P
45 Configs cannot currently be set on a per function basis, as each call to
46 npm\.config\.set will change the value for \fIall\fR npm commands in that process\.
47 .P
48 To find API documentation for a specific command, run the \fBnpm apihelp\fP
49 command\.
50 .SH METHODS AND PROPERTIES
51 .RS 0
52 .IP \(bu 2
53 \fBnpm\.load(configs, cb)\fP
54   Load the configuration params, and call the \fBcb\fP function once the
55   globalconfig and userconfig files have been loaded as well, or on
56   nextTick if they've already been loaded\.
57 .IP \(bu 2
58 \fBnpm\.config\fP
59   An object for accessing npm configuration parameters\.
60 .RS 0
61 .IP \(bu 2
62 \fBnpm\.config\.get(key)\fP
63 .IP \(bu 2
64 \fBnpm\.config\.set(key, val)\fP
65 .IP \(bu 2
66 \fBnpm\.config\.del(key)\fP
67
68 .RE
69 .IP \(bu 2
70 \fBnpm\.dir\fP or \fBnpm\.root\fP
71   The \fBnode_modules\fP directory where npm will operate\.
72 .IP \(bu 2
73 \fBnpm\.prefix\fP
74   The prefix where npm is operating\.  (Most often the current working
75   directory\.)
76 .IP \(bu 2
77 \fBnpm\.cache\fP
78   The place where npm keeps JSON and tarballs it fetches from the
79   registry (or uploads to the registry)\.
80 .IP \(bu 2
81 \fBnpm\.tmp\fP
82   npm's temporary working directory\.
83 .IP \(bu 2
84 \fBnpm\.deref\fP
85   Get the "real" name for a command that has either an alias or
86   abbreviation\.
87
88 .RE
89 .SH MAGIC
90 .P
91 For each of the methods in the \fBnpm\.commands\fP object, a method is added to the
92 npm object, which takes a set of positional string arguments rather than an
93 array and a callback\.
94 .P
95 If the last argument is a callback, then it will use the supplied
96 callback\.  However, if no callback is provided, then it will print out
97 the error or results\.
98 .P
99 For example, this would work in a node repl:
100 .P
101 .RS 2
102 .nf
103 > npm = require("npm")
104 > npm\.load()  // wait a sec\.\.\.
105 > npm\.install("dnode", "express")
106 .fi
107 .RE
108 .P
109 Note that that \fIwon't\fR work in a node program, since the \fBinstall\fP
110 method will get called before the configuration load is completed\.
111 .SH ABBREVS
112 .P
113 In order to support \fBnpm ins foo\fP instead of \fBnpm install foo\fP, the
114 \fBnpm\.commands\fP object has a set of abbreviations as well as the full
115 method names\.  Use the \fBnpm\.deref\fP method to find the real name\.
116 .P
117 For example:
118 .P
119 .RS 2
120 .nf
121 var cmd = npm\.deref("unp") // cmd === "unpublish"
122 .fi
123 .RE
124