Skip to content

Commit 17d84d6

Browse files
committed
feat: provide more metadata
1 parent d3db8e9 commit 17d84d6

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

main.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ type PackageDetailsResponse struct {
2727
}
2828

2929
type ShopwareExtension struct {
30-
Store map[string]interface{} `yaml:"store"` // Use interface{} to maintain flexibility
31-
Build map[string]interface{} `yaml:"build"`
30+
Store map[string]interface{} `yaml:"store" json:"store"` // Use interface{} to maintain flexibility
31+
Build map[string]interface{} `yaml:"build" json:"build"`
32+
}
33+
34+
type ShopwareExtensionMetadata struct {
35+
RepositoryUrl string `json:"repositoryUrl"`
36+
Extension *ShopwareExtension `json:"shopware-extension"`
37+
Ref string `json:"ref"`
3238
}
3339

3440
func main() {
@@ -46,7 +52,7 @@ func main() {
4652
log.Fatalf("Failed to decode package list: %v", err)
4753
}
4854

49-
packageData := make(map[string]*ShopwareExtension)
55+
packageData := make(map[string]*ShopwareExtensionMetadata)
5056
// Iterate through each package to get the repository URL
5157
for _, packageName := range packageList.PackageNames {
5258
detailsURL := fmt.Sprintf("https://packagist.org/packages/%s.json", packageName)
@@ -68,7 +74,11 @@ func main() {
6874
if strings.Contains(version.Source.URL, "github.com") {
6975
extension := checkShopwareExtensionFile(version.Source.URL)
7076
if extension != nil {
71-
packageData[packageName] = extension
77+
packageData[packageName] = &ShopwareExtensionMetadata{
78+
RepositoryUrl: version.Source.URL,
79+
Extension: extension,
80+
Ref: detailsURL,
81+
}
7282
}
7383
}
7484
break // Assuming you want one repository URL per package

0 commit comments

Comments
 (0)