Files
plainleaf/server/version.go
T
Zef HemelandGitHub a524c64884 Go backend (#1555)
* Replaces old Deno server with a Go implementation
* Restructured the code base accordingly
2025-09-19 13:23:20 +02:00

25 lines
449 B
Go

package server
import (
"fmt"
"regexp"
"strings"
)
func ParseVersionFromTypeScript(code string) (string, error) {
// Parse the version using regex
re := regexp.MustCompile(`"([^"]+)"`)
matches := re.FindStringSubmatch(code)
if len(matches) < 2 {
return "", fmt.Errorf("version not found in file")
}
version := strings.TrimSpace(matches[1])
if version == "" {
return "", fmt.Errorf("empty version found")
}
return version, nil
}