-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Plugin depending on another plugin #1938
Comments
@pksunkara thanks for taking the time to add this feature, it looks exactly like what i need, but I'm a bit confused as to how to use it. I've got a cli plugin i'm working on and I'd like it to invoke |
In the above case, you can simple depend on it and invoke it from your code. You don't need hooks. |
@pksunkara What do you mean by 'invoke it in your code'? Within the cli plugin code somehow? Or by a second manual invoke on the cli for the project using the plugin? I've added the dependency to the plugin so this must be what I'm missing. I was assuming it would be added automagically. I've done plenty of Vue but this is my first cli plugin so please forgive my ignorance. |
Same issue as @redskyburning, I am scratching my head and trying various options, looking through #2337, but I can't figure it out. How does one invoke some Vue CLI plugin from another Vue CLI plugin? An example in docs would be very helpful. |
Just as a normal node dependency. If you need some logic from |
@radek-altof I ended up adding instructions to my readme asking the user to invoke the plugin in question. I don't think this feature exists in the way we think it does. If I understand @pksunkara correctly, they're saying we can use any function from a dependent package, such as another plugin, which isn't what I need at all. I need to actually invoke another plugin and have the user go through the prompts etc for that plugin before my plugin runs. Afaik this can't be done, but @pksunkara please let me know if I'm wrong and post an example of usage. |
You are right. But you can load the prompts easily and add them to your invocation. This is what I mean by using the other plugin as a normal dependency. Everything that you need can easily be loaded by you to be given to vue-cli. |
@redskyburning Yes, spot on, exactly my case. I added a check to my generator file and if the plugin is missing, I cancel the installation and ask the user to install that plugin first. @pksunkara Thanks, I get what you mean now. Personally, I don't consider it to be a feasible solution. You need to understand the internal mechanisms of that dependency and call everything accordingly. But I digress, it's an option. |
What problem does this feature solve?
Some plugins might want to depend on other plugins. Currently, there is no way to do this.
What does the proposed API look like?
If the
package.json
dependencies
ofvue-cli-plugin-a
containsvue-cli-plugin-b
, then:vue add a
will runvue add b
and thenvue add a
vue invoke a
will runvue invoke b
and thenvue invoke a
(Optionally configured bya
)We can do this multiple deep levels.
Issues
a
depends onb
andc
, what's the order ofb
andc
to be run?The text was updated successfully, but these errors were encountered: