Testing local generators which only update existing files #19945
mrvonwyl
started this conversation in
Show and Tell
Replies: 1 comment
-
After scouring the NX generators source code, I stumbled upon I hope this helps anyone else looking for testing their generators. Feel free to add to the discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everybody.
I am new to NX plugins and especially local generators and started writing my own.
My current use case is to add a Docker Build target to the project.json of an existing app. But there are many more.
I update the project.json like this:
The generator works as expected. However, I also want to test the generator and the documentation seems to be thin.
What I found so far is that a temporary Tree can be created with
createTreeWithEmptyWorkspace()
.But how would I go forward from here? Do I need to use
tree.write()
for every required file?And how can I satisfy the existence of a project, since I rely on the project name to locate the project.json?
Thank you for any hint on this!
Beta Was this translation helpful? Give feedback.
All reactions