project-main-file.js 1.1 KB

12345678910111213141516171819202122232425
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.dev/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. exports.getProjectMainFile = getProjectMainFile;
  11. const schematics_1 = require("@angular-devkit/schematics");
  12. const project_targets_1 = require("./project-targets");
  13. /** Looks for the main TypeScript file in the given project and returns its path. */
  14. function getProjectMainFile(project) {
  15. const buildOptions = (0, project_targets_1.getProjectTargetOptions)(project, 'build');
  16. // `browser` is for the `@angular-devkit/build-angular:application` builder while
  17. // `main` is for the `@angular-devkit/build-angular:browser` builder.
  18. const mainPath = (buildOptions['browser'] || buildOptions['main']);
  19. if (!mainPath) {
  20. throw new schematics_1.SchematicsException(`Could not find the project main file inside of the ` +
  21. `workspace config (${project.sourceRoot})`);
  22. }
  23. return mainPath;
  24. }
  25. //# sourceMappingURL=project-main-file.js.map