Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions v2/internal/binding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ func (b *Bindings) GenerateModels() ([]byte, error) {
// if we have enums for this package, add them as well
var enums, enumsExist = b.enumsToGenerateTS[packageName]
if enumsExist {
for enumName, enum := range enums {
// Sort the enum names first to make the output deterministic
sortedEnumNames := make([]string, 0, len(enums))
for enumName := range enums {
sortedEnumNames = append(sortedEnumNames, enumName)
}
sort.Strings(sortedEnumNames)

for _, enumName := range sortedEnumNames {
enum := enums[enumName]
fqemumname := packageName + "." + enumName
if seen.Contains(fqemumname) {
continue
Expand Down Expand Up @@ -172,7 +180,7 @@ func (b *Bindings) GenerateModels() ([]byte, error) {
}

// Sort the package names first to make the output deterministic
sortedPackageNames := make([]string, 0)
sortedPackageNames := make([]string, 0, len(models))
for packageName := range models {
sortedPackageNames = append(sortedPackageNames, packageName)
}
Expand Down
8 changes: 5 additions & 3 deletions v2/internal/typescriptify/typescriptify.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package typescriptify

import (
"bufio"
"cmp"
"fmt"
"io"
"log"
"os"
"path"
"reflect"
"regexp"
"slices"
"strings"
"time"

Expand Down Expand Up @@ -372,6 +374,9 @@ func (t *TypeScriptify) AddEnum(values interface{}) *TypeScriptify {

elements = append(elements, el)
}
slices.SortFunc(elements, func(a, b enumElement) int {
return cmp.Compare(a.name, b.name)
})
ty := reflect.TypeOf(elements[0].value)
t.enums[ty] = elements
t.enumTypes = append(t.enumTypes, EnumType{Type: ty})
Expand Down Expand Up @@ -516,9 +521,6 @@ func (t TypeScriptify) ConvertToFile(fileName string, packageName string) error
if _, err := f.WriteString(converted); err != nil {
return err
}
if err != nil {
return err
}

return nil
}
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed C compilation error in onWayland on Linux due to declaration after label [#4446](https://github.com/wailsapp/wails/pull/4446) by [@jaesung9507](https://github.com/jaesung9507)
- Use computed style when adding 'wails-drop-target-active' [PR](https://github.com/wailsapp/wails/pull/4420) by [@riannucci](https://github.com/riannucci)
- Fixed panic when adding menuroles on Linux [#4558](https://github.com/wailsapp/wails/pull/4558) by [@jaesung9507](https://github.com/jaesung9507)
- Fixed generated enums ordering [#4664](https://github.com/wailsapp/wails/pull/4664) by [@rprtr258](https://github.com/rprtr258).
- Fixed Discord badge in README by @sharkmu in [PR](https://github.com/wailsapp/wails/pull/4626)

## v2.10.2 - 2025-07-06
Expand Down