Shopify / themekit

Shopify theme development command line tool.
https://shopify.dev/tools/theme-kit
MIT License
1.19k stars 374 forks source link

Not deleting files on theme deploy by default #916

Open tommypepsi opened 3 years ago

tommypepsi commented 3 years ago

Is your feature request related to a problem? Please describe. Doing a "theme deploy" will delete files that are not in the local environment by default. This seems more dangerous to me than keeping them. For example, a store with a color swatch feature, if the client uploads their image for their color swatch in the assets folder then we do a "theme deploy", the client would loose their swatches.

Describe the solution you'd like I think it would make more sense if by default the files wouldn't be deleted and instead of having a "--nodelete" option, there should be a "--delete" option to do the same.

tanema commented 3 years ago

The idea is that theme deploy fully syncs what you have on your local machine with the remote theme. If it is a concern that something is constantly changed in the remote theme then use --nodelete.

tommypepsi commented 3 years ago

I still think it's quite dangerous as a default. It's easy to forget to add --nodelete and loose files that the store owner or apps could have added to the theme. While I feel like keeping the files wouldn't change anything for anyone. Having a --delete option would just help to do an extra cleanup.

hpawe01 commented 3 years ago

If you add images to the ignore_files part of your config.yml (like - /\.(png|ttf|jpg|svg)$/), no images should be deleted on theme deploy. And if you don't add this, then those images would be downloaded on theme download.

I would recommend to run theme download before running theme deploy everytime anyways to avoid also overwriting other changes done by a client (e.g. in the settings_data.json) - something where --nodelete won't help you. This works of course only if you use something like Git and committed your changes (or at least added them to the index). Otherwise you would overwrite your changes.

jhealey5 commented 3 years ago

I second this. It should be the other way round, -d to delete. There's not really any downsides to it being this way.

Take json templates - say the client adds 6 of them. New/forgetful developer does a small unrelated fix and theme deploys. Those templates are now gone and there's no getting them back.

What is the downside to no-delete by default and flagging for deletion? Other than "the idea is syncing".

tommypepsi commented 3 years ago

@jhealey5 Sadly I think shopify is abandoning this project in favor of shopify CLI. I don't think we'll see new updates to themekit.

jhealey5 commented 3 years ago

Fantastic. CLI is also Fantastic. Shopifantastic as always.