-
-
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
Make the current command's name available to plugins #2692
Comments
PS: I know I could create a file .env.cordova-build-android with NODE_ENV=production, however I prefer, if my plugin can solve this, without having to create additional files during generator.js... What do you think, if the constructor of Service is refactored, to something like : constructor (context, commandName, { plugins, pkg, inlineOptions, useBuiltIn } = {}) {
this.commandName = commandName
...
} and then in vue-cli-service.js const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd(), command) |
You can call That way you have all the info you need... |
Thanks, this was also solving my problem. I thought, chainWebpack i.e needed to be registered before the command is executed, so I didn't try this. You can close the issue, if you want, or if you still find this feature useful in other scenarios, you can keep it open... |
I'll still keep it open as I think it really might be useful somewhere. |
So this doesn't gain any traction by uers it seems, and I didn't come across a real usecase myself, so I'll close it. |
What problem does this feature solve?
I'm currently developing a vue cli 3 plugin, to add cordova, to a vue project. For the serve and build, I created new commands in my generator.js
And in my index new defaultModes for theses commands:
The problem is now, if I ran
vue-cli-service cordova-build-android
, my process.env.NODE_ENV is development, because of loadEnv.Setting my defaultModes to :
would correctly set the mode, however, in my plugin, during
and
I no longer know, which mode (android, ios, browser), I'm using then.
My Plugin is available under https://github.com/m0dch3n/vue-cli-plugin-cordova to better understand, what I'm talking here about.
What does the proposed API look like?
It would be great, to have:
api.service.commandName = 'cordova-build-android'
i.e. if I ran
vue-cli-service cordova-build-android
The text was updated successfully, but these errors were encountered: