"use strict"; /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ Object.defineProperty(exports, "__esModule", { value: true }); exports.getProjectFromWorkspace = void 0; const schematics_1 = require("@angular-devkit/schematics"); /** * Finds the specified project configuration in the workspace. Throws an error if the project * couldn't be found. */ function getProjectFromWorkspace(workspace, projectName) { if (!projectName) { // TODO(crisbeto): some schematics APIs have the project name as optional so for now it's // simpler to allow undefined and checking it at runtime. Eventually we should clean this up. throw new schematics_1.SchematicsException('Project name is required.'); } const project = workspace.projects.get(projectName); if (!project) { throw new schematics_1.SchematicsException(`Could not find project in workspace: ${projectName}`); } return project; } exports.getProjectFromWorkspace = getProjectFromWorkspace; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXByb2plY3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL3NjaGVtYXRpY3MvdXRpbHMvZ2V0LXByb2plY3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7O0FBR0gsMkRBQStEO0FBRS9EOzs7R0FHRztBQUNILFNBQWdCLHVCQUF1QixDQUNyQyxTQUF5QyxFQUN6QyxXQUErQjtJQUUvQixJQUFJLENBQUMsV0FBVyxFQUFFO1FBQ2hCLHlGQUF5RjtRQUN6Riw2RkFBNkY7UUFDN0YsTUFBTSxJQUFJLGdDQUFtQixDQUFDLDJCQUEyQixDQUFDLENBQUM7S0FDNUQ7SUFFRCxNQUFNLE9BQU8sR0FBRyxTQUFTLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUMsQ0FBQztJQUVwRCxJQUFJLENBQUMsT0FBTyxFQUFFO1FBQ1osTUFBTSxJQUFJLGdDQUFtQixDQUFDLHdDQUF3QyxXQUFXLEVBQUUsQ0FBQyxDQUF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