1 | import { Command } from './command';
|
2 | import { Hooks } from './hooks';
|
3 | import { PJSON } from './pjson';
|
4 | import * as Plugin from './plugin';
|
5 | import { Topic } from './topic';
|
6 | export declare type PlatformTypes = 'darwin' | 'linux' | 'win32' | 'aix' | 'freebsd' | 'openbsd' | 'sunos' | 'wsl';
|
7 | export declare type ArchTypes = 'arm' | 'arm64' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | 'x86';
|
8 | export interface Options extends Plugin.Options {
|
9 | devPlugins?: boolean;
|
10 | userPlugins?: boolean;
|
11 | channel?: string;
|
12 | version?: string;
|
13 | }
|
14 | export interface IConfig {
|
15 | name: string;
|
16 | version: string;
|
17 | channel: string;
|
18 | pjson: PJSON.CLI;
|
19 | root: string;
|
20 | |
21 |
|
22 |
|
23 | arch: ArchTypes;
|
24 | |
25 |
|
26 |
|
27 | bin: string;
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 | cacheDir: string;
|
34 | |
35 |
|
36 |
|
37 |
|
38 |
|
39 | configDir: string;
|
40 | |
41 |
|
42 |
|
43 |
|
44 |
|
45 | dataDir: string;
|
46 | |
47 |
|
48 |
|
49 | dirname: string;
|
50 | |
51 |
|
52 |
|
53 |
|
54 |
|
55 | errlog: string;
|
56 | |
57 |
|
58 |
|
59 |
|
60 |
|
61 | home: string;
|
62 | |
63 |
|
64 |
|
65 | platform: PlatformTypes;
|
66 | |
67 |
|
68 |
|
69 | shell: string;
|
70 | |
71 |
|
72 |
|
73 |
|
74 |
|
75 | userAgent: string;
|
76 | |
77 |
|
78 |
|
79 | windows: boolean;
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 | debug: number;
|
86 | |
87 |
|
88 |
|
89 | npmRegistry?: string;
|
90 | userPJSON?: PJSON.User;
|
91 | plugins: Plugin.IPlugin[];
|
92 | binPath?: string;
|
93 | valid: boolean;
|
94 | readonly commands: Command.Plugin[];
|
95 | readonly topics: Topic[];
|
96 | readonly commandIDs: string[];
|
97 | runCommand(id: string, argv?: string[]): Promise<void>;
|
98 | runHook<T extends Hooks, K extends Extract<keyof T, string>>(event: K, opts: T[K]): Promise<void>;
|
99 | findCommand(id: string, opts: {
|
100 | must: true;
|
101 | }): Command.Plugin;
|
102 | findCommand(id: string, opts?: {
|
103 | must: boolean;
|
104 | }): Command.Plugin | undefined;
|
105 | findTopic(id: string, opts: {
|
106 | must: true;
|
107 | }): Topic;
|
108 | findTopic(id: string, opts?: {
|
109 | must: boolean;
|
110 | }): Topic | undefined;
|
111 | scopedEnvVar(key: string): string | undefined;
|
112 | scopedEnvVarKey(key: string): string;
|
113 | scopedEnvVarTrue(key: string): boolean;
|
114 | s3Url(key: string): string;
|
115 | s3Key(type: 'versioned' | 'unversioned', ext: '.tar.gz' | '.tar.xz', options?: IConfig.s3Key.Options): string;
|
116 | s3Key(type: keyof PJSON.S3.Templates, options?: IConfig.s3Key.Options): string;
|
117 | }
|
118 | export declare namespace IConfig {
|
119 | namespace s3Key {
|
120 | interface Options {
|
121 | platform?: PlatformTypes;
|
122 | arch?: ArchTypes;
|
123 | [key: string]: any;
|
124 | }
|
125 | }
|
126 | }
|
127 | export declare class Config implements IConfig {
|
128 | options: Options;
|
129 | _base: string;
|
130 | name: string;
|
131 | version: string;
|
132 | channel: string;
|
133 | root: string;
|
134 | arch: ArchTypes;
|
135 | bin: string;
|
136 | cacheDir: string;
|
137 | configDir: string;
|
138 | dataDir: string;
|
139 | dirname: string;
|
140 | errlog: string;
|
141 | home: string;
|
142 | platform: PlatformTypes;
|
143 | shell: string;
|
144 | windows: boolean;
|
145 | userAgent: string;
|
146 | debug: number;
|
147 | npmRegistry?: string;
|
148 | pjson: PJSON.CLI;
|
149 | userPJSON?: PJSON.User;
|
150 | plugins: Plugin.IPlugin[];
|
151 | binPath?: string;
|
152 | valid: boolean;
|
153 | protected warned: boolean;
|
154 | constructor(options: Options);
|
155 | load(): Promise<void>;
|
156 | loadCorePlugins(): Promise<void>;
|
157 | loadDevPlugins(): Promise<void>;
|
158 | loadUserPlugins(): Promise<void>;
|
159 | runHook<T>(event: string, opts: T): Promise<void>;
|
160 | runCommand(id: string, argv?: string[]): Promise<void>;
|
161 | scopedEnvVar(k: string): string | undefined;
|
162 | scopedEnvVarTrue(k: string): boolean;
|
163 | scopedEnvVarKey(k: string): string;
|
164 | findCommand(id: string, opts: {
|
165 | must: true;
|
166 | }): Command.Plugin;
|
167 | findCommand(id: string, opts?: {
|
168 | must: boolean;
|
169 | }): Command.Plugin | undefined;
|
170 | findTopic(id: string, opts: {
|
171 | must: true;
|
172 | }): Topic;
|
173 | findTopic(id: string, opts?: {
|
174 | must: boolean;
|
175 | }): Topic | undefined;
|
176 | get commands(): Command.Plugin[];
|
177 | get commandIDs(): string[];
|
178 | get topics(): Topic[];
|
179 | s3Key(type: keyof PJSON.S3.Templates, ext?: '.tar.gz' | '.tar.xz' | IConfig.s3Key.Options, options?: IConfig.s3Key.Options): string;
|
180 | s3Url(key: string): string;
|
181 | protected dir(category: 'cache' | 'data' | 'config'): string;
|
182 | protected windowsHome(): string | undefined;
|
183 | protected windowsHomedriveHome(): string | undefined;
|
184 | protected windowsUserprofileHome(): string | undefined;
|
185 | protected macosCacheDir(): string | undefined;
|
186 | protected _shell(): string;
|
187 | protected _debug(): number;
|
188 | protected loadPlugins(root: string, type: string, plugins: (string | {
|
189 | root?: string;
|
190 | name?: string;
|
191 | tag?: string;
|
192 | })[], parent?: Plugin.Plugin): Promise<void>;
|
193 | protected warn(err: string | Error | {
|
194 | name: string;
|
195 | detail: string;
|
196 | }, scope?: string): void;
|
197 | }
|
198 | export declare type LoadOptions = Options | string | IConfig | undefined;
|
199 | export declare function load(opts?: LoadOptions): Promise<IConfig | Config>;
|