-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathdeclarations.d.ts
75 lines (66 loc) · 1.75 KB
/
declarations.d.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
// This is a WIP declaration file and it is not being used yet
interface IPackageJSON {
name?: string;
version?: string;
dependencies?: any;
devDependencies?: any;
[key: string]: any;
}
interface IPackageInfo {
name: string;
version: string;
}
/**
* A package identifier can be any of the following:
* - <package name>
* - <package name>@<version>
* - <package name>@<version range>
* - <package name>@<tag>
* - <git repo url>
* - <tarball url>
* - <tarball file>
* - <folder>
*/
type IPackageIdentifier = string;
interface IPackageManagerOptions {
projectPath?: string;
}
interface IPackageManagerAddOptions extends IPackageManagerOptions {
version?: string;
exact?: boolean;
scripts?: boolean;
// these 3 are shared with the remove options, however
// they are duplicated as they don't quite make sense
// to be added to IPackageManagerOptions as they are
// specific to add and remove operations
save?: boolean;
dev?: boolean;
optional?: boolean;
}
interface IPackageManagerRemoveOptions extends IPackageManagerOptions {
save?: boolean;
dev?: boolean;
optional?: boolean;
}
interface IPackageManager {
add(
packageIdentifier: IPackageIdentifier,
options?: IPackageManagerAddOptions
): Promise<IPackageInfo>;
install(
packageIdentifier: IPackageIdentifier,
options?: IPackageManagerAddOptions
): Promise<IPackageInfo>;
remove(
packageIdentifier: IPackageIdentifier,
options?: IPackageManagerRemoveOptions
): Promise<IPackageInfo>;
uninstall(
packageIdentifier: IPackageIdentifier,
options?: IPackageManagerRemoveOptions
): Promise<IPackageInfo>;
getInstalledPackage(
packageIdentifier: IPackageIdentifier
): Promise<IPackageInfo>;
getPackageJson(packageIdentifier: IPackageIdentifier): Promise<IPackageJSON>;
}