generated from Ariadnemar06/npm-check-updates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
317 lines (257 loc) · 7.6 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
import { SemVer } from 'semver-utils'
/** A very generic object. */
export type Index<T = any> = {[key: string]: T}
/** A value that may be null or undefined. */
export type Maybe<T = any> = T | null | undefined
/** A function that gets a target version of a dependency. */
export type GetVersion = (packageName: string, currentVersion: Version, options?: Options) => Promise<Version | null>
export interface PackageManager {
defaultPrefix?: (options: Options) => Promise<string | undefined>,
list?: (options: Options) => Promise<Index<Version>>,
latest: GetVersion,
major?: GetVersion,
minor?: GetVersion,
newest?: GetVersion,
greatest?: GetVersion,
packageAuthorChanged?: (packageName: string, from: VersionSpec, to: VersionSpec, options?: Options) => Promise<boolean>,
getPeerDependencies?: (packageName: string, version: Version) => Promise<Index<Version>>,
}
export type Version = string
export type VersionSpec = string
export type VersionLevel = 'major' | 'minor' | 'patch'
export type FilterFunction = (packageName: string, versionRange: SemVer[]) => boolean
export type FilterRejectPattern = string | string[] | RegExp | RegExp[] | FilterFunction
export type TargetFunction = (packageName: string, versionRange: SemVer[]) => string
export type Target = string | TargetFunction
export interface Packument {
name: string,
deprecated?: boolean,
engines: {
node: string,
},
time: Index<string>,
version: Version,
versions: Packument[],
}
export interface PackageFileRepository {
url: string,
directory?: string,
}
export interface PackageFile {
repository?: string | PackageFileRepository,
dependencies?: Index<VersionSpec>,
devDependencies?: Index<VersionSpec>,
peerDependencies?: Index<VersionSpec>,
optionalDependencies?: Index<VersionSpec>,
bundleDependencies?: Index<VersionSpec>,
}
export interface IgnoredUpgrade {
from: Version,
to: Version,
reason: Index<string>,
}
export interface NpmOptions {
global?: boolean,
prefix?: string,
registry?: string,
}
export interface YarnOptions {
global?: boolean,
prefix?: string,
registry?: string,
}
export interface SpawnOptions {
env?: Index<string>,
stderr?: (s: string) => void,
}
export interface RunOptions {
/**
* Force color in terminal
*/
color?: boolean,
/**
* Max number of concurrent HTTP requests to registry. (default: 8)
*/
concurrency?: number,
/**
* Config file name (default: .ncurc.{json,yml,js})
*/
configFileName?: string,
/**
* Directory of .ncurc config file (default: directory of `packageFile`).
*/
configFilePath?: string,
/**
* Working directory in which npm will be executed.
*/
cwd?: string,
/**
* Run recursively in current working directory. Alias of (--packageFile '**\/package.json').
*/
deep?: boolean,
/**
* Check one or more sections of dependencies only: dev, optional, peer, prod, bundle (comma-delimited).
*/
dep?: string,
/**
* Include deprecated packages.
*/
deprecated?: boolean,
/**
* Iteratively installs upgrades and runs tests to identify breaking upgrades. Run "ncu --doctor" for detailed help. Add "-u" to execute.
*/
doctor?: boolean,
/**
* Specifies the install script to use in doctor mode (default: npm install/yarn).
*/
doctorInstall?: string,
/**
* Specifies the test script to use in doctor mode (default: npm test).
*/
doctorTest?: string,
/**
* Include only packages that satisfy engines.node as specified in the package file.
*/
enginesNode?: boolean,
/**
* Set the error level. 1: exits with error code 0 if no errors occur. 2: exits with error code 0 if no packages need updating (useful for continuous integration). (default: 1)
*/
errorLevel?: number,
/**
* Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/ or function that returns true.
*/
filter?: FilterRejectPattern,
/**
* Filter on package version using comma-or-space-delimited list, /regex/ or function that returns true.
*/
filterVersion?: FilterRejectPattern,
/**
* Enable additional output data, string or comma-delimited list: ownerChanged, repo. ownerChanged: shows if the package owner changed between versions. repo: infers and displays links to source code repository. (default: [])
*/
format?: string[],
/**
* Check global packages instead of in the current project.
*/
global?: boolean,
/**
* DEPRECATED. Renamed to "--target greatest".
*
* @deprecated
*/
greatest?: boolean,
/**
* Enable interactive prompts for each dependency, implies -u unless one of the json options are set,
*/
interactive?: boolean,
/**
* Output new package file instead of human-readable message.
*/
jsonAll?: boolean,
/**
* Like `jsonAll` but only lists `dependencies`, `devDependencies`, `optionalDependencies`, etc of the new package data.
*/
jsonDeps?: boolean,
/**
* Output upgraded dependencies in json.
*/
jsonUpgraded?: boolean,
/**
* Amount to log: silent, error, minimal, warn, info, verbose, silly. (default: "warn")
*/
loglevel?: string,
/**
* Merges nested configs with the root config file for --deep or --packageFile options (default: false)
*/
mergeConfig?: boolean,
/**
* Do not upgrade newer versions that are already satisfied by the version range according to semver.
*/
minimal?: boolean,
/**
* DEPRECATED. Renamed to "--target newest".
*
* @deprecated
*/
newest?: boolean,
/**
* DEPRECATED. Renamed to "--format ownerChanged".
*
* @deprecated
*/
ownerChanged?: boolean,
/**
* Package file data (you can also use stdin).
*/
packageData?: string | PackageFile,
/**
* Package file(s) location (default: ./package.json).
*/
packageFile?: string,
/**
* npm, yarn (default: "npm")
*/
packageManager?: string,
/**
* Check peer dependencies of installed packages and filter updates to compatible versions. Run "ncu --help --peer" for details.
*/
peer?: boolean,
/**
* Include -alpha, -beta, -rc. (default: 0, default with --newest and --greatest: 1).
*/
pre?: boolean,
/**
* Current working directory of npm.
*/
prefix?: string,
/**
* Third-party npm registry.
*/
registry?: string,
/**
* Exclude packages matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/ or function that returns true.
*/
reject?: FilterRejectPattern,
/**
* Exclude package.json versions using comma-or-space-delimited list, /regex/ or function that returns true.
*/
rejectVersion?: FilterRejectPattern,
/**
* Remove version ranges from the final package version.
*/
removeRange?: boolean,
/**
* Number of times to retry failed requests for package info. (default: 3)
*/
retry?: number,
/**
* DEPRECATED. Renamed to --target.
*
* @deprecated
*/
semverLevel?: string,
/**
* Don't output anything (--loglevel silent).
*/
silent?: boolean,
/**
* Target function that returns version to upgrade to: latest, newest, greatest, minor, patch. Run "ncu --help --target" for details.` (default: "latest")
*/
target?: Target,
/**
* Global timeout in milliseconds. (default: no global timeout and 30 seconds per npm-registry-fetch).
*/
timeout?: number,
/**
* Overwrite package file with upgraded versions instead of just outputting to console.
*/
upgrade?: boolean,
}
export type Options = RunOptions & {
args?: any[],
cli?: boolean,
json?: boolean,
nodeEngineVersion?: VersionSpec,
packageData?: string,
peerDependencies?: Index<any>,
rcConfigPath?: string,
}