Skip to content

Commit

Permalink
fix(@angular-devkit/schematics): merge external schematics after exec…
Browse files Browse the repository at this point in the history
…ution

When an `externalSchematic` rule was used, the input tree was branched but never merged back into the input tree.  This resulted in a different tree instance being returned from the rule.  The `externalSchematic` rule now behaves like the `schematic` rule which merges the trees.
  • Loading branch information
clydin authored and alan-agius4 committed Feb 1, 2021
1 parent 8688de4 commit 495459a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/angular_devkit/schematics/src/rules/schematic.ts
Expand Up @@ -29,7 +29,14 @@ export function externalSchematic<OptionT extends object>(
const collection = context.engine.createCollection(collectionName, context.schematic.collection);
const schematic = collection.createSchematic(schematicName);

return schematic.call(options, observableOf(branch(input)), context, executionOptions);
return schematic.call(options, observableOf(branch(input)), context, executionOptions).pipe(
last(),
map(x => {
input.merge(x, MergeStrategy.AllowOverwriteConflict);

return input;
}),
);
};
}

Expand Down

0 comments on commit 495459a

Please sign in to comment.