get-project.js 1.1 KB

12345678910111213141516171819202122232425262728
  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.getProjectFromWorkspace = getProjectFromWorkspace;
  11. const schematics_1 = require("@angular-devkit/schematics");
  12. /**
  13. * Finds the specified project configuration in the workspace. Throws an error if the project
  14. * couldn't be found.
  15. */
  16. function getProjectFromWorkspace(workspace, projectName) {
  17. if (!projectName) {
  18. // TODO(crisbeto): some schematics APIs have the project name as optional so for now it's
  19. // simpler to allow undefined and checking it at runtime. Eventually we should clean this up.
  20. throw new schematics_1.SchematicsException('Project name is required.');
  21. }
  22. const project = workspace.projects.get(projectName);
  23. if (!project) {
  24. throw new schematics_1.SchematicsException(`Could not find project in workspace: ${projectName}`);
  25. }
  26. return project;
  27. }
  28. //# sourceMappingURL=get-project.js.map