Open Worthaboutapig opened 6 years ago
Currently, vue remove X
would do nothing else than npm uninstall X
. There's no "cleanup" API so far. Might be a good idea.
Could this be documented, given that an explicit add
command implies there's stuff going on that an npm uninstall X
might not deal with?
Plugins can add and modify your project files. It's already quite difficult especially if you change the whole project structure. I don't think it's worth the trouble to have something similar that deletes and modifies files back to the previous state. There is 99% chances that the files would have been modified in the mean time. Also, you have git to check what the plugin changed and we recommend using it everywhere (including in the UI).
@Akryum If plugins are install-only, that doesn't seem a good idea long-term. One would only ever have more and more plugins and if one decided, for-instance, that a new kind of plugin handled a situation better than an existing one, or covered more cases, one would have two plugins competing with each other. Sounds like the project would easily become borked.
Aren't plugins meant to be self-contained and when adding and removing files, isn't that limited to files they know about?
They aren't install-only: you can uninstall them using yarn or npm and clean up the files they added/modified (for example with git). My point is there isn't an automatic way of doing this, we don't have an IA to do that (yet?).
Extending what @Akryum said:
Aren't plugins meant to be self-contained and when adding and removing files, isn't that limited to files they know about?
While a good design principle, that's hardly possible.
So unless we re-invent a git-like system to track changes introduced by a plugin, removing files it created without breaking your app is hardly possible.
They aren't install-only: you can uninstall them using yarn or npm and clean up the files they added/modified (for example with git). My point is there isn't an automatic way of doing this, we don't have an IA to do that (yet?).
Ok.
I think it would be nice to add vue remove x
to give the plugin the ability to do some clean up. Even if the default is just running npm uninstall x
. I think if you have an add, users expect the remove.
Also as an example I set up my project with mocha and want to move to jest, it would be nice if removing mocha would also remove it's injected task. Also I could even be asked if I want the created files to be removed. I can see what the plugin has done by reading https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-unit-mocha/generator/index.js
. Having old configs / files hanging around from removed plugins might lead to problems. At the very least you could warn the user (when running vue remove x
) "this might not remove all configuration changes made by the plugin it is recommended to use git to roll back plugin changes"
The other thing could be a vue add --dry-run
which outputs what the plugin is going to do, which would help in the removal / clean up.
P.S. @Akryum keep up the great work and nice talk at vuejs.london!
One thing I noticed is that webpack config changes made by plugins get left behind when the package is uninstalled, which means if the same configuration item is reused it may appear to not be working, as vue inspect
will show that there are two versions of the same key- the one left behind by a plugin and a new one created, unbeknownst to a new configurator.
webpack config changes made by plugins get left behind when the package is uninstalled
I can't really imagine how that would happen, since the changes to the webpack config are made on the fly from the plugin 's index.js file - which would be gone once the plugin is uninstalled.
Ok, I'll have to investigate that further and see how it's happening.
Recently I did something dumb. I just added vuetify to my little personal signup project following the quick start directions. I probably should not have clicked something in the cli, because, Ughh it was a mess with a bunch of errors. Once i saw existing templates changed, and webpack with no undo I realized the gravity of what just happened. Best to rollback and redo. I thought a plugin was an addon or extension. This experience has rattled me on plugins. So yes ,imo it would be nice to be able to pull out a plugin and limit its powers if you have to.
this is what i saw. :
`Successfully invoked generator for plugin: vue-cli-plugin-vuetify The following files have been updated / added:
.amplifyrc
amplify/#current-cloud-backend/amplify-meta.json
amplify/#current-cloud-backend/analytics/lambdatest/parameters.json
amplify/#current-cloud-backend/analytics/lambdatest/pinpoint-cloudformation-template.json
amplify/#current-cloud-backend/auth/cognito1/cognito95306251-cloudformation-template.yml
amplify/#current-cloud-backend/auth/cognito1/parameters.json
amplify/#current-cloud-backend/hosting/S3AndCloudFront/template.json
amplify/.config/aws-info.json
amplify/.config/project-config.json
amplify/backend/amplify-meta.json
amplify/backend/analytics/lambdatest/parameters.json
amplify/backend/analytics/lambdatest/pinpoint-cloudformation-template.json
amplify/backend/auth/cognito95306251/cognito95306251-cloudformation-template.yml
amplify/backend/auth/cognito95306251/parameters.json
amplify/backend/awscloudformation/nested-cloudformation-stack.yml
amplify/backend/hosting/S3AndCloudFront/template.json
src/aws-exports.js
src/components/Login.vue
src/components/Signup.vue
src/plugins/vuetify.js
src/routes/index.js
babel.config.js
package-lock.json
package.json
src/App.vue
src/assets/logo.png
src/components/HelloWorld.vue
src/main.js`
Well there's a big warning in the docs, looking like this:
WARNING
It is recommended to commit your project's current state before running vue add, since the command will invoke the plugin's file generator and potentially make changes to your existing files.
Hmm yeah , this needs a big ol catch all disclaimer ... it does not sound safe. I thought it would just expose some components/ new functionality but literally changed every file and even broke it . To call that a plug-in imo is misleading. I would expect “deep project manipulations” like this to be a more associated with cli.
I think this is like the migration in the database, you can roll back your operations. Similarly, a plugin should define an up
operation and a down
operation for the vue add
and remove
commands, respectively.
Yes in some cases plugins seem to be doing what should be called "Project Migration". To me that should not be lumped in with a plugin. thats a different tool . they should have all they need in their package and exposing some settings/or globals?
Why is this an issue when a framework like Ember has a simple ember uninstall add-on --save-dev
and this works with no issues?
@Rup1
Why is this an issue when a framework like Ember has a simple
ember uninstall add-on --save-dev
and this works with no issues?
ember-cli
has not a command named uninstall
, it has a deprecated command named uninstall:npm
.
And it's obviously that uninstall:npm
just removes the npm package directly. Actually it would suggest you to call npm uninstall
now. https://github.com/ember-cli/ember-cli/blob/master/lib/commands/uninstall-npm.js
@jkzing Apologies I stand corrected! Haven't played with ember in a while.
Nevertheless, the same logic that justifies having a vue add plugin
command should equally justify having a vue remove plugin
command IMHO. Why not just remove Vue add
then?
@Rup1 On the contrary, from what ember-cli
did (deprecating uninstall
command), we can learn that it is not necessary to provide an uninstall
command which just simply do npm uninstall
.
Suggestion: Perhaps plugins can choose to provide an uninstall URL with help text on how to fully uninstall them. Then, running vue remove plugin
could run npm uninstall plugin
followed by a message to the effect of:
The node package has been removed. Please visit (URL here) for instructions on completing the uninstallation.
FWIW, the term plugin strongly suggests ease of adding (plugging) and removal (un-plugging). In fact, outside of JS frameworks, I can't think of any plugin architecture where that isn't the case.
Thus, I think it's a reasonable expectation that plugins be un-pluggable.
I agree with this. I certainly didn't expect that the plugin would update so many of my files on a small project. Around 30 at my last count. That feels pretty intrusive for a "plugin".
I found the solution:
vue ui
Dependencies
I found the solution:
- run from terminal vue ui
- go to Dependencies
- Enjoy! https://share.getcloudapp.com/GGu0wPBN
Alas, this does not let you remove a plugin, only a dependency.
I found the solution:
- run from terminal vue ui
- go to Dependencies
- Enjoy! https://share.getcloudapp.com/GGu0wPBN
Alas, this does not let you remove a plugin, only a dependency.
Thumb up!
What problem does this feature solve?
There does not appear to be any way to remove a plugin in
vue ui
. The list of plugins on the dashboard don't have a trash icon next to them, as the dependencies list do have. There's no information on whether it's even possible to remove a plugin.Can't find anything in the existing issues, and this StackOverflow post doesn't have a solution beyond 'hack about and uninstall it manually'. (https://stackoverflow.com/questions/50155541/remove-plugins-with-vue-cli3)
If there is a way, it doesn't appear to be documented, if there isn't, there should be.
What does the proposed API look like?
A
vue remove <plugin>
command with a corresponding trash can icon in the plugins list.