Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): ability to run local nx plugins w/o build step #9116

Merged
merged 4 commits into from Mar 18, 2022

Conversation

AgentEnder
Copy link
Member

@AgentEnder AgentEnder commented Feb 24, 2022

Current Behavior

Nx plugins are loaded through a combination of require.resolve and require. For this to work for plugins that were created and live as a project in the workspace, that project must be built and available via NODE_PATH (sometimes this is done by symlinking outputs to node_modules).

This complicates the setup for workspace executors, as devs must set up an automated build before the command. This can be done either using targetDependencies or a clever post-install script, but neither is really ideal.

Using target dependencies, you have to set this up for every target name that a custom executor will be used for
Using post-install scripts, or prepare npm scripts, means that the script has to be run after each change.

Expected Behavior

Created nx plugins' functionality is available to the CLI, in the same manner, that an installed plugin would be.

e.g. this should work

nx g @nrwl/nx-plugin:plugin my-plugin --importPath @acme/my-plugin
nx g @nrwl/nx-plugin:generator app --project my-plugin
nx g @acme/my-plugin:app

Related Issue(s)

Fixes #8824
Fixes #3231
Fixes #6926
Fixes #7271
Fixes #7939
Fixes #6712
Fixes #7166
Fixes #5548

@nx-cloud
Copy link

nx-cloud bot commented Feb 24, 2022

☁️ Nx Cloud Report

CI ran the following commands for commit 48d2390. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 7 targets

Sent with 💌 from NxCloud.

@vercel
Copy link

vercel bot commented Feb 24, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nrwl/nx-dev/9d2pv8JGLsXfDhVWtb6bkz1pDGBq
✅ Preview: https://nx-dev-git-fork-agentender-feat-local-plugin-inference-nrwl.vercel.app

[Deployment for 48d2390 canceled]

@AgentEnder AgentEnder changed the title feat(core): ability to run local nx plugins generators and executors feat(core): ability to run local nx plugins w/o build step Feb 24, 2022
@AgentEnder AgentEnder force-pushed the feat/local-plugin-inference branch 2 times, most recently from 14a8ccd to abab329 Compare February 25, 2022 14:38
@AgentEnder AgentEnder marked this pull request as ready for review February 25, 2022 22:00
@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.