If you want to add a plugin after you have done some work, some plugins may change files of the project. I just lost my whole day's work. I believe a lot of people ran into this kind of disaster. PLEASE show some alert if the current project is not empty.
Prompt some BIG alert when adding plugins.
We have this BIG warning in our docs:
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.
And I don't think users will apprechiate a BIG warning in their console everytime they add plugin, don't you think?
I just lost my whole day's work
I'm not trying to be a smartass, but don't you use version control or something?
@LinusBorg Yes. I have seen that warning before. And it's my carelessness that led myself to this. But I'm wondering is it safe to give third-party plugins permission to modify user's local files, especially their codes? If we can detect that the project has been modified a lot and give the user an alert (maybe a small one), we can save many lives? After all running vue add might be dangerous.
Maybe we should detect if we are in a git repository which will be the case most of the time since vue cli creates one by default, and then automatically commit everything before invoking the plugin?
Good idea. Alternatively we could bail if we detect any uncommitted changes, ask the user to commit their work and run the command again.
That way we don't force a commit on anyone that they might not want (or that could fail if they have commitizen or something similar checking commit message format.
And for projects without git ( an edge case) we could always display a warning and ask for confirmation.
Unassigned myself as I don't have the capacity to work on this right now.
saved by a previous build...
If someone run into this... how to call it..., well, check if you have a fresh /dist folder
just serve the dist folder and open it on browser
if you ran the build script and you had sourcemap on, then you'll find your code in the browser (source tab)
Implemented in #4275
Released as v4.0.0-alpha.5
Most helpful comment
Good idea. Alternatively we could bail if we detect any uncommitted changes, ask the user to commit their work and run the command again.
That way we don't force a commit on anyone that they might not want (or that could fail if they have commitizen or something similar checking commit message format.
And for projects without git ( an edge case) we could always display a warning and ask for confirmation.