SamKirkland / ftp-deploy

Deploy websites over FTP with one command line
MIT License
89 stars 43 forks source link

Add 'preserve' argument #20

Open chientrm opened 2 years ago

chientrm commented 2 years ago

New argument:

SamKirkland commented 2 years ago

Thanks for the PR Chien!

This is a popular request so thanks for putting together a PR.

I do believe having 3 arguments for this would be the most flexible approach. Here is my rational. This script has 3 main cycles. Uploading new files. Replacing files that have been updated/changed. And deleting old files.

Your specific usecase requires opting-out of the delete step... But what about the replace? Are you okay with that running? Will other use cases?

So I'm thinking 3 props. Basically allowing people to opt out of any given step to fit their specific usecase. delete upload replace

We could default these to true. Let's try to get the naming right... delete does not seem descriptive enough. Maybe allowDelete? What are your thoughts?

Also we should keep this logic with the hash diff implementation (I think). I'm on mobile right now so it's hard to say without looking at the codebase.

chientrm commented 2 years ago

We could default these to true. Let's try to get the naming right... delete does not seem descriptive enough. Maybe allowDelete? What are your thoughts?

Currently, the argument --exclude is working very well.

I guess --exclude-upload, --exclude-replace, and --exclude-delete would be what we're looking for.

The default value for them would be excludeDefaults which is same with --exclude

In this case

I don't know how glob pattern works exactly but that's the best I can think of.

SamKirkland commented 2 years ago

exclude is weird because now it's a double negative. Also those glob patterns are complex to understand so boolean is preferred. I'm thinking allowXXX is the best

As for implementation we can skip processing files based on the users settings in this file. I prefer skipping in getDiffs over mutating the results. https://github.com/SamKirkland/ftp-deploy/blob/f79bd104c89cbbf01c51e48cdd08efa522074e39/src/HashDiff.ts#L65

chientrm commented 2 years ago

exclude is weird because now it's a double negative. Also those glob patterns are complex to understand so boolean is preferred. I'm thinking allowXXX is the best

Yup exclude is kinda overcomplicated. My current use cases only require basic true/false activation.

As for implementation we can skip processing files based on the users settings in this file. I prefer skipping in getDiffs over mutating the results.

Working on it!

chientrm commented 2 years ago

So you will update on FTP-Deploy-Action, too?

chientrm commented 2 years ago

Hi @SamKirkland , Please checkout 085feeb

rpatni5 commented 10 months ago

When this option will be available, it' still open ?

miabid commented 1 month ago

Any updates on this really useful feature? Seems it's still not merged.