From bb222a291f64f53ce43e6bf26f993bd34002c96a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 23:17:25 +0100 Subject: [PATCH] chore(services): use `AppName` instead `ModuleName` for scaffold a new App (backport #4010) (#4040) * chore(services): use `AppName` instead `ModuleName` for scaffold a new App (#4010) * use AppName instead ModuleName for scaffold a new App * add changelog * fix the quote for the scaffold chain for integration tests --------- Co-authored-by: Pantani Co-authored-by: Julien Robert Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 276b515304c64372604bfeb7d44d1fe13bfc9592) * fix changelog --------- Co-authored-by: Danilo Pantani Co-authored-by: Julien Robert --- changelog.md | 1 + ignite/services/plugin/scaffold.go | 8 ++++---- ignite/services/plugin/template/go.mod.plush | 2 +- .../plugin/template/integration/app_test.go.plush | 2 +- ignite/services/plugin/template/main.go.plush | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 7c83438795..28aeb83c0c 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,7 @@ - [#4035](https://github.com/ignite/cli/pull/4035) Bump `cometbft` to `v0.38.6` and `ibc-go/v8` to `v8.1.1` - [#4031](https://github.com/ignite/cli/pull/4031) Bump `cli-plugin-network` to `v0.2.2` due to dependencies issue. - [#4013](https://github.com/ignite/cli/pull/4013) Bump `cosmos-sdk` to `v0.50.5` +- [#4010](https://github.com/ignite/cli/pull/4010) Use `AppName` instead `ModuleName` for scaffold a new App - [#3972](https://github.com/ignite/cli/pull/3972) Skip Ignite app loading for some base commands that don't allow apps - [#3983](https://github.com/ignite/cli/pull/3983) Bump `cosmos-sdk` to `v0.50.4` and `ibc-go` to `v8.1.0` diff --git a/ignite/services/plugin/scaffold.go b/ignite/services/plugin/scaffold.go index e3500d0597..775272bdc5 100644 --- a/ignite/services/plugin/scaffold.go +++ b/ignite/services/plugin/scaffold.go @@ -21,10 +21,10 @@ import ( //go:embed template/* var fsPluginSource embed.FS -// Scaffold generates a plugin structure under dir/path.Base(moduleName). -func Scaffold(ctx context.Context, dir, moduleName string, sharedHost bool) (string, error) { +// Scaffold generates a plugin structure under dir/path.Base(appName). +func Scaffold(ctx context.Context, dir, appName string, sharedHost bool) (string, error) { var ( - name = filepath.Base(moduleName) + name = filepath.Base(appName) title = toTitle(name) finalDir = path.Join(dir, name) g = genny.New() @@ -45,7 +45,7 @@ func Scaffold(ctx context.Context, dir, moduleName string, sharedHost bool) (str } pctx := plush.NewContextWithContext(ctx) - pctx.Set("ModuleName", moduleName) + pctx.Set("AppName", appName) pctx.Set("Name", name) pctx.Set("Title", title) pctx.Set("SharedHost", sharedHost) diff --git a/ignite/services/plugin/template/go.mod.plush b/ignite/services/plugin/template/go.mod.plush index 1353d40335..ef9b9e03f8 100644 --- a/ignite/services/plugin/template/go.mod.plush +++ b/ignite/services/plugin/template/go.mod.plush @@ -1,4 +1,4 @@ -module <%= ModuleName %> +module <%= AppName %> go 1.21 diff --git a/ignite/services/plugin/template/integration/app_test.go.plush b/ignite/services/plugin/template/integration/app_test.go.plush index e6630c2810..1088a9d4cb 100644 --- a/ignite/services/plugin/template/integration/app_test.go.plush +++ b/ignite/services/plugin/template/integration/app_test.go.plush @@ -18,7 +18,7 @@ func Test<%= Title %>(t *testing.T) { var ( require = require.New(t) env = envtest.New(t) - app = env.Scaffold("github.com/test/test") + app = env.Scaffold("<%= AppName %>-app") ) dir, err := os.Getwd() diff --git a/ignite/services/plugin/template/main.go.plush b/ignite/services/plugin/template/main.go.plush index 1224628072..4d64420d58 100644 --- a/ignite/services/plugin/template/main.go.plush +++ b/ignite/services/plugin/template/main.go.plush @@ -7,7 +7,7 @@ import ( hplugin "github.com/hashicorp/go-plugin" "github.com/ignite/cli/v28/ignite/services/plugin" - "<%= ModuleName %>/cmd" + "<%= AppName %>/cmd" ) type app struct{}