add semver and semverCompare
Closed this issue · 1 comments
As part of my usage of task, I do compare versions pretty often to determine which task gets execute. I will like to update my taskfiles to v3 to take advantage of the new features but currently stuck of v2 based on reliance on semverCompare. I am hoping I can make a case to get the semver lib included in slim-sprig
Use case:
tasks:
fork-task:
cmds:
- task: |
:{{- if semverCompare "3.2 - 3.4" (replace "master" "999" .PRODUCT_VERSION) -}}
do-something
{{- else -}}
do-nothing
{{- end -}}
Or is there an alternative way to do version comparison as part of templating?
Hi @radTuti, and thanks for opening this issue!
I created this fork because the upstream package imports too many libraries, which makes the binary size way bigger than it needs to be. (A few of them were from the stdlib, but related to cryptography and were very big as well).
At the some time, a lot of these functions were kinda useless on most scenarios (who would want to encrypt stuff inside a template engine?).
In short, I'm not willing to re-add any dependencies of this library, to keep it "slim" as the name suggests. I hope you understand, and perhaps you could move this complexity to somewhere else where it'd make more sense.