Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 516 lines (353 sloc) 16.674 kb
9c4cbbf @isaacs Slight header adjustment
isaacs authored
1 npm-json(1) -- Specifics of npm's package.json handling
2 =======================================================
4f2bc23 @isaacs Refactor the json doc
isaacs authored
3
4 ## DESCRIPTION
5
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
6 This document is all you need to know about what's required in your package.json
100f137 @isaacs Closes GH-697 Correct semver link
isaacs authored
7 file. It must be actual JSON, not just a JavaScript object literal.
4f2bc23 @isaacs Refactor the json doc
isaacs authored
8
f6d2609 @isaacs Note that configs affect the settings in the json, as well
isaacs authored
9 A lot of the behavior described in this document is affected by the config
ad8bb00 @isaacs Always use npm-blah(1) in the md, convert appropriately
isaacs authored
10 settings described in `npm-config(1)`.
f6d2609 @isaacs Note that configs affect the settings in the json, as well
isaacs authored
11
1774f1a @isaacs Close #985 Document package.json defaults
isaacs authored
12 ## DEFAULT VALUES
13
14 npm will default some values based on package contents.
15
16 * `"scripts": {"start": "node server.js"}`
17
18 If there is a `server.js` file in the root of your package, then npm
19 will default the `start` command to `node server.js`.
20
21 * `"scripts":{"preinstall": "node-waf clean || true; node-waf configure build"}`
22
23 If there is a `wscript` file in the root of your package, npm will
24 default the `preinstall` command to compile using node-waf.
25
26 * `"contributors": [...]`
27
28 If there is an `AUTHORS` file in the root of your package, npm will
29 treat each line as a `Name <email> (url)` format, where email and url
30 are optional. Lines which start with a `#` or are blank, will be
31 ignored.
32
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
33 ## name
4f2bc23 @isaacs Refactor the json doc
isaacs authored
34
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
35 The *most* important things in your package.json are the name and version fields.
100f137 @isaacs Closes GH-697 Correct semver link
isaacs authored
36 Those are actually required, and your package won't install without
37 them. The name and version together form an identifier that is assumed
38 to be completely unique. Changes to the package should come along with
39 changes to the version.
4f2bc23 @isaacs Refactor the json doc
isaacs authored
40
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
41 The name is what your thing is called. Some tips:
4f2bc23 @isaacs Refactor the json doc
isaacs authored
42
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
43 * Don't put "js" or "node" in the name. It's assumed that it's js, since you're
44 writing a package.json file, and you can specify the engine using the "engines"
45 field. (See below.)
46 * The name ends up being part of a URL, an argument on the command line, and a
100f137 @isaacs Closes GH-697 Correct semver link
isaacs authored
47 folder name. Any name with non-url-safe characters will be rejected.
48 Also, it can't start with a dot or an underscore.
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
49 * The name will probably be passed as an argument to require(), so it should
50 be something short, but also reasonably descriptive.
51 * You may want to check the npm registry to see if there's something by that name
52 already, before you get too attached to it. http://registry.npmjs.org/
4f2bc23 @isaacs Refactor the json doc
isaacs authored
53
54 ## version
55
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
56 The *most* important things in your package.json are the name and version fields.
100f137 @isaacs Closes GH-697 Correct semver link
isaacs authored
57 Those are actually required, and your package won't install without
58 them. The name and version together form an identifier that is assumed
59 to be completely unique. Changes to the package should come along with
60 changes to the version.
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
61
100f137 @isaacs Closes GH-697 Correct semver link
isaacs authored
62 Version must be parseable by
63 [node-semver](https://github.com/isaacs/node-semver), which is bundled
64 with npm as a dependency. (`npm install semver` to use it yourself.)
d876c4a @isaacs Closes GH-547 Split semver into a separate utility
isaacs authored
65
100f137 @isaacs Closes GH-697 Correct semver link
isaacs authored
66 Here's how npm's semver implementation deviates from what's on semver.org:
4f2bc23 @isaacs Refactor the json doc
isaacs authored
67
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
68 * Versions can start with "v"
69 * A numeric item separated from the main three-number version by a hyphen
70 will be interpreted as a "build" number, and will *increase* the version.
71 But, if the tag is not a number separated by a hyphen, then it's treated
72 as a pre-release tag, and is *less than* the version without a tag.
100f137 @isaacs Closes GH-697 Correct semver link
isaacs authored
73 So, `0.1.2-7 > 0.1.2-7-beta > 0.1.2-6 > 0.1.2 > 0.1.2beta`
4f2bc23 @isaacs Refactor the json doc
isaacs authored
74
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
75 This is a little bit confusing to explain, but matches what you see in practice
76 when people create tags in git like "v1.2.3" and then do "git describe" to generate
100f137 @isaacs Closes GH-697 Correct semver link
isaacs authored
77 a patch version.
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
78
e4f1f57 @isaacs move some stuff around, add various meta things that are nice
isaacs authored
79 ## description
80
648c9ff @isaacs Doc json field enhancements
isaacs authored
81 Put a description in it. It's a string. This helps people discover your
ed55a41 @isaacs s/ls/search/ in help json
isaacs authored
82 package, as it's listed in `npm search`.
648c9ff @isaacs Doc json field enhancements
isaacs authored
83
84 ## keywords
85
86 Put keywords in it. It's an array of strings. This helps people
ed55a41 @isaacs s/ls/search/ in help json
isaacs authored
87 discover your package as it's listed in `npm search`.
e4f1f57 @isaacs move some stuff around, add various meta things that are nice
isaacs authored
88
89 ## homepage
90
91 The url to the project homepage.
92
648c9ff @isaacs Doc json field enhancements
isaacs authored
93 **NOTE**: This is *not* the same as "url". If you put a "url" field,
94 then the registry will think it's a redirection to your package that has
95 been published somewhere else, and spit at you.
96
97 Literally. Spit. I'm so not kidding.
98
0c37406 @mfncooper Standardize the 'bugs' field in package.json.
mfncooper authored
99 ## bugs
100
101 The url to your project's issue tracker and / or the email address to which
102 issues should be reported. These are helpful for people who encounter issues
103 with your package.
104
105 It should look like this:
106
107 { "url" : "http://github.com/owner/project/issues"
108 , "email" : "project@hostname.com"
109 }
110
111 You can specify either one or both values. If you want to provide only a url,
112 you can specify the value for "bugs" as a simple string instead of an object.
113
114 If a url is provided, it will be used by the `npm bugs` command.
115
085fbd4 @isaacs Update json documentation
isaacs authored
116 ## people fields: author, contributors
e4f1f57 @isaacs move some stuff around, add various meta things that are nice
isaacs authored
117
118 The "author" is one person. "contributors" is an array of people. A "person"
119 is an object with a "name" field and optionally "url" and "email", like this:
120
121 { "name" : "Barney Rubble"
122 , "email" : "b@rubble.com"
123 , "url" : "http://barnyrubble.tumblr.com/"
124 }
125
126 Or you can shorten that all into a single string, and npm will parse it for you:
127
128 "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)
129
130 Both email and url are optional either way.
131
132 npm also sets a top-level "maintainers" field with your npm user info.
133
7081f3e @isaacs Document package config hash and files list.
isaacs authored
134 ## files
135
136 The "files" field is an array of files to include in your project. If
137 you name a folder in the array, then it will also include the files
cc97f3c @isaacs more 1.0 updates
isaacs authored
138 inside that folder. (Unless they would be ignored by another rule.)
7081f3e @isaacs Document package config hash and files list.
isaacs authored
139
140 You can also provide a ".npmignore" file in the root of your package,
141 which will keep files from being included, even if they would be picked
cc97f3c @isaacs more 1.0 updates
isaacs authored
142 up by the files array. The ".npmignore" file works just like a
143 ".gitignore".
7081f3e @isaacs Document package config hash and files list.
isaacs authored
144
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
145 ## main
146
147 The main field is a module ID that is the primary entry point to your program.
148 That is, if your package is named `foo`, and a user installs it, and then does
149 `require("foo")`, then your main module's exports object will be returned.
150
151 This should be a module ID relative to the root of your package folder.
152
e4f1f57 @isaacs move some stuff around, add various meta things that are nice
isaacs authored
153 For most modules, it makes the most sense to have a main script and often not
154 much else.
155
156 ## bin
157
158 A lot of packages have one or more executable files that they'd like to
159 install into the PATH. npm makes this pretty easy (in fact, it uses this
160 feature to install the "npm" executable.)
161
162 To use this, supply a `bin` field in your package.json which is a map of
a79d880 @isaacs Remove all reference to activate/deactivate from docs and comments
isaacs authored
163 command name to local file name. On install, npm will symlink that file into
164 `prefix/bin` for global installs, or `./node_modules/.bin/` for local
165 installs.
166
e4f1f57 @isaacs move some stuff around, add various meta things that are nice
isaacs authored
167
168 For example, npm has this:
169
170 { "bin" : { "npm" : "./cli.js" } }
171
172 So, when you install npm, it'll create a symlink from the `cli.js` script to
a79d880 @isaacs Remove all reference to activate/deactivate from docs and comments
isaacs authored
173 `/usr/local/bin/npm`.
19206ee @5long Document require.main doesn't work as usual in bin file.
5long authored
174
a79d880 @isaacs Remove all reference to activate/deactivate from docs and comments
isaacs authored
175 If you have a single executable, and its name should be the name
176 of the package, then you can just supply it as a string. For example:
085fbd4 @isaacs Update json documentation
isaacs authored
177
a79d880 @isaacs Remove all reference to activate/deactivate from docs and comments
isaacs authored
178 { "name": "my-program"
179 , "version": "1.2.5"
180 , "bin": "./path/to/program" }
085fbd4 @isaacs Update json documentation
isaacs authored
181
182 would be the same as this:
183
a79d880 @isaacs Remove all reference to activate/deactivate from docs and comments
isaacs authored
184 { "name": "my-program"
185 , "version": "1.2.5"
186 , "bin" : { "my-program" : "./path/to/program" } }
085fbd4 @isaacs Update json documentation
isaacs authored
187
9ad60ab @isaacs Documentation for the "man" package.json entry.
isaacs authored
188 ## man
189
190 Specify either a single file or an array of filenames to put in place for the
191 `man` program to find.
192
193 If only a single file is provided, then it's installed such that it is the
194 result from `man <pkgname>`, regardless of its actual filename. For example:
195
196 { "name" : "foo"
4ac877c @isaacs Clearer man examples
isaacs authored
197 , "version" : "1.2.3"
198 , "description" : "A packaged foo fooer for fooing foos"
199 , "main" : "foo.js"
9ad60ab @isaacs Documentation for the "man" package.json entry.
isaacs authored
200 , "man" : "./man/doc.1"
201 }
202
203 would link the `./man/doc.1` file in such that it is the target for `man foo`
204
205 If the filename doesn't start with the package name, then it's prefixed.
206 So, this:
207
208 { "name" : "foo"
4ac877c @isaacs Clearer man examples
isaacs authored
209 , "version" : "1.2.3"
210 , "description" : "A packaged foo fooer for fooing foos"
211 , "main" : "foo.js"
9ad60ab @isaacs Documentation for the "man" package.json entry.
isaacs authored
212 , "man" : [ "./man/foo.1", "./man/bar.1" ]
213 }
214
215 will create files to do `man foo` and `man foo-bar`.
216
217 Man files must end with a number, and optionally a `.gz` suffix if they are
218 compressed. The number dictates which man section the file is installed into.
219
220 { "name" : "foo"
4ac877c @isaacs Clearer man examples
isaacs authored
221 , "version" : "1.2.3"
222 , "description" : "A packaged foo fooer for fooing foos"
223 , "main" : "foo.js"
9ad60ab @isaacs Documentation for the "man" package.json entry.
isaacs authored
224 , "man" : [ "./man/foo.1", "./man/foo.2" ]
225 }
226
227 will create entries for `man foo` and `man 2 foo`
228
4792d40 @isaacs Put directories.lib info back in the doc, and document the repository…
isaacs authored
229 ## directories
230
231 The CommonJS [Packages](http://wiki.commonjs.org/wiki/Packages/1.0) spec details a
232 few ways that you can indicate the structure of your package using a `directories`
233 hash. If you look at [npm's package.json](http://registry.npmjs.org/npm/latest),
234 you'll see that it has directories for doc, lib, and man.
235
236 In the future, this information may be used in other creative ways.
237
238 ### directories.lib
239
cc97f3c @isaacs more 1.0 updates
isaacs authored
240 Tell people where the bulk of your library is. Nothing special is done
241 with the lib folder in any way, but it's useful meta info.
4792d40 @isaacs Put directories.lib info back in the doc, and document the repository…
isaacs authored
242
4197b4d @isaacs Add documentation for "bin" directory behavior.
isaacs authored
243 ### directories.bin
244
cc97f3c @isaacs more 1.0 updates
isaacs authored
245 If you specify a "bin" directory, then all the files in that folder will
246 be used as the "bin" hash.
4197b4d @isaacs Add documentation for "bin" directory behavior.
isaacs authored
247
248 If you have a "bin" hash already, then this has no effect.
249
8299e4f @isaacs Add info about a few directories that are relevant
isaacs authored
250 ### directories.man
251
cc97f3c @isaacs more 1.0 updates
isaacs authored
252 A folder that is full of man pages. Sugar to generate a "man" array by
253 walking the folder.
8299e4f @isaacs Add info about a few directories that are relevant
isaacs authored
254
255 ### directories.doc
256
cc97f3c @isaacs more 1.0 updates
isaacs authored
257 Put markdown files in here. Eventually, these will be displayed nicely,
258 maybe, someday.
8299e4f @isaacs Add info about a few directories that are relevant
isaacs authored
259
260 ### directories.example
261
262 Put example scripts in here. Someday, it might be exposed in some clever way.
263
4792d40 @isaacs Put directories.lib info back in the doc, and document the repository…
isaacs authored
264 ## repository
265
cc97f3c @isaacs more 1.0 updates
isaacs authored
266 Specify the place where your code lives. This is helpful for people who
267 want to contribute. If the git repo is on github, then the `npm docs`
268 command will be able to find you.
4792d40 @isaacs Put directories.lib info back in the doc, and document the repository…
isaacs authored
269
270 Do it like this:
271
272 "repository" :
273 { "type" : "git"
274 , "url" : "http://github.com/isaacs/npm.git"
275 }
276
277 "repository" :
278 { "type" : "svn"
279 , "url" : "http://v8.googlecode.com/svn/trunk/"
280 }
281
282 The URL should be a publicly available (perhaps read-only) url that can be handed
283 directly to a VCS program without any modification. It should not be a url to an
284 html project page that you put in your browser. It's for computers.
285
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
286 ## scripts
287
288 The "scripts" member is an object hash of script commands that are run
289 at various times in the lifecycle of your package. The key is the lifecycle
290 event, and the value is the command to run at that point.
291
ad8bb00 @isaacs Always use npm-blah(1) in the md, convert appropriately
isaacs authored
292 See `npm-scripts(1)` to find out more about writing package scripts.
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
293
7081f3e @isaacs Document package config hash and files list.
isaacs authored
294 ## config
295
296 A "config" hash can be used to set configuration
297 parameters used in package scripts that persist across upgrades. For
298 instance, if a package had the following:
299
300 { "name" : "foo"
301 , "config" : { "port" : "8080" } }
302
303 and then had a "start" command that then referenced the
304 `npm_package_config_port` environment variable, then the user could
305 override that by doing `npm config set foo:port 8001`.
306
ad8bb00 @isaacs Always use npm-blah(1) in the md, convert appropriately
isaacs authored
307 See `npm-config(1)` and `npm-scripts(1)` for more on package
7081f3e @isaacs Document package config hash and files list.
isaacs authored
308 configs.
309
da9eb9a @isaacs Update json docs to be more comprehensive. Fix #45
isaacs authored
310 ## dependencies
4f2bc23 @isaacs Refactor the json doc
isaacs authored
311
312 Dependencies are specified with a simple hash of package name to version
9f434d3 Fixed typo: "with" => "which".
George Miroshnykov authored
313 range. The version range is EITHER a string which has one or more
2107018 @isaacs an EITHER needs an OR
isaacs authored
314 space-separated descriptors, OR a range like "fromVersion - toVersion"
4f2bc23 @isaacs Refactor the json doc
isaacs authored
315
c616207 @isaacs Closes GH-669 Document devDependencies
isaacs authored
316 **Please do not put test harnesses in your `dependencies` hash.** See
317 `devDependencies`, below.
318
4f2bc23 @isaacs Refactor the json doc
isaacs authored
319 Version range descriptors may be any of the following styles, where "version"
320 is a semver compatible version identifier.
321
3d20f89 @isaacs ronn doesn't understand OL tags
isaacs authored
322 * `version` Must match `version` exactly
323 * `=version` Same as just `version`
324 * `>version` Must be greater than `version`
325 * `>=version` etc
326 * `<version`
327 * `<=version`
19f9d03 @isaacs Document tildes, x'es, and url dependencies
isaacs authored
328 * `~version` See 'Tilde Version Ranges' below
329 * `1.2.x` See 'X Version Ranges' below
330 * `http://...` See 'URLs as Dependencies' below
3d20f89 @isaacs ronn doesn't understand OL tags
isaacs authored
331 * `*` Matches any version
332 * `""` (just an empty string) Same as `*`
333 * `version1 - version2` Same as `>=version1 <=version2`.
49b7bf0 @isaacs Document the || in version ranges.
isaacs authored
334 * `range1 || range2` Passes if either range1 or range2 are satisfied.
3abab66 @alunny add git URL format to json + developers docs
alunny authored
335 * `git...` See 'Git URLs as Dependencies' below
4f2bc23 @isaacs Refactor the json doc
isaacs authored
336
337 For example, these are all valid:
338
339 { "dependencies" :
340 { "foo" : "1.0.0 - 2.9999.9999"
341 , "bar" : ">=1.0.2 <2.1.2"
342 , "baz" : ">1.0.2 <=2.3.4"
343 , "boo" : "2.0.1"
49b7bf0 @isaacs Document the || in version ranges.
isaacs authored
344 , "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0"
19f9d03 @isaacs Document tildes, x'es, and url dependencies
isaacs authored
345 , "asd" : "http://asdf.com/asdf.tar.gz"
346 , "til" : "~1.2"
347 , "elf" : "~1.2.3"
348 , "two" : "2.x"
349 , "thr" : "3.3.x"
4f2bc23 @isaacs Refactor the json doc
isaacs authored
350 }
351 }
352
19f9d03 @isaacs Document tildes, x'es, and url dependencies
isaacs authored
353 ### Tilde Version Ranges
354
355 A range specifier starting with a tilde `~` character is matched against
356 a version in the following fashion.
357
358 * The version must be at least as high as the range.
359 * The version must be less than the next major revision above the range.
360
361 For example, the following are equivalent:
362
363 * `"~1.2.3" = ">=1.2.3 <1.3.0"`
364 * `"~1.2" = ">=1.2.0 <2.0.0"`
365 * `"~1" = ">=1.0.0 <2.0.0"`
366
367 ### X Version Ranges
368
369 An "x" in a version range specifies that the version number must start
370 with the supplied digits, but any digit may be used in place of the x.
371
372 The following are equivalent:
373
374 * `"1.2.x" = ">=1.2.0 <1.3.0"`
375 * `"1.x.x" = ">=1.0.0 <2.0.0"`
376 * `"1.2" = "1.2.x"`
377 * `"1.x" = "1.x.x"`
378 * `"1" = "1.x.x"`
379
380 You may not supply a comparator with a version containing an x. Any
381 digits after the first "x" are ignored.
382
383 ### URLs as Dependencies
384
385 Starting with npm version 0.2.14, you may specify a tarball URL in place
386 of a version range.
387
cc97f3c @isaacs more 1.0 updates
isaacs authored
388 This tarball will be downloaded and installed locally to your package at
389 install time.
19f9d03 @isaacs Document tildes, x'es, and url dependencies
isaacs authored
390
3abab66 @alunny add git URL format to json + developers docs
alunny authored
391 ### Git URLs as Dependencies
392
393 Git urls can be of the form:
394
395 git://github.com/user/project.git#commit-ish
396 git+ssh://user@hostname:project.git#commit-ish
397 git+http://user@hostname/project/blah.git#commit-ish
398 git+https://user@hostname/project/blah.git#commit-ish
399
400 The `commit-ish` can be any tag, sha, or branch which can be supplied as
401 an argument to `git checkout`. The default is `master`.
402
c616207 @isaacs Closes GH-669 Document devDependencies
isaacs authored
403 ## devDependencies
404
405 If someone is planning on downloading and using your module in their
406 program, then they probably don't want or need to download and build
407 the external test or documentation framework that you use.
408
409 In this case, it's best to list these additional items in a
410 `devDependencies` hash.
411
412 These things will be installed whenever the `--dev` configuration flag
413 is set. This flag is set automatically when doing `npm link`, and can
ad8bb00 @isaacs Always use npm-blah(1) in the md, convert appropriately
isaacs authored
414 be managed like any other npm configuration param. See `npm-config(1)`
415 for more on the topic.
c616207 @isaacs Closes GH-669 Document devDependencies
isaacs authored
416
c178365 @isaacs Documentation for 1.0
isaacs authored
417 ## bundledDependencies
418
419 Array of package names that will be bundled when publishing the package.
420
b19d703 @isaacs Add SEE ALSO to all doc sections, and rebuild
isaacs authored
421 If this is spelled `"bundleDependencies"`, then that is also honorable.
4f2bc23 @isaacs Refactor the json doc
isaacs authored
422
b19d703 @isaacs Add SEE ALSO to all doc sections, and rebuild
isaacs authored
423 ## engines
4f2bc23 @isaacs Refactor the json doc
isaacs authored
424
b19d703 @isaacs Add SEE ALSO to all doc sections, and rebuild
isaacs authored
425 You can specify the version of
4f2bc23 @isaacs Refactor the json doc
isaacs authored
426 node that your stuff works on:
427
428 { "engines" : { "node" : ">=0.1.27 <0.1.30" } }
429
430 And, like with dependencies, if you don't specify the version (or if you
af50a3c @regality Fix #472 Adds support for os/cpu fields in package.json
regality authored
431 specify "\*" as the version), then any version of node will do.
4f2bc23 @isaacs Refactor the json doc
isaacs authored
432
433 If you specify an "engines" field, then npm will require that "node" be
434 somewhere on that list. If "engines" is omitted, then npm will just assume
435 that it works on node.
cc97f3c @isaacs more 1.0 updates
isaacs authored
436
b19d703 @isaacs Add SEE ALSO to all doc sections, and rebuild
isaacs authored
437 You can also use the "engines" field to specify which versions of npm
438 are capable of properly installing your program. For example:
439
440 { "engines" : { "npm" : "~1.0.20" } }
441
af50a3c @regality Fix #472 Adds support for os/cpu fields in package.json
regality authored
442 ## os
443
444 You can specify which operating systems your
445 module will run on:
446
447 "os" : [ "darwin", "linux" ]
448
449 You can also blacklist instead of whitelist operating systems,
450 just prepend the blacklisted os with a '!':
451
452 "os" : [ "!win32" ]
453
454 The host operating system is determined by `process.platform`
455
456 It is allowed to both blacklist, and whitelist, although there isn't any
457 good reason to do this.
458
459 ## cpu
460
461 If your code only runs on certain cpu architectures,
462 you can specify which ones.
463
464 "cpu" : [ "x64", "ia32" ]
465
466 Like the `os` option, you can also blacklist architectures:
467
468 "cpu" : [ "!arm", "!mips" ]
469
470 The host architecture is determined by `process.arch`
471
5d86b33 @isaacs Add preferGlobal json option
isaacs authored
472 ## preferGlobal
cc97f3c @isaacs more 1.0 updates
isaacs authored
473
5d86b33 @isaacs Add preferGlobal json option
isaacs authored
474 If your package is primarily a command-line application that should be
475 installed globally, then set this value to `true` to provide a warning
476 if it is installed locally.
cc97f3c @isaacs more 1.0 updates
isaacs authored
477
5d86b33 @isaacs Add preferGlobal json option
isaacs authored
478 It doesn't actually prevent users from installing it locally, but it
479 does help prevent some confusion if it doesn't work as expected.
0de96e6 @isaacs Closes GH-777 Allow overriding config values at publish-time
isaacs authored
480
641bd96 @isaacs Document the private and publishConfig options better
isaacs authored
481 ## private
482
483 If you set `"private": true` in your package.json, then npm will refuse
484 to publish it.
485
486 This is a way to prevent accidental publication of private repositories.
487 If you would like to ensure that a given package is only ever published
488 to a speciic registry (for example, an internal registry),
489 then use the `publishConfig` hash described below
490 to override the `registry` config param at publish-time.
491
0de96e6 @isaacs Closes GH-777 Allow overriding config values at publish-time
isaacs authored
492 ## publishConfig
493
494 This is a set of config values that will be used at publish-time. It's
495 especially handy if you want to set the tag or registry, so that you can
496 ensure that a given package is not tagged with "latest" or published to
497 the global public registry by default.
498
499 Any config values can be overridden, but of course only "tag" and
500 "registry" probably matter for the purposes of publishing.
501
ad8bb00 @isaacs Always use npm-blah(1) in the md, convert appropriately
isaacs authored
502 See `npm-config(1)` to see the list of config options that can be
0de96e6 @isaacs Closes GH-777 Allow overriding config values at publish-time
isaacs authored
503 overridden.
b19d703 @isaacs Add SEE ALSO to all doc sections, and rebuild
isaacs authored
504
505 ## SEE ALSO
506
507 * npm-semver(1)
508 * npm-init(1)
509 * npm-version(1)
510 * npm-config(1)
511 * npm-help(1)
512 * npm-faq(1)
513 * npm-install(1)
514 * npm-publish(1)
515 * npm-rm(1)
Something went wrong with that request. Please try again.