UNPKG

3.7 kBPlain TextView Raw
1import { BugTracker } from './bug-tracker';
2import { Person } from './person';
3import { Repository } from './repository';
4
5/**
6 * `PackageJSON` contains the package metadata
7 * usually found in `package.json` files.
8 *
9 * @remarks
10 * For some packages, especially legacy ones,
11 * the properties may be mistyped due to incorrect data present on the registry.
12 *
13 * @see {@link https://docs.npmjs.com/cli/v6/configuring-npm/package-json}
14 */
15export interface PackageJSON {
16 /** Package name */
17 readonly name: string;
18
19 /** Package version number */
20 readonly version: string;
21
22 /** Package description */
23 readonly description?: string;
24
25 /** Homepage URL */
26 readonly homepage?: string;
27
28 /** SPDX license identifier */
29 readonly license?: string;
30
31 /** Text of the license */
32 readonly licenseText?: string;
33
34 /** Keywords describing the package */
35 readonly keywords?: string[];
36
37 /**
38 * Author of the package
39 *
40 * @see {@link Person}
41 */
42 readonly author?: Person;
43
44 /**
45 * Maintainers of the package
46 *
47 * @see {@link Person}
48 */
49 readonly maintainers?: Person[];
50
51 /**
52 * Contributors to the package
53 *
54 * @see {@link Person}
55 */
56 readonly contributors?: Person[];
57
58 /**
59 * Repository containing the package's source
60 *
61 * @see {@link Repository}
62 */
63 readonly repository?: string | Repository;
64
65 /**
66 * Bug tracker
67 *
68 * @see {@link BugTracker}
69 */
70 readonly bugs?: BugTracker;
71
72 /** Runtime dependencies */
73 readonly dependencies?: Record<string, string>;
74
75 /** Development dependencies */
76 readonly devDependencies?: Record<string, string>;
77
78 /** Peer dependencies */
79 readonly peerDependencies?: Record<string, string>;
80
81 /** Optional dependencies */
82 readonly optionalDependencies?: Record<string, string>;
83
84 /** Bundled dependencies */
85 readonly bundleDependencies?: string[];
86
87 /** Bundled dependencies (alias) */
88 readonly bundledDependencies?: string[];
89
90 /** Main source file */
91 readonly source?: string;
92
93 /** Main file (Node) */
94 readonly main?: string;
95
96 /** Main file (Browser) */
97 readonly browser?: string;
98
99 /** Main file (Modules) */
100 readonly module?: string;
101
102 /** Type declarations file */
103 readonly types?: string;
104
105 /** Type declarations file (alias) */
106 readonly typings?: string;
107
108 /**
109 * Export map
110 *
111 * @see {@link https://nodejs.org/api/packages.html#packages_subpath_exports}
112 */
113 readonly exports?: string | Record<string, unknown>;
114
115 /** File patterns included in the package */
116 readonly files?: string[];
117
118 /** Executable files */
119 readonly bin?: string | Record<string, string>;
120
121 /** Man pages */
122 readonly man?: string | string[];
123
124 /** Directories describing the package's structure */
125 readonly directories?: Record<string, string>;
126
127 /** npm scripts */
128 readonly scripts?: Record<string, string>;
129
130 /** npm config */
131 readonly config?: Record<string, string>;
132
133 /** Node compatibility */
134 readonly engines?: Record<string, string>;
135
136 /** OS compatibility */
137 readonly os?: string[];
138
139 /** CPU compatibility */
140 readonly cpu?: string[];
141
142 /** Prevent publishing */
143 readonly private?: boolean;
144
145 /** Publishing configuration */
146 readonly publishConfig?: Record<string, string>;
147
148 /** Deprecation message */
149 readonly deprecated?: string;
150
151 /** README contents */
152 readonly readme?: string;
153
154 /** Name of the README file */
155 readonly readmeFilename?: string;
156
157 /** Other fields */
158 readonly [key: string]: unknown;
159}