Skip to content

Commit bf043d0

Browse files
clydinalan-agius4
authored andcommitted
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. (cherry picked from commit 495459a)
1 parent 13bedc3 commit bf043d0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/angular_devkit/schematics/src/rules/schematic.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ export function externalSchematic<OptionT extends object>(
2929
const collection = context.engine.createCollection(collectionName, context.schematic.collection);
3030
const schematic = collection.createSchematic(schematicName);
3131

32-
return schematic.call(options, observableOf(branch(input)), context, executionOptions);
32+
return schematic.call(options, observableOf(branch(input)), context, executionOptions).pipe(
33+
last(),
34+
map(x => {
35+
input.merge(x, MergeStrategy.AllowOverwriteConflict);
36+
37+
return input;
38+
}),
39+
);
3340
};
3441
}
3542

0 commit comments

Comments
 (0)