(project: ProjectDefinition)
| 13 | |
| 14 | /** Looks for the main TypeScript file in the given project and returns its path. */ |
| 15 | export function getProjectMainFile(project: ProjectDefinition): Path { |
| 16 | const buildOptions = getProjectTargetOptions(project, 'build'); |
| 17 | |
| 18 | // `browser` is for the `@angular-devkit/build-angular:application` builder while |
| 19 | // `main` is for the `@angular-devkit/build-angular:browser` builder. |
| 20 | const mainPath = (buildOptions['browser'] || buildOptions['main']) as Path | undefined; |
| 21 | |
| 22 | if (!mainPath) { |
| 23 | throw new SchematicsException( |
| 24 | `Could not find the project main file inside of the ` + |
| 25 | `workspace config (${project.sourceRoot})`, |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | return mainPath; |
| 30 | } |
no test coverage detected