Open chientrm opened 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.
We could default these to
true
. Let's try to get the naming right...delete
does not seem descriptive enough. MaybeallowDelete
? 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
--exclude-upload **/*.*
will be equivalent to allowUpload: false
--exclude-replace **/*.*
will be equivalent to allowReplace: false
--exclude-delete **/*.*
will be equivalent to allowDelete: false
I don't know how glob pattern works exactly but that's the best I can think of.
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
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!
So you will update on FTP-Deploy-Action, too?
When this option will be available, it' still open ?
Any updates on this really useful feature? Seems it's still not merged.
New argument:
preserve
boolean
false
true