project-targets.js 1005 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google Inc. 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.io/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. const schematics_1 = require("@angular-devkit/schematics");
  11. const project_1 = require("./project");
  12. function getProjectTargets(projectOrHost, projectName = '') {
  13. const project = project_1.isWorkspaceProject(projectOrHost)
  14. ? projectOrHost
  15. : project_1.getProject(projectOrHost, projectName);
  16. const projectTargets = project.targets || project.architect;
  17. if (!projectTargets) {
  18. throw new Error('Project target not found.');
  19. }
  20. return projectTargets;
  21. }
  22. exports.getProjectTargets = getProjectTargets;
  23. function targetBuildNotFoundError() {
  24. return new schematics_1.SchematicsException(`Project target "build" not found.`);
  25. }
  26. exports.targetBuildNotFoundError = targetBuildNotFoundError;