diff --git a/_registry/README.md b/_registry/README.md index 56d7937..0290a79 100644 --- a/_registry/README.md +++ b/_registry/README.md @@ -15,56 +15,8 @@ To add your app to the Ignite App Registry, follow these steps: ## `app.json` File Structure** -Below is the template for the `username.repository.app_name.json` file. Replace each placeholder with the specific details of your app. - -```json -{ - "appName": "Your App Name", - "appDescription": "A brief description of what your app does.", - "ignite": ">28.3.0", - "dependencies": { - "docker": ">23.0.5" - }, - "cosmosSDK": ">0.50.4", - "features": [ - "Feature 1", - "Feature 2", - "Additional features..." - ], - "wasm": false, - "authors": [ - { - "name": "Author Name", - "email": "email@example.com", - "website": "Optional author or company website" - } - ], - "repository": { - "url": "URL to the app's repository" - }, - "documentationUrl": "URL to the app's documentation", - "license": { - "name": "MIT", - "url": "github.com/username/app/LICENSE.md" - }, - "keywords": ["keyword1", "keyword2", "Useful for search and categorization"], - "supportedPlatforms": ["mac", "linux"], - "socialMedia": { - "x": "Optional X handle", - "telegram": "Optional Telegram group", - "discord": "Optional Discord server", - "reddit": "Optional Reddit page", - "website": "" - }, - "donations": { - "cryptoAddresses": { - "cosmos": "cosmos1...", - "otherSupportedCryptos": "address" - }, - "fiatDonationLinks": "URL to Patreon, Ko-fi, etc." - } -} -``` +The expected template of the `username.repository.app_name.json` file can be found [here](./registry.json). +Replace each placeholder with the specific details of your app. ## Best Practices diff --git a/_registry/ignite.apps.explorer.json b/_registry/ignite.apps.explorer.json index 3e33018..c20963d 100644 --- a/_registry/ignite.apps.explorer.json +++ b/_registry/ignite.apps.explorer.json @@ -6,11 +6,6 @@ "docker": ">23.0.5" }, "cosmosSDK": ">0.50.4", - "features": [ - "CLI Explorer", - "Gex" - ], - "wasm": false, "authors": [ { "name": "Jeronimo Albi", @@ -19,13 +14,11 @@ "github": "jeronimoalbi" } ], - "repository": { - "url": "https://github.com/ignite/apps/tree/main/explorer" - }, + "repositoryUrl": "https://github.com/ignite/apps/explorer", "documentationUrl": "https://github.com/cosmos/gex", "license": { "name": "MIT", - "url": "github.com/username/app/LICENSE.md" + "url": "https://github.com/ignite/apps/blob/main/LICENSE" }, "keywords": [ "explorer", @@ -36,19 +29,5 @@ "supportedPlatforms": [ "mac", "linux" - ], - "socialMedia": { - "x": "", - "telegram": "", - "discord": "", - "reddit": "", - "website": "" - }, - "donations": { - "cryptoAddresses": { - "cosmos": "", - "otherSupportedCryptos": "" - }, - "fiatDonationLinks": "" - } + ] } \ No newline at end of file diff --git a/_registry/ignite.apps.hermes.json b/_registry/ignite.apps.hermes.json index 9e8c17d..1dacf8a 100644 --- a/_registry/ignite.apps.hermes.json +++ b/_registry/ignite.apps.hermes.json @@ -4,10 +4,6 @@ "ignite": ">0.27.0", "dependencies": {}, "cosmosSDK": ">0.50.1", - "features": [ - "IBC relayer" - ], - "wasm": false, "authors": [ { "name": "Danilo Pantani", @@ -16,13 +12,11 @@ "github": "pantani" } ], - "repository": { - "url": "https://github.com/ignite/apps/tree/main/hermes" - }, + "repositoryUrl": "https://github.com/ignite/apps/hermes", "documentationUrl": "https://github.com/ignite/apps/tree/main/hermes/README.md", "license": { "name": "MIT", - "url": "github.com/ignite/apps/blob/main/LICENSE" + "url": "https://github.com/ignite/apps/blob/main/LICENSE" }, "keywords": [ "relayer", @@ -33,19 +27,5 @@ "supportedPlatforms": [ "mac", "linux" - ], - "socialMedia": { - "x": "", - "telegram": "", - "discord": "", - "reddit": "", - "website": "" - }, - "donations": { - "cryptoAddresses": { - "cosmos": "", - "otherSupportedCryptos": "" - }, - "fiatDonationLinks": "" - } + ] } \ No newline at end of file diff --git a/_registry/ignite.apps.marketplace.json b/_registry/ignite.apps.marketplace.json index 36b04f2..48bb44a 100644 --- a/_registry/ignite.apps.marketplace.json +++ b/_registry/ignite.apps.marketplace.json @@ -4,12 +4,6 @@ "ignite": ">28.0.0", "dependencies": {}, "cosmosSDK": ">0.50.1", - "features": [ - "App Registry", - "App Discovery", - "App Explorer" - ], - "wasm": false, "authors": [ { "name": "Ehsan Saradar", @@ -18,13 +12,11 @@ "github": "Ehsan-saradar" } ], - "repository": { - "url": "https://github.com/ignite/apps/tree/main/marketplace" - }, + "repositoryUrl": "https://github.com/ignite/apps/marketplace", "documentationUrl": "", "license": { "name": "MIT", - "url": "github.com/ignite/apps/blob/main/LICENSE" + "url": "https://github.com/ignite/apps/blob/main/LICENSE" }, "keywords": [ "marketplace", @@ -36,19 +28,5 @@ "supportedPlatforms": [ "mac", "linux" - ], - "socialMedia": { - "x": "", - "telegram": "", - "discord": "", - "reddit": "", - "website": "" - }, - "donations": { - "cryptoAddresses": { - "cosmos": "", - "otherSupportedCryptos": "" - }, - "fiatDonationLinks": "" - } + ] } \ No newline at end of file diff --git a/_registry/ignite.apps.rollkit.json b/_registry/ignite.apps.rollkit.json index 62f3163..a644b2d 100644 --- a/_registry/ignite.apps.rollkit.json +++ b/_registry/ignite.apps.rollkit.json @@ -4,11 +4,6 @@ "ignite": ">28.4.0", "dependencies": {}, "cosmosSDK": ">0.50.6", - "features": [ - "Scaffolder", - "Rollkit" - ], - "wasm": false, "authors": [ { "name": "Julien Robert", @@ -17,15 +12,14 @@ "github": "julienrbrt" } ], - "repository": { - "url": "https://github.com/ignite/apps/tree/main/rollkit" - }, + "repositoryUrl": "https://github.com/ignite/apps/rollkit", "documentationUrl": "https://github.com/ignite/apps/tree/main/rollkit/README.md", "license": { "name": "MIT", - "url": "github.com/ignite/apps/blob/main/LICENSE" + "url": "https://github.com/ignite/apps/blob/main/LICENSE" }, "keywords": [ + "scaffolder", "rollup", "rollkit", "cli", @@ -35,19 +29,5 @@ "supportedPlatforms": [ "mac", "linux" - ], - "socialMedia": { - "x": "", - "telegram": "", - "discord": "", - "reddit": "", - "website": "" - }, - "donations": { - "cryptoAddresses": { - "cosmos": "", - "otherSupportedCryptos": "" - }, - "fiatDonationLinks": "" - } + ] } \ No newline at end of file diff --git a/_registry/ignite.apps.wasm.json b/_registry/ignite.apps.wasm.json index 3c25a96..1970930 100644 --- a/_registry/ignite.apps.wasm.json +++ b/_registry/ignite.apps.wasm.json @@ -4,11 +4,6 @@ "ignite": ">28.3.0", "dependencies": {}, "cosmosSDK": ">0.50.4", - "features": [ - "Scaffolder", - "CosmWasm" - ], - "wasm": false, "authors": [ { "name": "Danilo Pantani", @@ -17,15 +12,14 @@ "github": "pantani" } ], - "repository": { - "url": "https://github.com/ignite/apps/tree/main/wasm" - }, - "documentationUrl": "https://github.com/cosmos/gex", + "repositoryUrl": "https://github.com/ignite/apps/wasm", + "documentationUrl": "https://github.com/ignite/apps/blob/main/wasm/README.md", "license": { "name": "MIT", - "url": "github.com/ignite/apps/blob/main/LICENSE" + "url": "https://github.com/ignite/apps/blob/main/LICENSE" }, "keywords": [ + "scaffolder", "wasm", "cli", "cosmos-sdk", @@ -34,19 +28,5 @@ "supportedPlatforms": [ "mac", "linux" - ], - "socialMedia": { - "x": "", - "telegram": "", - "discord": "", - "reddit": "", - "website": "" - }, - "donations": { - "cryptoAddresses": { - "cosmos": "", - "otherSupportedCryptos": "" - }, - "fiatDonationLinks": "" - } + ] } \ No newline at end of file diff --git a/_registry/registry.json b/_registry/registry.json index 9298933..8bdeb91 100644 --- a/_registry/registry.json +++ b/_registry/registry.json @@ -1,46 +1,45 @@ { - "appName": "Your App Name", - "appDescription": "A brief description of what your app does.", - "ignite": ">28.3.0", - "dependencies": { - "docker": ">23.0.5" - }, - "cosmosSDK": ">0.50.4", - "features": [ - "Feature 1", - "Feature 2", - "Additional features..." - ], - "wasm": false, - "authors": [ - { - "name": "Author Name", - "email": "email@example.com", - "website": "Optional author or company website" - } - ], - "repository": { - "url": "URL to the app's repository" - }, - "documentationUrl": "URL to the app's documentation", - "license": { - "name": "MIT", - "url": "github.com/username/app/LICENSE.md" - }, - "keywords": ["keyword1", "keyword2", "Useful for search and categorization"], - "supportedPlatforms": ["mac", "linux"], - "socialMedia": { - "x": "Optional X handle", - "telegram": "Optional Telegram group", - "discord": "Optional Discord server", - "reddit": "Optional Reddit page", - "website": "" - }, - "donations": { - "cryptoAddresses": { - "cosmos": "cosmos1...", - "otherSupportedCryptos": "address" - }, - "fiatDonationLinks": "URL to Patreon, Ko-fi, etc." + "appName": "Your App Name", + "appDescription": "A brief description of what your app does.", + "ignite": ">28.3.0", + "dependencies": { + "docker": ">23.0.5" + }, + "cosmosSDK": ">0.50.4", + "authors": [ + { + "name": "Author Name", + "email": "email@example.com", + "website": "Optional author or company website" } -} + ], + "repositoryUrl": "URL to the app's repository", + "documentationUrl": "URL to the app's documentation", + "license": { + "name": "MIT", + "url": "github.com/username/app/LICENSE.md" + }, + "keywords": [ + "keyword1", + "keyword2", + "Useful for search and categorization" + ], + "supportedPlatforms": [ + "mac", + "linux" + ], + "socialMedia": { + "x": "Optional X handle", + "telegram": "Optional Telegram group", + "discord": "Optional Discord server", + "reddit": "Optional Reddit page", + "website": "" + }, + "donations": { + "cryptoAddresses": { + "cosmos": "cosmos1...", + "otherSupportedCryptos": "address" + }, + "fiatDonationLinks": "URL to Patreon, Ko-fi, etc." + } +} \ No newline at end of file diff --git a/marketplace/cmd/info.go b/marketplace/cmd/details.go similarity index 69% rename from marketplace/cmd/info.go rename to marketplace/cmd/details.go index 20cb66e..2d2008e 100644 --- a/marketplace/cmd/info.go +++ b/marketplace/cmd/details.go @@ -5,7 +5,6 @@ import ( "hash/fnv" "io" "os" - "path" "strconv" "strings" "text/tabwriter" @@ -31,12 +30,13 @@ var ( Bold(true) ) -// NewInfo creates a new info command that shows the details of an ignite application repository. -func NewInfo() *cobra.Command { +// NewDetailsCmd creates a new details command that shows the details of an ignite application repository. +func NewDetailsCmd() *cobra.Command { return &cobra.Command{ - Use: "info [package-url]", - Short: "Show the details of an ignite application repository", - Args: cobra.ExactArgs(1), + Use: "details [name]", + Aliases: []string{"info"}, + Short: "Show the details of an ignite application repository", + Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { githubToken, _ := cmd.Flags().GetString(githubTokenFlag) @@ -44,7 +44,9 @@ func NewInfo() *cobra.Command { defer session.End() client := xgithub.NewClient(githubToken) - repo, err := registry.GetRepositoryDetails(cmd.Context(), client, args[0]) + registryQuerier := registry.NewRegistryQuerier(client) + + repo, err := registryQuerier.GetAppDetails(cmd.Context(), args[0]) if err != nil { return err } @@ -83,23 +85,21 @@ func printAppsTable(repo *registry.AppRepositoryDetails) { fmt.Fprintf(w, "\t%s:\t%v\n", s, v) } - for _, app := range repo.Apps { - w := &tabwriter.Writer{} - w.Init(os.Stdout, 16, 8, 0, '\t', 0) + w := &tabwriter.Writer{} + w.Init(os.Stdout, 16, 8, 0, '\t', 0) - printItem(w, "Name", app.Name) - printItem(w, "Description", app.Description) - printItem(w, "Path", app.Path) - printItem(w, "Go Version", app.GoVersion) - printItem(w, "Ignite Version", app.IgniteVersion) + printItem(w, "Name", repo.App.Name) + printItem(w, "Description", repo.App.Description) + printItem(w, "Path", repo.App.Path) + printItem(w, "Go Version", repo.App.GoVersion) + printItem(w, "Ignite Version", repo.App.IgniteVersion) - fmt.Fprintln(w, installaitonStyle.Render(fmt.Sprintf( - "🚀 Install via: %s", - commandStyle.Render(fmt.Sprintf("ignite app -g install %s", path.Join(repo.PackageURL, app.Path))), - ))) + fmt.Fprintln(w, installaitonStyle.Render(fmt.Sprintf( + "🚀 Install via: %s", + commandStyle.Render(fmt.Sprintf("ignite app -g install %s", repo.PackageURL)), + ))) - w.Flush() - } + w.Flush() } func colorFromText(text string) lipgloss.Color { diff --git a/marketplace/cmd/install.go b/marketplace/cmd/install.go new file mode 100644 index 0000000..ecdfdf2 --- /dev/null +++ b/marketplace/cmd/install.go @@ -0,0 +1,17 @@ +package cmd + +import "github.com/spf13/cobra" + +func NewInstallCmd() *cobra.Command { + c := &cobra.Command{ + Use: "install [name]", + Short: "Install an ignite app by registry name", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + + return nil + }, + } + + return c +} diff --git a/marketplace/cmd/list.go b/marketplace/cmd/list.go index 79e9a2f..930851d 100644 --- a/marketplace/cmd/list.go +++ b/marketplace/cmd/list.go @@ -14,8 +14,8 @@ import ( const descriptionLimit = 75 -// NewList creates a new list command that searches all the ignite apps in GitHub. -func NewList() *cobra.Command { +// NewListCmd creates a new list command that lists all the ignite apps from the app registry. +func NewListCmd() *cobra.Command { c := &cobra.Command{ Use: "list", Short: "List all the ignite apps", @@ -23,7 +23,7 @@ func NewList() *cobra.Command { RunE: func(cmd *cobra.Command, _ []string) error { var githubToken, _ = cmd.Flags().GetString(githubTokenFlag) - session := cliui.New(cliui.StartSpinnerWithText("🔎 Searching for ignite apps on GitHub...")) + session := cliui.New(cliui.StartSpinnerWithText("🔎 Searching for ignite apps on app registry...")) defer session.End() client := xgithub.NewClient(githubToken) @@ -49,24 +49,21 @@ func NewList() *cobra.Command { func formatAppsTree(entries []registry.AppEntry) string { b := &strings.Builder{} - for i, entry := range entries { + for _, entry := range entries { node := tree.NewNode(fmt.Sprintf( - "%d. %-20s", - i+1, + "%s : %s", entry.Name, - )) - node.AddChild(tree.NewNode(fmt.Sprintf( - "📖 %s", limitTextLength(entry.Description, descriptionLimit), - ))) + )) node.AddChild(tree.NewNode(fmt.Sprintf( "📦 %s", - entry.Repository.URL, + entry.RepositoryURL, ))) - fmt.Fprintln(b, node) + fmt.Fprint(b, node) } - return strings.TrimSuffix(b.String(), "\n") + + return b.String() } func limitTextLength(text string, limit int) string { diff --git a/marketplace/cmd/marketplace.go b/marketplace/cmd/marketplace.go index 1de3c25..9cd5c5f 100644 --- a/marketplace/cmd/marketplace.go +++ b/marketplace/cmd/marketplace.go @@ -27,8 +27,9 @@ so it's recommended to use the --github-token flag you want to use marketplace c } c.AddCommand( - NewList(), - NewInfo(), + NewListCmd(), + NewDetailsCmd(), + NewInstallCmd(), ) c.PersistentFlags().String(githubTokenFlag, "", "GitHub access token") diff --git a/marketplace/registry/details.go b/marketplace/registry/details.go index 1af68d1..66f8084 100644 --- a/marketplace/registry/details.go +++ b/marketplace/registry/details.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "path" + "regexp" "strings" "time" @@ -12,14 +13,14 @@ import ( "github.com/ignite/cli/v28/ignite/pkg/errors" "github.com/ignite/cli/v28/ignite/services/plugin" "golang.org/x/mod/modfile" - - "github.com/ignite/apps/marketplace/pkg/xgithub" ) const ( appYMLFileName = "app.ignite.yml" ) +var githubRepoPattern = regexp.MustCompile(`^github\.com\/([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_]+)(\/[a-zA-Z0-9\-_]+)*$`) + // AppRepositoryDetails represents the details of an Ignite app repository. type AppRepositoryDetails struct { PackageURL string @@ -31,7 +32,7 @@ type AppRepositoryDetails struct { License string UpdatedAt time.Time URL string - Apps []AppDetails + App AppDetails } // AppDetails represents the details of an Ignite app. @@ -43,67 +44,77 @@ type AppDetails struct { IgniteVersion string } -// GetRepositoryDetails returns the details of an Ignite app repository. -func GetRepositoryDetails(ctx context.Context, client *xgithub.Client, pkgURL string) (*AppRepositoryDetails, error) { - repoOwner, repoName, err := validatePackageURL(pkgURL) +// GetAppDetails returns the details of an Ignite app repository. +func (r Querier) GetAppDetails(ctx context.Context, appName string) (*AppRepositoryDetails, error) { + apps, err := r.List(ctx) + if err != nil { + return nil, err + } + + var appEntry AppEntry + for _, app := range apps { + if app.Name == appName { + appEntry = app + } + } + + if appEntry.Name == "" { + return nil, errors.Errorf("app %s not found", appName) + } + + repoOwner, repoName, err := validatePackageURL(appEntry.RepositoryURL) if err != nil { return nil, errors.Wrap(err, "invalid package URL") } - repo, err := client.GetRepository(ctx, repoOwner, repoName) + repo, err := r.client.GetRepository(ctx, repoOwner, repoName) if err != nil { return nil, err } - appYML, err := getAppsConfig(ctx, client, repo) + appYML, err := r.getAppsConfig(ctx, repo) if err != nil { return nil, err } - result := &AppRepositoryDetails{ - PackageURL: pkgURL, - Name: repo.GetName(), - Owner: repo.GetOwner().GetLogin(), - Description: repo.GetDescription(), - Tags: repo.Topics, - Stars: repo.GetStargazersCount(), - License: repo.GetLicense().GetName(), - UpdatedAt: repo.GetUpdatedAt().Time, - URL: repo.GetHTMLURL(), - Apps: make([]AppDetails, 0, len(appYML.Apps)), - } + var appDetails AppDetails for name, info := range appYML.Apps { - goMod, err := getGoMod(ctx, client, repo, path.Clean(info.Path)) + if name != appName { + continue + } + + goMod, err := r.getGoMod(ctx, repo, path.Clean(info.Path)) if err != nil { return nil, errors.Wrapf(err, "failed to get go.mod for app %s", name) } - result.Apps = append(result.Apps, AppDetails{ + appDetails = AppDetails{ Name: name, Description: info.Description, Path: info.Path, GoVersion: goMod.Go.Version, IgniteVersion: findCLIVersion(goMod), - }) + } } - return result, nil -} - -func validatePackageURL(pkgURL string) (owner, name string, err error) { - parts := strings.Split(pkgURL, "/") - if len(parts) != 3 { - return "", "", errors.Errorf("package URL must be in github.com/{owner}/{repo} format") - } - if parts[0] != "github.com" { - return "", "", errors.Errorf("only GitHub packages are supported") + result := &AppRepositoryDetails{ + PackageURL: appEntry.RepositoryURL, + Name: repo.GetName(), + Owner: repo.GetOwner().GetLogin(), + Description: repo.GetDescription(), + Tags: repo.Topics, + Stars: repo.GetStargazersCount(), + License: repo.GetLicense().GetName(), + UpdatedAt: repo.GetUpdatedAt().Time, + URL: repo.GetHTMLURL(), + App: appDetails, } - return parts[1], parts[2], nil + return result, nil } -func getGoMod(ctx context.Context, client *xgithub.Client, repo *github.Repository, fpath string) (*modfile.File, error) { - contents, err := client.GetFileContent(ctx, repo.GetOwner().GetLogin(), repo.GetName(), path.Join(fpath, "go.mod")) +func (r Querier) getGoMod(ctx context.Context, repo *github.Repository, fpath string) (*modfile.File, error) { + contents, err := r.client.GetFileContent(ctx, repo.GetOwner().GetLogin(), repo.GetName(), path.Join(fpath, "go.mod")) if err != nil { return nil, errors.Wrap(err, "failed to get file content") } @@ -116,18 +127,8 @@ func getGoMod(ctx context.Context, client *xgithub.Client, repo *github.Reposito return mod, nil } -func findCLIVersion(modFile *modfile.File) string { - for _, require := range modFile.Require { - if strings.HasPrefix(require.Mod.Path, igniteCLIPackage) { - return require.Mod.Version - } - } - - return "" -} - -func getAppsConfig(ctx context.Context, client *xgithub.Client, repo *github.Repository) (*plugin.AppsConfig, error) { - data, err := client.GetFileContent(ctx, repo.GetOwner().GetLogin(), repo.GetName(), appYMLFileName) +func (r Querier) getAppsConfig(ctx context.Context, repo *github.Repository) (*plugin.AppsConfig, error) { + data, err := r.client.GetFileContent(ctx, repo.GetOwner().GetLogin(), repo.GetName(), appYMLFileName) if err != nil { return nil, errors.Wrapf(err, "failed to get %s file content", appYMLFileName) } @@ -138,3 +139,22 @@ func getAppsConfig(ctx context.Context, client *xgithub.Client, repo *github.Rep } return &conf, nil } + +func validatePackageURL(pkgURL string) (owner, name string, err error) { + parts := githubRepoPattern.FindStringSubmatch(pkgURL) + if len(parts) != 2 { + return "", "", errors.Errorf("invalid package URL: %s", pkgURL) + } + + return parts[1], parts[2], nil +} + +func findCLIVersion(modFile *modfile.File) string { + for _, require := range modFile.Require { + if strings.HasPrefix(require.Mod.Path, igniteCLIPackage) { + return require.Mod.Version + } + } + + return "" +} diff --git a/marketplace/registry/list.go b/marketplace/registry/list.go index 9c0244f..296c10a 100644 --- a/marketplace/registry/list.go +++ b/marketplace/registry/list.go @@ -3,6 +3,9 @@ package registry import ( "context" "encoding/json" + "fmt" + "io" + "net/http" "regexp" "strings" @@ -41,7 +44,7 @@ func (r *Querier) List(ctx context.Context) ([]AppEntry, error) { continue } - entry, err := r.getRegistryEntry(ctx, file) + entry, err := r.getRegistryEntry(file) if err != nil { return nil, err } @@ -52,14 +55,21 @@ func (r *Querier) List(ctx context.Context) ([]AppEntry, error) { return entries, nil } -func (r *Querier) getRegistryEntry(ctx context.Context, fileName string) (*AppEntry, error) { - data, err := r.client.GetFileContent(ctx, igniteGitHubOrg, igniteAppsRepo, fileName) +func (r *Querier) getRegistryEntry(fileName string) (*AppEntry, error) { + // here we do not use `GetFileContent` to avoid hitting the github api rate limit + resp, err := http.Get(fmt.Sprintf("https://raw.githubusercontent.com/%s/%s/main/%s", igniteGitHubOrg, igniteAppsRepo, fileName)) if err != nil { return nil, errors.Wrapf(err, "failed to get %s file content", fileName) } + defer resp.Body.Close() + + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrapf(err, "failed to read %s file content", fileName) + } var entry *AppEntry - if err := json.Unmarshal(data, &entry); err != nil { + if err := json.Unmarshal(body, &entry); err != nil { return nil, errors.Wrapf(err, "failed to unmarshal %s file", fileName) } diff --git a/marketplace/registry/types.go b/marketplace/registry/types.go index c3ea48e..83ab72c 100644 --- a/marketplace/registry/types.go +++ b/marketplace/registry/types.go @@ -3,21 +3,17 @@ package registry type AppEntry struct { Name string `json:"appName,omitempty"` Description string `json:"appDescription,omitempty"` - IgniteVerion string `json:"ignite,omitempty"` + Ignite string `json:"ignite,omitempty"` Dependencies struct { Docker string `json:"docker,omitempty"` } `json:"dependencies,omitempty"` - CosmosSDKVersion string `json:"cosmosSDK,omitempty"` - Features []string `json:"features,omitempty"` - Wasm bool `json:"wasm,omitempty"` - Authors []struct { + CosmosSDK string `json:"cosmosSDK,omitempty"` + Authors []struct { Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` Website string `json:"website,omitempty"` } `json:"authors,omitempty"` - Repository struct { - URL string `json:"url,omitempty"` - } `json:"repository,omitempty"` + RepositoryURL string `json:"repositoryUrl,omitempty"` DocumentationURL string `json:"documentationUrl,omitempty"` License struct { Name string `json:"name,omitempty"`