nx/docs/shared/recipes/plugins/publish-plugin.md
Isaac Mann ba47c72981
docs(core): add organization plugin tutorial (#27279)
Updates the Extending Nx section.

- New intro content
- Enforce Organizational Best Practices tutorial
- Tooling Plugin tutorial
    - Flexible base generators
    - Inferred tasks
    - Executors
    - Migration generators
    - Publishing and listing the plugin
    - E2E testing with Verdaccio

In a separate PR:
- Repository Structure Plugin tutorial
    - Presets
    - Create-* script
    - Migration generators
2024-08-15 10:22:07 -04:00

1.8 KiB

Publish your Nx Plugin

In order to use your plugin in other workspaces or share it with the community, you will need to publish it to an npm registry. To publish your plugin follow these steps:

  1. nx nx-release-publish nx-cfonts
  2. Follow the prompts from npm.
  3. That's it!

After that, you can then install your plugin like any other Nx plugin -

nx add nx-cfonts

List your Nx Plugin

Nx provides a utility (nx list) that lists both core and community plugins. You can submit your plugin to be added to this list, but it needs to meet a few criteria first:

  • Run some kind of automated e2e tests in your repository
  • Include @nx/devkit as a dependency in the plugin's package.json
  • List a repository.url in the plugin's package.json
{
  "repository": {
    "type": "git",
    "url": "https://github.com/nrwl/nx.git",
    "directory": "packages/web"
  }
}

{% callout type="warning" title="Unmaintained Plugins" %} We reserve the right to remove unmaintained plugins from the registry. If the plugins become maintained again, they can be resubmitted to the registry. {% /callout %}

Once those criteria are met, you can submit your plugin by following the steps below:

  • Fork the Nx repo (if you haven't already)
  • Update the community/approved-plugins.json file with a new entry for your plugin that includes name, url and description
  • Use the following commit message template: chore(core): nx plugin submission [PLUGIN_NAME]
  • push your changes, and run yarn submit-plugin

The yarn submit-plugin command automatically opens the GitHub pull request process with the correct template.

We will then verify the plugin, offer suggestions or merge the pull request!