nx
nx copied to clipboard
feat(core): nx list support listing custom or thirdparty plugins based on configuration
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
☁️ Nx Cloud Report
CI is running/has finished running commands for commit 4b9ba748902cd20089812d6f6a5c5f28944b716e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this branch
✅ Successfully ran 12 targets
nx affected --target=e2e --base=7f259493ac1f0bdb2ba7423d45ac9ec51c3f315c --head=4b9ba748902cd20089812d6f6a5c5f28944b716e --exclude=e2e-storybook,e2e-storybook-angular,e2e-react-native,e2e-detox --parallel=1nx affected --target=test --base=7f259493ac1f0bdb2ba7423d45ac9ec51c3f315c --head=4b9ba748902cd20089812d6f6a5c5f28944b716e --parallel=1nx affected --target=build --base=7f259493ac1f0bdb2ba7423d45ac9ec51c3f315c --head=4b9ba748902cd20089812d6f6a5c5f28944b716e --parallel=3nx affected --target=lint --base=7f259493ac1f0bdb2ba7423d45ac9ec51c3f315c --head=4b9ba748902cd20089812d6f6a5c5f28944b716e --parallel=3nx-cloud record -- yarn nx workspace-lintnx-cloud record -- yarn documentationnx build typedoc-themenx-cloud record -- yarn depchecknx-cloud record -- yarn check-lock-filesnx-cloud record -- yarn check-commitnx-cloud record -- yarn nx format:check --base=7f259493ac1f0bdb2ba7423d45ac9ec51c3f315c --head=4b9ba748902cd20089812d6f6a5c5f28944b716enx-cloud record -- yarn check-imports
Sent with 💌 from NxCloud.
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) |
Is there a reason to have this as a separate config file rather than a new option in nx.json?
@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.
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
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.
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.
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. 🙏
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.