Skip to content

Commit df73168

Browse files
committed
fix: update package docs
1 parent 80c87f1 commit df73168

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

docs/lib/content/configuring-npm/package-json.md

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ settings described in [`config`](/using-npm/config).
1515

1616
### name
1717

18+
> See Node.js documentation on `name` [here](https://nodejs.org/api/packages.html#name).
19+
1820
If you plan to publish your package, the *most* important things in your
1921
package.json are the name and version fields as they will be required. The
2022
name and version together form an identifier that is assumed to be
@@ -195,11 +197,13 @@ unpublished package under any terms:
195197

196198
Consider also setting `"private": true` to prevent accidental publication.
197199

198-
### people fields: author, contributors
200+
### licenses (deprecated)
201+
202+
See [license](#license).
203+
204+
### author
199205

200-
The "author" is one person. "contributors" is an array of people. A
201-
"person" is an object with a "name" field and optionally "url" and "email",
202-
like this:
206+
The "author" is one person. A "person" is an object with a "name" field and optionally "url" and "email", like this:
203207

204208
```json
205209
{
@@ -209,18 +213,23 @@ like this:
209213
}
210214
```
211215

212-
Or you can shorten that all into a single string, and npm will parse it for
213-
you:
216+
Or you can shorten that all into a single string, and npm will parse it for you:
214217

215218
```json
216219
{
217220
"author": "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
218221
}
219222
```
220223

224+
### contributors
225+
226+
Contributors consists of an an array of [authors](#author).
227+
221228
Both email and url are optional either way.
222229

223-
npm also sets a top-level "maintainers" field with your npm user info.
230+
### maintainers (deprecated)
231+
232+
The `maintainers` when set in package.json is not awknowledged or used by npm. `maintainers` is used internally by npm on package-like payloads.
224233

225234
### funding
226235

@@ -341,10 +350,16 @@ These can not be included.
341350

342351
### exports
343352

344-
The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, and preventing any other entry points besides those defined in "exports". This encapsulation allows module authors to clearly define the public interface for their package. For more details see the [node.js documentation on package entry points](https://nodejs.org/api/packages.html#package-entry-points)
353+
See Node.js documentation on `exports` [here](https://nodejs.org/api/packages.html#exports).
354+
355+
### imports
356+
357+
See Node.js documentation on `imports` [here](https://nodejs.org/api/packages.html#imports).
345358

346359
### main
347360

361+
> See Node.js documentation on `main` [here](https://nodejs.org/api/packages.html#main).
362+
348363
The main field is a module ID that is the primary entry point to your
349364
program. That is, if your package is named `foo`, and a user installs it,
350365
and then does `require("foo")`, then your main module's exports object will
@@ -893,13 +908,16 @@ This file contains the dependencies `renderized` and `super-streams` which
893908
can be installed in a new project by executing `npm install
894909
awesome-web-framework-1.0.0.tgz`. Note that the package names do not
895910
include any versions, as that information is specified in `dependencies`.
896-
897911
If this is spelled `"bundledDependencies"`, then that is also honored.
898912

899913
Alternatively, `"bundleDependencies"` can be defined as a boolean value. A
900914
value of `true` will bundle all dependencies, a value of `false` will bundle
901915
none.
902916

917+
### bundledDependencies (deprecated)
918+
919+
Is honored by npm as alias of [bundleDependcies](#bundleDependencies).
920+
903921
### optionalDependencies
904922

905923
If a dependency can be used, but you would like npm to proceed if it cannot
@@ -1191,6 +1209,24 @@ default.
11911209
See [`config`](/using-npm/config) to see the list of config options that
11921210
can be overridden.
11931211
1212+
### type
1213+
1214+
> See Node.js documentation on `type` [here](https://nodejs.org/api/packages.html#type).
1215+
1216+
Property that governs if Node.js will interpret package as [CommonJS (cjs)](https://nodejs.org/docs/latest/api/modules.html#modules-commonjs-modules) or [ECMAScript Module (esm)](https://nodejs.org/docs/latest/api/esm.html).
1217+
1218+
When this field is undefined it is interpreted as the value `commonjs`.
1219+
1220+
### types
1221+
1222+
See TypeScript documentation on `types` [here](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html).
1223+
1224+
Used by npmjs.org to display `ts` badege for a given package.
1225+
1226+
### typings
1227+
1228+
Alias of [types](#types).
1229+
11941230
### workspaces
11951231
11961232
The optional `workspaces` field is an array of file patterns that describes

0 commit comments

Comments
 (0)