Improve r13y of packwiz modrinth export by sorting manifestFiles (#287)

resolves #244
This commit is contained in:
James Groom 2024-04-21 11:46:33 +00:00 committed by GitHub
parent 5bb680f266
commit 9cca74476d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,7 @@ import (
"golang.org/x/exp/slices"
"net/url"
"os"
"sort"
"strconv"
"github.com/packwiz/packwiz/core"
@ -172,6 +173,10 @@ var exportCmd = &cobra.Command{
}
}
}
// sort by `path` property before serialising to ensure reproducibility
sort.Slice(manifestFiles, func(i, j int) bool {
return manifestFiles[i].Path < manifestFiles[j].Path
})
err = session.SaveIndex()
if err != nil {