npm.d.ts
3.54 KB
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
import { GetVersion, Index, Options, NpmOptions, Packument, Version, VersionSpec } from '../types';
/**
* Check if package author changed between current and upgraded version.
*
* @param packageName Name of the package
* @param currentVersion Current version declaration (may be range)
* @param upgradedVersion Upgraded version declaration (may be range)
* @param npmConfigLocal Additional npm config variables that are merged into the system npm config
* @returns A promise that fullfills with boolean value.
*/
export declare function packageAuthorChanged(packageName: string, currentVersion: VersionSpec, upgradedVersion: VersionSpec, options?: Options, npmConfigLocal?: Index<string | boolean>): Promise<boolean>;
interface ViewOptions {
registry?: string;
timeout?: number;
retry?: number;
}
/**
* Returns an object of specified values retrieved by npm view.
*
* @param packageName Name of the package
* @param fields Array of fields like versions, time, version
* @param currentVersion
* @returns Promised result
*/
export declare function viewMany(packageName: string, fields: string[], currentVersion: Version, { registry, timeout, retry }?: ViewOptions, retried?: number, npmConfigLocal?: Index<string | boolean>): Promise<Packument>;
/** Memoize viewMany for --deep performance. */
export declare const viewManyMemoized: typeof viewMany;
/**
* Returns the value of one of the properties retrieved by npm view.
*
* @param packageName Name of the package
* @param field Field such as "versions" or "dist-tags.latest" are parsed from the pacote result (https://www.npmjs.com/package/pacote#packument)
* @param currentVersion
* @returns Promised result
*/
export declare function viewOne(packageName: string, field: string, currentVersion: Version, options?: ViewOptions, npmConfigLocal?: Index<string | boolean>): Promise<string | boolean | Index<string> | {
node: string;
} | Packument[] | undefined>;
/**
* Spawn npm requires a different command on Windows.
*
* @param args
* @param [npmOptions={}]
* @param [spawnOptions={}]
* @returns
*/
declare function spawnNpm(args: string | string[], npmOptions?: NpmOptions, spawnOptions?: {}): any;
/**
* Get platform-specific default prefix to pass on to npm.
*
* @param options
* @param [options.global]
* @param [options.prefix]
* @returns
*/
export declare function defaultPrefix(options: Options): Promise<string | undefined>;
/**
* @param packageName
* @param currentVersion
* @param options
* @returns
*/
export declare const greatest: GetVersion;
/**
* Requests the list of peer dependencies for a specific package version
*
* @param packageName
* @param version
* @returns Promised {packageName: version} collection
*/
export declare const getPeerDependencies: (packageName: string, version: Version) => Promise<Index<Version>>;
/**
* @param [options]
* @param [options.cwd]
* @param [options.global]
* @param [options.prefix]
* @returns
*/
export declare const list: (options?: Options) => Promise<Index<R>>;
/**
* @param packageName
* @param currentVersion
* @param options
* @returns
*/
export declare const latest: GetVersion;
/**
* @param packageName
* @param currentVersion
* @param options
* @returns
*/
export declare const newest: GetVersion;
/**
* @param packageName
* @param currentVersion
* @param options
* @returns
*/
export declare const minor: GetVersion;
/**
* @param packageName
* @param currentVersion
* @param options
* @returns
*/
export declare const patch: GetVersion;
export default spawnNpm;