From 0f311a6eef7a0067d80f4ca6b9a878aaa39f48e0 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 26 Jun 2024 23:54:20 +0200 Subject: [PATCH] feat(templates): improve default home (#4210) * feat(templates): improve default home * changelog * changelog * dont create home flag everywhere --- changelog.md | 1 + ignite/templates/app/files-consumer/app/app.go.plush | 8 +++----- ignite/templates/app/files-minimal/app/app.go.plush | 8 +++----- ignite/templates/app/files/app/app.go.plush | 8 +++----- ignite/templates/app/files/go.mod.plush | 4 ++-- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/changelog.md b/changelog.md index 57fcf1007b..0e9c8162a7 100644 --- a/changelog.md +++ b/changelog.md @@ -45,6 +45,7 @@ - [#4162](https://github.com/ignite/cli/pull/4162) Enable errcheck linter - [#4194](https://github.com/ignite/cli/pull/4194) Bump client/v2 to `v2.0.0-beta.2` - [#4189](https://github.com/ignite/cli/pull/4189) Deprecate `ignite node` for `ignite connect` app +- [#4210](https://github.com/ignite/cli/pull/4210) Improve default home wiring ### Fixes diff --git a/ignite/templates/app/files-consumer/app/app.go.plush b/ignite/templates/app/files-consumer/app/app.go.plush index c9186b9f87..37dbdc0a66 100644 --- a/ignite/templates/app/files-consumer/app/app.go.plush +++ b/ignite/templates/app/files-consumer/app/app.go.plush @@ -2,10 +2,9 @@ package app import ( "io" - "os" - "path/filepath" "fmt" + clienthelpers "cosmossdk.io/client/v2/helpers" "cosmossdk.io/depinject" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -134,12 +133,11 @@ type App struct { } func init() { - userHomeDir, err := os.UserHomeDir() + var err error + DefaultNodeHome, err = clienthelpers.GetNodeHomeDirectory("."+Name) if err != nil { panic(err) } - - DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) } // AppConfig returns the default app config. diff --git a/ignite/templates/app/files-minimal/app/app.go.plush b/ignite/templates/app/files-minimal/app/app.go.plush index e5bf30d727..04575ece5d 100644 --- a/ignite/templates/app/files-minimal/app/app.go.plush +++ b/ignite/templates/app/files-minimal/app/app.go.plush @@ -2,9 +2,8 @@ package app import ( "io" - "os" - "path/filepath" + clienthelpers "cosmossdk.io/client/v2/helpers" "cosmossdk.io/depinject" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -79,12 +78,11 @@ type App struct { } func init() { - userHomeDir, err := os.UserHomeDir() + var err error + DefaultNodeHome, err = clienthelpers.GetNodeHomeDirectory("."+Name) if err != nil { panic(err) } - - DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) } // AppConfig returns the default app config. diff --git a/ignite/templates/app/files/app/app.go.plush b/ignite/templates/app/files/app/app.go.plush index cd0f61260f..6888571328 100644 --- a/ignite/templates/app/files/app/app.go.plush +++ b/ignite/templates/app/files/app/app.go.plush @@ -2,9 +2,8 @@ package app import ( "io" - "os" - "path/filepath" + clienthelpers "cosmossdk.io/client/v2/helpers" "cosmossdk.io/depinject" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -145,12 +144,11 @@ type App struct { } func init() { - userHomeDir, err := os.UserHomeDir() + var err error + DefaultNodeHome, err = clienthelpers.GetNodeHomeDirectory("."+Name) if err != nil { panic(err) } - - DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) } // getGovProposalHandlers return the chain proposal handlers. diff --git a/ignite/templates/app/files/go.mod.plush b/ignite/templates/app/files/go.mod.plush index 2553998207..49162c2e39 100644 --- a/ignite/templates/app/files/go.mod.plush +++ b/ignite/templates/app/files/go.mod.plush @@ -11,7 +11,7 @@ replace ( require ( cosmossdk.io/api v0.7.5 - cosmossdk.io/client/v2 v2.0.0-beta.2 + cosmossdk.io/client/v2 v2.0.0-beta.2.0.20240625200423-e4c342eb99f5 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.11.0 cosmossdk.io/depinject v1.0.0-alpha.4 @@ -23,7 +23,7 @@ require ( cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.1.0 cosmossdk.io/x/nft v0.1.0 - cosmossdk.io/x/upgrade v0.1.3 + cosmossdk.io/x/upgrade v0.1.4-0.20240625200423-e4c342eb99f5 <%= if (IsConsumerChain) { %> github.com/cosmos/interchain-security/v5 v5.0.0 <% } %>