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

Ask permission before deleting mode-specific files. #4748

Closed
nothingismagick opened this issue Jul 27, 2019 · 11 comments

Comments

@nothingismagick
Copy link
Member

commented Jul 27, 2019

Is your feature request related to a problem? Please describe.
When removing a mode with e.g. quasar mode remove electron all of the files in that folder are destroyed and this is irrecoverable.

Describe the solution you'd like
I want to be asked first if I really want this to happen, and would prefer to keep any files that I have personally modified.

Describe alternatives you've considered
An alternative - but really just a workaround and actually treating the symptom not the problem, would be to have a setting during install that enables git integration and automatically adds SOME files that quasar creates with git add (except of course things in the .gitignore context).

Additional context
This accidentally happened to me the other night while developing on core. It was late and I had a command in my bash history quasar mode remove proton && quasar mode add proton and without really thinking about its repurcussions I purged all of my work. In discussion with @webnoob we thought that this would be something to look into.

@nothingismagick

This comment has been minimized.

Copy link
Member Author

commented Jul 27, 2019

Note for @rstoenescu - this is a tracking issue and once we've discussed an approach I will look into making the appropriate modifications asking permission (like how AE re-install process works).

@nothingismagick

This comment has been minimized.

Copy link
Member Author

commented Jul 27, 2019

I think deleting stuff should be opt-in - as should tampering with quasar.conf.js
Quasar does not always notify devs what is going on - and that can be confusing.

Especially if you think about someone who is used to current behaviour and then we start tampering with their quasar.conf.js and they don't notice and then they add the mode back and its back to defaults and they're like WTF.

This is one of the things that I am especially conscious of - retaining current behavior wherever possible and making new behavior either clear with a new flag:

quasar mode remove proton --keep-files
quasar mode add proton --enable-tampering

or dev interaction:

$ quasar mode add proton
> Proton Object not found in quasar.conf.js. Create? Y / n

I am not saying we have to do one or the other at the expense of another option, just suggesting an approach that does not break the contract with the current users

@webnoob

This comment has been minimized.

Copy link
Member

commented Jul 27, 2019

Another issue which is semi related to this is when we're adding a mode quasar mode add electron it copies the files over from the template folder but at that point we have no way of updating those files if there is a bug as it will only the files if they don't exist.

BEX handles this by always copying files on each dev and instructing the users never to edit them. They in turn have hooks the user can use to add bits in where required.

This might be a discussion for another topic though but thought it worth mentioning in case we do this all in one.

@lucasfernog

This comment has been minimized.

Copy link
Member

commented Jul 28, 2019

@webnoob that's why code on the src-{mode} folder are meant to be only the minimum necessary code to run the application, and every config related to Quasar must be done outside it e.g. @quasar/app (a good example of it is the SSR mode, its template just extends q-app functionality).

@rstoenescu

This comment has been minimized.

Copy link
Member

commented Aug 10, 2019

User will be prompted before actually removing the mode.
Prompt will be auto-skipped if "--yes"/"-y" param is specified.

Target: quasar/app 1.0.5.

@rstoenescu rstoenescu closed this Aug 10, 2019

@webnoob

This comment has been minimized.

Copy link
Member

commented Aug 10, 2019

@lucasfernog Not sure how that answers the issue I raised:

but at that point we have no way of updating those files if there is a bug as it will only the files if they don't exist.

If we need to add something to one of those src files to support a new feature / fix a bug, we can't as the files are written once and only once.

p.s Sorry for the late reply, I didn't get notified of your response - only Razvan's close.

@nothingismagick

This comment has been minimized.

Copy link
Member Author

commented Aug 10, 2019

@lucasfernog

This comment has been minimized.

Copy link
Member

commented Aug 10, 2019

@webnoob our code in src-mode should only call our functions on q-app or similar side of things, so no bug should be there.

@lucasfernog

This comment has been minimized.

Copy link
Member

commented Aug 10, 2019

@nothingismagick removing the mode IS removing the files, that doesn't make sense if I understood it correctly.

@nothingismagick

This comment has been minimized.

Copy link
Member Author

commented Aug 10, 2019

@webnoob

This comment has been minimized.

Copy link
Member

commented Aug 10, 2019

So my example would be this file: https://github.com/quasarframework/quasar/blob/dev/app/templates/electron/main-process/electron-main.js

It's common (as I understand it) to need to add code to this file for an electron app. I know I had to for the small test app I made for Icon Genie. Whilst I agree it should be bug free, we can't guarantee that and we can't guarantee we won't need to add anything in the future.

I've solved this with BEXs by always overwriting the core (needed to run files) on dev / build but providing "hook" files which the user can edit (that have access to the context) but don't get overwritten.

See the call for attachActivatedBackgroundHooks as an example here: https://github.com/webnoob/quasar/blob/mode-browser-extension/app/templates/bex/js/core/background/background.js

For me, this offers the best of both worlds as it keeps our Quasar code separate from user code and always gives us an update path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.