Library schematic conflicts with itself when used with applyToSubtree #16082
Labels
area: devkit/schematics
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Milestone
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Not that I'm aware of.
Description
I tried to create a schematic that would create an Anglar application and then create a library within that application, but the library schematic wouldn't run in the folder created by
ng-new
. That's explained in issue #16080, which is distinct from the issue I'm reporting here. It serves as background about why I needed to useapplyToSubtree
.When I execute the library schematic within
applyToSubtree
, it seems to find the right folder and generates a list of files, but it then conflicts on the library's module file. To be clear, the library schematic creates a new file in a new folder and then fails with a merge conflict. I suspect that's because it calls schematics in turn to create a module, component and service.Whichever way, there is no apparent way to get around this, because the merge happens within the library schematic itself and I'm not given the chance to supply a
MergeStrategy
.Just because I know someone will ask: No, the file does not exist outside of the schematic and it was not created by the ng-new call.
🔬 Minimal Reproduction
You can find a minimal reproduction in this repo
Here's an abstract. I use this factory:
NewAngularAppWithSubtree
is the path created by theng-new
call. A merge error then occurs on this file:/NewAngularAppWithSubtree/projects/new-lib/src/lib/new-lib.module.ts
. Note that this file was created by the library schematic, not by ng-new.🔥 Exception or Error
🌍 Your Environment
The text was updated successfully, but these errors were encountered: