1 |
|
2 | import * as readPkg from 'read-pkg';
|
3 | import { IEngine } from './engine';
|
4 | import { IPJSON } from './pjson';
|
5 | import { ITopic } 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 IConfig {
|
9 | |
10 |
|
11 |
|
12 | _base: string;
|
13 | |
14 |
|
15 |
|
16 | root: string;
|
17 | |
18 |
|
19 |
|
20 | arch: ArchTypes;
|
21 | |
22 |
|
23 |
|
24 | bin: string;
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 | cacheDir: string;
|
31 | |
32 |
|
33 |
|
34 | commandsDir: string | undefined;
|
35 | |
36 |
|
37 |
|
38 | commandsDirTS?: string;
|
39 | |
40 |
|
41 |
|
42 | hooks: {
|
43 | [k: string]: string[];
|
44 | };
|
45 | |
46 |
|
47 |
|
48 | hooksTS?: {
|
49 | [k: string]: string[];
|
50 | };
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 | pluginsModule: string | undefined;
|
57 | |
58 |
|
59 |
|
60 | pluginsModuleTS: string | undefined;
|
61 | |
62 |
|
63 |
|
64 |
|
65 |
|
66 | configDir: string;
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 | dataDir: string;
|
73 | |
74 |
|
75 |
|
76 | dirname: string;
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 | errlog: string;
|
83 | |
84 |
|
85 |
|
86 |
|
87 |
|
88 | home: string;
|
89 | |
90 |
|
91 |
|
92 | name: string;
|
93 | |
94 |
|
95 |
|
96 |
|
97 |
|
98 | pjson: IPJSON;
|
99 | |
100 |
|
101 |
|
102 | platform: PlatformTypes;
|
103 | |
104 |
|
105 |
|
106 | shell: string;
|
107 | |
108 |
|
109 |
|
110 | tsconfig: TSConfig | undefined;
|
111 | |
112 |
|
113 |
|
114 |
|
115 |
|
116 | userAgent: string;
|
117 | |
118 |
|
119 |
|
120 |
|
121 |
|
122 | version: string;
|
123 | |
124 |
|
125 |
|
126 | windows: boolean;
|
127 | |
128 |
|
129 |
|
130 |
|
131 |
|
132 | debug: number;
|
133 | |
134 |
|
135 |
|
136 | engine: IEngine;
|
137 | |
138 |
|
139 |
|
140 | npmRegistry: string;
|
141 | |
142 |
|
143 |
|
144 | legacy: boolean;
|
145 | |
146 |
|
147 |
|
148 | topics: ITopic[];
|
149 | }
|
150 | export interface TSConfig {
|
151 | compilerOptions: {
|
152 | rootDirs?: string[];
|
153 | outDir?: string;
|
154 | };
|
155 | }
|
156 | export interface ConfigOptions {
|
157 | name?: string;
|
158 | root?: string;
|
159 | baseConfig?: IConfig;
|
160 | }
|
161 | export declare class Config implements IConfig {
|
162 | |
163 |
|
164 |
|
165 |
|
166 | readonly _base: string;
|
167 | arch: ArchTypes;
|
168 | bin: string;
|
169 | cacheDir: string;
|
170 | configDir: string;
|
171 | dataDir: string;
|
172 | dirname: string;
|
173 | errlog: string;
|
174 | home: string;
|
175 | name: string;
|
176 | pjson: any;
|
177 | platform: PlatformTypes;
|
178 | root: string;
|
179 | shell: string;
|
180 | version: string;
|
181 | windows: boolean;
|
182 | userAgent: string;
|
183 | commandsDir: string | undefined;
|
184 | commandsDirTS: string | undefined;
|
185 | pluginsModule: string | undefined;
|
186 | pluginsModuleTS: string | undefined;
|
187 | tsconfig: TSConfig | undefined;
|
188 | debug: number;
|
189 | hooks: {
|
190 | [k: string]: string[];
|
191 | };
|
192 | hooksTS?: {
|
193 | [k: string]: string[];
|
194 | };
|
195 | engine: IEngine;
|
196 | npmRegistry: string;
|
197 | legacy: boolean;
|
198 | topics: ITopic[];
|
199 | constructor();
|
200 | load(root: string, pjson: readPkg.Package, baseConfig?: IConfig): Promise<this>;
|
201 | scopedEnvVar(k: string): string | undefined;
|
202 | scopedEnvVarTrue(k: string): boolean;
|
203 | scopedEnvVarKey(k: string): string;
|
204 | protected _topics(): void;
|
205 | private dir(category);
|
206 | private windowsHome();
|
207 | private windowsHomedriveHome();
|
208 | private windowsUserprofileHome();
|
209 | private macosCacheDir();
|
210 | private _tsConfig();
|
211 | /**
|
212 | * convert a path from the compiled ./lib files to the ./src typescript source
|
213 | * this is for developing typescript plugins/CLIs
|
214 | * if there is a tsconfig and the original sources exist, it attempts to require ts-
|
215 | */
|
216 | private _tsPath(orig);
|
217 | private _hooks();
|
218 | private _shell();
|
219 | private _debug();
|
220 | }
|
221 | /**
|
222 | * returns true if config is instantiated and not ConfigOptions
|
223 | */
|
224 | export declare function isIConfig(o: any): o is IConfig;
|
225 | /**
|
226 | * reads a plugin/CLI's config
|
227 | */
|
228 | export declare function read(opts?: ConfigOptions): Promise<IConfig>;
|