1 | import ConfigStore from "configstore";
|
2 |
|
3 | import type { Options as BoxenOptions } from "boxen";
|
4 |
|
5 | export default class UpdateNotifier {
|
6 | constructor(settings: Settings);
|
7 | readonly config?: ConfigStore | undefined;
|
8 | readonly update?: UpdateInfo | undefined;
|
9 | check(): void;
|
10 | /**
|
11 | * Check update information
|
12 | * @async
|
13 | */
|
14 | fetchInfo(): UpdateInfo | Promise<UpdateInfo>;
|
15 | /** Convenience method to display a notification message */
|
16 | notify(customMessage?: NotifyOptions): void;
|
17 | }
|
18 |
|
19 | interface Settings {
|
20 | |
21 |
|
22 |
|
23 |
|
24 | distTag?: string | undefined;
|
25 | pkg?: Package | undefined;
|
26 | |
27 |
|
28 |
|
29 | packageName?: string | undefined;
|
30 | |
31 |
|
32 |
|
33 | packageVersion?: string | undefined;
|
34 |
|
35 | updateCheckInterval?: number | undefined;
|
36 |
|
37 | shouldNotifyInNpmScript?: boolean | undefined;
|
38 | }
|
39 |
|
40 | interface NotifyOptions {
|
41 |
|
42 | message?: string | undefined;
|
43 |
|
44 | defer?: boolean | undefined;
|
45 |
|
46 | isGlobal?: boolean | undefined;
|
47 | |
48 |
|
49 |
|
50 |
|
51 | boxenOptions?: BoxenOptions | undefined;
|
52 | }
|
53 |
|
54 | interface Package {
|
55 | name: string;
|
56 | version: string;
|
57 | }
|
58 |
|
59 | interface UpdateInfo {
|
60 |
|
61 | readonly latest: string;
|
62 |
|
63 | readonly current: string;
|
64 |
|
65 | readonly type: "latest" | "major" | "minor" | "patch" | "prerelease" | "build";
|
66 |
|
67 | name: string;
|
68 | }
|
69 |
|
70 | export type { NotifyOptions, Package, Settings, UpdateInfo };
|