Fl0ris
Fl0ris

Reputation: 38

How could I make my NX generator be run in an Angular environment using an NPX command?

So I've made an NX plugin, containing a generator. This generator installs a few packages and overwrites some files based on some userinput. Now the goal is to have this package be executed in just a blank Angular workspace, without needing it to be an NX workspace. An expected use would be to just use npx [package] and have it run it's course. Problem is ofcourse that an nx generator needs nx.

Now I found somewhat of a solution assigning a bin script to execute it using the ng generate command. However this would need to be wrapped as an external schematic and using a collections.json if I have to believe the Github CoPilot (Of which the reliability is ofcourse already questionable by itself.) Online I can find frightingly little on NX as a whole, except on it's own general docs.

This however seems very janky and like it ain't a proper method to do so to me. Does anyone happen to have an idea how I can do this in a nicer way?

Upvotes: 0

Views: 73

Answers (0)

Related Questions