Plugin Use Cases
Nx plugins contain generators and executors that extend the capabilities of an Nx workspace. They can be shared as npm packages or referenced locally within the same repo.
Use a Plugin
Plugins allow you to easily adopt the industry standard practices for a particular framework without bearing all the maintenance burden. By tapping into the expertise of the plugin maintainers, you're freed up to focus on features that are specific to your application domain.
Find a plugin to use
Run operations on your code
Create or modify code
Keep code up to date with package breaking changes
Create a Local Plugin
Local plugins allow you to automate and centralize repository specific tasks. You can automate code creation and modification tasks with code generators. Instead of writing a 7 step guide in a readme file, you can create a generator to prompt the developer for inputs and modify the code directly. Make scripts and their flags easily discoverable with executors. And Nx Console offers a ready-made UI for your repo specific tasks.
Set up a new plugin
Add a generator to your plugin
Add an executor to your plugin
Maintain a Published Plugin
If your plugin has functionality that would be useful in more than just your repo, you can publish it to npm and register it on the nx.dev site for others to find. When other repos start using your plugin, you'll want to create migration generators to help them stay up to date whenever you make breaking changes.
Update repos when you introduce breaking changes
Submit your plugin to the Nx plugin registry
Use Nx as Your Framework CLI
Framework authors can build a CLI tool for their users on top of Nx. Generators allow users to create the building blocks for the framework. Executors allow users to focus on using the framework instead of worrying about the build and test tooling. Migration generators make it easy for users to stay up to date with the latest version of the framework.
With Nx 16, framework authors can now provide a seamless initial express by authoring a create-my-framework
package that will automatically run a preset
generator to scaffold a new workspace. Authors can also hook into the way Nx identifies projects and creates the project graph so the users aren't required to have project.json
files if the dependency information is already specified in a different file.
Set up your framework in a new repo
Modify how Nx identifies projects
Modify the Nx graph