source: trip-planner-front/node_modules/@angular-devkit/schematics/src/rules/schematic.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.3 KB
Line 
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.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.schematic = exports.externalSchematic = void 0;
11const rxjs_1 = require("rxjs");
12const operators_1 = require("rxjs/operators");
13const interface_1 = require("../tree/interface");
14const static_1 = require("../tree/static");
15/**
16 * Run a schematic from a separate collection.
17 *
18 * @param collectionName The name of the collection that contains the schematic to run.
19 * @param schematicName The name of the schematic to run.
20 * @param options The options to pass as input to the RuleFactory.
21 */
22function externalSchematic(collectionName, schematicName, options, executionOptions) {
23 return (input, context) => {
24 const collection = context.engine.createCollection(collectionName, context.schematic.collection);
25 const schematic = collection.createSchematic(schematicName);
26 return schematic.call(options, rxjs_1.of(static_1.branch(input)), context, executionOptions).pipe(operators_1.last(), operators_1.map((x) => {
27 input.merge(x, interface_1.MergeStrategy.AllowOverwriteConflict);
28 return input;
29 }));
30 };
31}
32exports.externalSchematic = externalSchematic;
33/**
34 * Run a schematic from the same collection.
35 *
36 * @param schematicName The name of the schematic to run.
37 * @param options The options to pass as input to the RuleFactory.
38 */
39function schematic(schematicName, options, executionOptions) {
40 return (input, context) => {
41 const collection = context.schematic.collection;
42 const schematic = collection.createSchematic(schematicName, true);
43 return schematic.call(options, rxjs_1.of(static_1.branch(input)), context, executionOptions).pipe(operators_1.last(), operators_1.map((x) => {
44 // We allow overwrite conflict here because they're the only merge conflict we particularly
45 // don't want to deal with; the input tree might have an OVERWRITE which the sub
46 input.merge(x, interface_1.MergeStrategy.AllowOverwriteConflict);
47 return input;
48 }));
49 };
50}
51exports.schematic = schematic;
Note: See TracBrowser for help on using the repository browser.