|
|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
import {
|
|
|
|
|
apply,
|
|
|
|
|
chain,
|
|
|
|
|
forEach,
|
|
|
|
|
MergeStrategy,
|
|
|
|
|
mergeWith,
|
|
|
|
|
Rule,
|
|
|
|
|
SchematicContext,
|
|
|
|
|
@ -16,6 +18,14 @@ export function applyWithOverwrite(source: Source, rules: Rule[]): Rule {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function chainAndMerge(rules: Rule[]) {
|
|
|
|
|
return (host: Tree) => async (tree: Tree, context: SchematicContext) =>
|
|
|
|
|
host.merge(
|
|
|
|
|
(await (chain(rules)(tree, context) as any).toPromise()) as Tree,
|
|
|
|
|
MergeStrategy.AllowDeleteConflict,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function overwriteFileIfExists(tree: Tree): Rule {
|
|
|
|
|
return forEach(fileEntry => {
|
|
|
|
|
if (!tree.exists(fileEntry.path)) return fileEntry;
|
|
|
|
|
|