UNPKG

1.18 kBJavaScriptView Raw
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 });
10function default_1() {
11 return (options, context) => {
12 if (!(options === null || options === void 0 ? void 0 : options.name)) {
13 throw new Error('RunSchematicTask requires an options object with a non-empty name property.');
14 }
15 const maybeWorkflow = context.engine.workflow;
16 const collection = options.collection || context.schematic.collection.description.name;
17 if (!maybeWorkflow) {
18 throw new Error('Need Workflow to support executing schematics as post tasks.');
19 }
20 return maybeWorkflow.execute({
21 collection: collection,
22 schematic: options.name,
23 options: options.options,
24 // Allow private when calling from the same collection.
25 allowPrivate: collection == context.schematic.collection.description.name,
26 });
27 };
28}
29exports.default = default_1;