fix(@angular-devkit/schematics): merge external schematics after execution

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.
This commit is contained in:
Charles Lyding 2021-01-29 14:20:02 -05:00 committed by Alan Agius
parent 8688de462e
commit 495459a8a3

View File

@ -29,7 +29,14 @@ export function externalSchematic<OptionT extends object>(
const collection = context.engine.createCollection(collectionName, context.schematic.collection); const collection = context.engine.createCollection(collectionName, context.schematic.collection);
const schematic = collection.createSchematic(schematicName); 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;
}),
);
}; };
} }