UNPKG

903 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.checkProjectExists = void 0;
4const rxjs_1 = require("rxjs");
5const operators_1 = require("rxjs/operators");
6const workspace_1 = require("../workspace");
7/**
8 * Checks whether the project exists in the workspace.
9 * Throws an Error if the project is not found.
10 *
11 * @param schema The options provided to the schematic
12 */
13function checkProjectExists(schema) {
14 return (tree, _context) => {
15 return (0, rxjs_1.from)((0, workspace_1.getWorkspace)(tree)).pipe((0, operators_1.map)((workspace) => {
16 if (!workspace.projects.has(schema.projectName)) {
17 throw new Error(`Project not found in workspace: [${schema.projectName}]`);
18 }
19 return tree;
20 }));
21 };
22}
23exports.checkProjectExists = checkProjectExists;
24//# sourceMappingURL=check-project-exists.js.map
\No newline at end of file