executor.js 774 B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. function default_1() {
  4. return (options, context) => {
  5. const maybeWorkflow = context.engine.workflow;
  6. const collection = options.collection || context.schematic.collection.description.name;
  7. if (!maybeWorkflow) {
  8. throw new Error('Need Workflow to support executing schematics as post tasks.');
  9. }
  10. return maybeWorkflow.execute({
  11. collection: collection,
  12. schematic: options.name,
  13. options: options.options,
  14. // Allow private when calling from the same collection.
  15. allowPrivate: collection == context.schematic.collection.description.name,
  16. });
  17. };
  18. }
  19. exports.default = default_1;