MCPcopy Create free account
hub / github.com/angular/components / getProjectIndexFiles

Function getProjectIndexFiles

src/cdk/schematics/utils/project-index-file.ts:17–44  ·  view source on GitHub ↗
(project: ProjectDefinition)

Source from the content-addressed store, hash-verified

15 * This only searches the base options for each target and not any defined target configurations.
16 */
17export function getProjectIndexFiles(project: ProjectDefinition): string[] {
18 // Use a Set to remove duplicate index files referenced in multiple build targets of a project.
19 const paths = new Set<string>();
20
21 for (const target of getProjectBuildTargets(project)) {
22 const indexValue = target.options?.['index'];
23
24 switch (typeof indexValue) {
25 case 'string':
26 // "index": "src/index.html"
27 paths.add(indexValue);
28 break;
29 case 'object':
30 // "index": { "input": "src/index.html", ... }
31 if (indexValue && 'input' in indexValue) {
32 paths.add(indexValue['input'] as string);
33 }
34 break;
35 case 'undefined':
36 // v20+ supports an optional index field; default of `<project_source_root>/index.html`
37 // `project_source_root` is the project level `sourceRoot`; default of `<project_root>/src`
38 paths.add(join(project.sourceRoot ?? join(project.root, 'src'), 'index.html'));
39 break;
40 }
41 }
42
43 return Array.from(paths);
44}

Callers 2

index.spec.tsFile · 0.90
addFontsToIndexFunction · 0.90

Calls 2

getProjectBuildTargetsFunction · 0.90
addMethod · 0.45

Tested by

no test coverage detected