nx icon indicating copy to clipboard operation
nx copied to clipboard

feat(core): nx list support listing custom or thirdparty plugins based on configuration

Open ByteOPCode opened this issue 3 years ago • 2 comments

Current Behavior

The existing implementation for nx list would list only core and community approved plugins and there is no way for nx list to support plugins hosted in internal artifactory or custom plugins

Expected Behavior

After this change, nx list will try to read nx-plugin.conf file in the root to see if there are any upstream source for listing plugins, similar to community plugins - users can pass an upstream URL's for JSON file that would list custom plugins. This will helpful listing and reusing plugins hosted in internal artifactory of organizations.

Related Issue(s)

More Info : https://github.com/nrwl/nx/issues/11381

ByteOPCode avatar Aug 06 '22 12:08 ByteOPCode

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Aug 6, 2022 at 3:08PM (UTC)

vercel[bot] avatar Aug 06 '22 12:08 vercel[bot]

Is there a reason to have this as a separate config file rather than a new option in nx.json?

luxaritas avatar Aug 11 '22 02:08 luxaritas

@luxaritas Correct me if I am wrong - nx.json file is only available if the project is already based on nx application, by having this as external config file, one can list nx plugins in non-nx based projects aswell.

The common usecase would be of listing plugins from a custom source for migrating an old codebase to a nx-based monorepo application.

If artifactory has internal plugins like CRA to nx, having a separate config file will be helpful in listing available plugins as CRA based app would not have nx.json file.

Hope this answers your question.

ByteOPCode avatar Aug 11 '22 22:08 ByteOPCode

IMO, it's just as much "you need to know this already exists" to have to set up the custom JSON file as it is to know your initial conversion generator exists. Also, generators don't work if Nx hasn't been set up in a project yet, so you'd still need to run add-nx-to-monorepo anyways

luxaritas avatar Aug 11 '22 22:08 luxaritas

it's just as much "you need to know this already exists" to have to set up the custom JSON file as it is to know your initial conversion generator exists.

I think this will encourage people to come up with custom repositories like this but for nx that indexes all plugins into JSON URL (And one don't have to setup JSON file, Just point them to upstream JSON file). Because of the way the implementation is currently designed, it is not feasible to list user-created plugins without first having such plugins authorized as community plugins.

The same principle applies to plugins and NX packages that are stored in the private Artifactory, which currently hosts more than 30 NX-based plugins and packages.

ByteOPCode avatar Aug 11 '22 23:08 ByteOPCode

And one don't have to setup JSON file, Just point them to upstream JSON file

Right - but you still need to know that upstream JSON file exists. If you're concerned about finding the "initial generator to use", isn't it just as difficult to find out where your initial generator is which will automatically fill it out in the nx.json for you vs finding out where the upstream json file is and how to put that in the right place locally? Regardless, the fact you can't run generators until nx is initialized still removes any benefit from being able to have it work before setting up Nx afaik.

luxaritas avatar Aug 11 '22 23:08 luxaritas

Hi,

It's awesome you're writing custom plugins for your organization!

nx list is more of a way to discovery other plugins. You could also visit https://nx.dev/community#plugin-directory

nx report will also list your 3rd party plugins that are not part of our list.

I don't think it's hard to implement a command to list "awesome nx plugins" from a repo? They could publish something to npm that parses the readme or something like that. I don't think we need anything generic for nx list.

Thank you for working on the feature though! In the future, let's discuss in the issue more opening a PR so no work is wasted. 🙏

FrozenPandaz avatar Aug 12 '22 21:08 FrozenPandaz

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

github-actions[bot] avatar Mar 18 '23 02:03 github-actions[bot]