UNPKG

12.5 kBTypeScriptView Raw
1import { Rule, Tree } from '@angular-devkit/schematics';
2import { ProjectType, WorkspaceProject, WorkspaceSchema } from './workspace-models';
3export interface AppConfig {
4 /**
5 * Name of the app.
6 */
7 name?: string;
8 /**
9 * Directory where app files are placed.
10 */
11 appRoot?: string;
12 /**
13 * The root directory of the app.
14 */
15 root?: string;
16 /**
17 * The output directory for build results.
18 */
19 outDir?: string;
20 /**
21 * List of application assets.
22 */
23 assets?: (string | {
24 /**
25 * The pattern to match.
26 */
27 glob?: string;
28 /**
29 * The dir to search within.
30 */
31 input?: string;
32 /**
33 * The output path (relative to the outDir).
34 */
35 output?: string;
36 })[];
37 /**
38 * URL where files will be deployed.
39 */
40 deployUrl?: string;
41 /**
42 * Base url for the application being built.
43 */
44 baseHref?: string;
45 /**
46 * The runtime platform of the app.
47 */
48 platform?: ('browser' | 'server');
49 /**
50 * The name of the start HTML file.
51 */
52 index?: string;
53 /**
54 * The name of the main entry-point file.
55 */
56 main?: string;
57 /**
58 * The name of the polyfills file.
59 */
60 polyfills?: string;
61 /**
62 * The name of the test entry-point file.
63 */
64 test?: string;
65 /**
66 * The name of the TypeScript configuration file.
67 */
68 tsconfig?: string;
69 /**
70 * The name of the TypeScript configuration file for unit tests.
71 */
72 testTsconfig?: string;
73 /**
74 * The prefix to apply to generated selectors.
75 */
76 prefix?: string;
77 /**
78 * Experimental support for a service worker from @angular/service-worker.
79 */
80 serviceWorker?: boolean;
81 /**
82 * Global styles to be included in the build.
83 */
84 styles?: (string | {
85 input?: string;
86 [name: string]: any;
87 })[];
88 /**
89 * Options to pass to style preprocessors
90 */
91 stylePreprocessorOptions?: {
92 /**
93 * Paths to include. Paths will be resolved to project root.
94 */
95 includePaths?: string[];
96 };
97 /**
98 * Global scripts to be included in the build.
99 */
100 scripts?: (string | {
101 input: string;
102 [name: string]: any;
103 })[];
104 /**
105 * Source file for environment config.
106 */
107 environmentSource?: string;
108 /**
109 * Name and corresponding file for environment config.
110 */
111 environments?: {
112 [name: string]: any;
113 };
114 appShell?: {
115 app: string;
116 route: string;
117 };
118 budgets?: {
119 /**
120 * The type of budget
121 */
122 type?: ('bundle' | 'initial' | 'allScript' | 'all' | 'anyScript' | 'any' | 'anyComponentStyle');
123 /**
124 * The name of the bundle
125 */
126 name?: string;
127 /**
128 * The baseline size for comparison.
129 */
130 baseline?: string;
131 /**
132 * The maximum threshold for warning relative to the baseline.
133 */
134 maximumWarning?: string;
135 /**
136 * The maximum threshold for error relative to the baseline.
137 */
138 maximumError?: string;
139 /**
140 * The minimum threshold for warning relative to the baseline.
141 */
142 minimumWarning?: string;
143 /**
144 * The minimum threshold for error relative to the baseline.
145 */
146 minimumError?: string;
147 /**
148 * The threshold for warning relative to the baseline (min & max).
149 */
150 warning?: string;
151 /**
152 * The threshold for error relative to the baseline (min & max).
153 */
154 error?: string;
155 }[];
156}
157export interface CliConfig {
158 $schema?: string;
159 /**
160 * The global configuration of the project.
161 */
162 project?: {
163 /**
164 * The name of the project.
165 */
166 name?: string;
167 /**
168 * Whether or not this project was ejected.
169 */
170 ejected?: boolean;
171 };
172 /**
173 * Properties of the different applications in this project.
174 */
175 apps?: AppConfig[];
176 /**
177 * Configuration for end-to-end tests.
178 */
179 e2e?: {
180 protractor?: {
181 /**
182 * Path to the config file.
183 */
184 config?: string;
185 };
186 };
187 /**
188 * Properties to be passed to TSLint.
189 */
190 lint?: {
191 /**
192 * File glob(s) to lint.
193 */
194 files?: (string | string[]);
195 /**
196 * Location of the tsconfig.json project file.
197 * Will also use as files to lint if 'files' property not present.
198 */
199 project: string;
200 /**
201 * Location of the tslint.json configuration.
202 */
203 tslintConfig?: string;
204 /**
205 * File glob(s) to ignore.
206 */
207 exclude?: (string | string[]);
208 }[];
209 /**
210 * Configuration for unit tests.
211 */
212 test?: {
213 karma?: {
214 /**
215 * Path to the karma config file.
216 */
217 config?: string;
218 };
219 codeCoverage?: {
220 /**
221 * Globs to exclude from code coverage.
222 */
223 exclude?: string[];
224 };
225 };
226 /**
227 * Specify the default values for generating.
228 */
229 defaults?: {
230 /**
231 * The file extension to be used for style files.
232 */
233 styleExt?: string;
234 /**
235 * How often to check for file updates.
236 */
237 poll?: number;
238 /**
239 * Use lint to fix files after generation
240 */
241 lintFix?: boolean;
242 /**
243 * Options for generating a class.
244 */
245 class?: {
246 /**
247 * Specifies if a spec file is generated.
248 */
249 spec?: boolean;
250 };
251 /**
252 * Options for generating a component.
253 */
254 component?: {
255 /**
256 * Flag to indicate if a directory is created.
257 */
258 flat?: boolean;
259 /**
260 * Specifies if a spec file is generated.
261 */
262 spec?: boolean;
263 /**
264 * Specifies if the style will be in the ts file.
265 */
266 inlineStyle?: boolean;
267 /**
268 * Specifies if the template will be in the ts file.
269 */
270 inlineTemplate?: boolean;
271 /**
272 * Specifies the view encapsulation strategy.
273 */
274 viewEncapsulation?: ('Emulated' | 'Native' | 'None');
275 /**
276 * Specifies the change detection strategy.
277 */
278 changeDetection?: ('Default' | 'OnPush');
279 };
280 /**
281 * Options for generating a directive.
282 */
283 directive?: {
284 /**
285 * Flag to indicate if a directory is created.
286 */
287 flat?: boolean;
288 /**
289 * Specifies if a spec file is generated.
290 */
291 spec?: boolean;
292 };
293 /**
294 * Options for generating a guard.
295 */
296 guard?: {
297 /**
298 * Flag to indicate if a directory is created.
299 */
300 flat?: boolean;
301 /**
302 * Specifies if a spec file is generated.
303 */
304 spec?: boolean;
305 };
306 /**
307 * Options for generating an interface.
308 */
309 interface?: {
310 /**
311 * Prefix to apply to interface names. (i.e. I)
312 */
313 prefix?: string;
314 };
315 /**
316 * Options for generating a module.
317 */
318 module?: {
319 /**
320 * Flag to indicate if a directory is created.
321 */
322 flat?: boolean;
323 /**
324 * Specifies if a spec file is generated.
325 */
326 spec?: boolean;
327 };
328 /**
329 * Options for generating a pipe.
330 */
331 pipe?: {
332 /**
333 * Flag to indicate if a directory is created.
334 */
335 flat?: boolean;
336 /**
337 * Specifies if a spec file is generated.
338 */
339 spec?: boolean;
340 };
341 /**
342 * Options for generating a service.
343 */
344 service?: {
345 /**
346 * Flag to indicate if a directory is created.
347 */
348 flat?: boolean;
349 /**
350 * Specifies if a spec file is generated.
351 */
352 spec?: boolean;
353 };
354 /**
355 * Properties to be passed to the build command.
356 */
357 build?: {
358 /**
359 * Output sourcemaps.
360 */
361 sourcemaps?: boolean;
362 /**
363 * Base url for the application being built.
364 */
365 baseHref?: string;
366 /**
367 * The ssl key used by the server.
368 */
369 progress?: boolean;
370 /**
371 * Enable and define the file watching poll time period (milliseconds).
372 */
373 poll?: number;
374 /**
375 * Delete output path before build.
376 */
377 deleteOutputPath?: boolean;
378 /**
379 * Do not use the real path when resolving modules.
380 */
381 preserveSymlinks?: boolean;
382 /**
383 * Show circular dependency warnings on builds.
384 */
385 showCircularDependencies?: boolean;
386 /**
387 * Use a separate bundle containing code used across multiple bundles.
388 */
389 commonChunk?: boolean;
390 /**
391 * Use file name for lazy loaded chunks.
392 */
393 namedChunks?: boolean;
394 };
395 /**
396 * Properties to be passed to the serve command.
397 */
398 serve?: {
399 /**
400 * The port the application will be served on.
401 */
402 port?: number;
403 /**
404 * The host the application will be served on.
405 */
406 host?: string;
407 /**
408 * Enables ssl for the application.
409 */
410 ssl?: boolean;
411 /**
412 * The ssl key used by the server.
413 */
414 sslKey?: string;
415 /**
416 * The ssl certificate used by the server.
417 */
418 sslCert?: string;
419 /**
420 * Proxy configuration file.
421 */
422 proxyConfig?: string;
423 };
424 /**
425 * Properties about schematics.
426 */
427 schematics?: {
428 /**
429 * The schematics collection to use.
430 */
431 collection?: string;
432 /**
433 * The new app schematic.
434 */
435 newApp?: string;
436 };
437 };
438 /**
439 * Specify which package manager tool to use.
440 */
441 packageManager?: ('npm' | 'cnpm' | 'yarn' | 'default');
442 /**
443 * Allow people to disable console warnings.
444 */
445 warnings?: {
446 /**
447 * Show a warning when the user enabled the --hmr option.
448 */
449 hmrWarning?: boolean;
450 /**
451 * Show a warning when the node version is incompatible.
452 */
453 nodeDeprecation?: boolean;
454 /**
455 * Show a warning when the user installed angular-cli.
456 */
457 packageDeprecation?: boolean;
458 /**
459 * Show a warning when the global version is newer than the local one.
460 */
461 versionMismatch?: boolean;
462 /**
463 * Show a warning when the TypeScript version is incompatible
464 */
465 typescriptMismatch?: boolean;
466 };
467}
468export declare function getWorkspacePath(host: Tree): string;
469export declare function getWorkspace(host: Tree): WorkspaceSchema;
470export declare function addProjectToWorkspace<TProjectType extends ProjectType = ProjectType.Application>(workspace: WorkspaceSchema, name: string, project: WorkspaceProject<TProjectType>): Rule;
471export declare function updateWorkspace(workspace: WorkspaceSchema): Rule;
472export declare const configPath = "/.angular-cli.json";
473export declare function getConfig(host: Tree): CliConfig;
474export declare function getAppFromConfig(config: CliConfig, appIndexOrName: string): AppConfig | null;