Skip to content

Commit

Permalink
chore(services): use AppName instead ModuleName for scaffold a ne…
Browse files Browse the repository at this point in the history
…w 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 <Pantani>
Co-authored-by: Julien Robert <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 276b515)

* fix changelog

---------

Co-authored-by: Danilo Pantani <[email protected]>
Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
3 people authored Mar 19, 2024
1 parent f74491a commit bb222a2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
8 changes: 4 additions & 4 deletions ignite/services/plugin/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/plugin/template/go.mod.plush
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module <%= ModuleName %>
module <%= AppName %>

go 1.21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/plugin/template/main.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit bb222a2

Please sign in to comment.