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