Skip to content

Commit

Permalink
Merge branch 'main' into julien/v29
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Mar 11, 2024
2 parents beb2306 + d1b8943 commit 5d4b748
Show file tree
Hide file tree
Showing 39 changed files with 169 additions and 297 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ build:
snapcraft:
@sed -i 's/{{version}}/'$(version)'/' packaging/snap/snapcraft.yaml

## prepare flatpak manifest for release
flatpak:
@sed -i 's/{{version}}/'$(version)'/' packaging/flatpak/com.ignite.Ignite.yml

## mocks: generate mocks
mocks:
@echo Generating mocks
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [#3770](https://github.com/ignite/cli/pull/3770) Add `scaffold configs` and `scaffold params` commands
- [#3985](https://github.com/ignite/cli/pull/3985) Make some `cmd` pkg functions public
- [#3967](https://github.com/ignite/cli/issues/3967) Add HD wallet parameters `address index` and `account number` to the chain account config
- [#4004](https://github.com/ignite/cli/pull/4004) Remove all import placeholders using the `xast` pkg

### Changes

Expand All @@ -18,6 +19,7 @@
- [#3976](https://github.com/ignite/cli/pull/3976) Remove error checks for Cobra command value get calls
- [#3983](https://github.com/ignite/cli/pull/3983) Bump `cosmos-sdk` to `v0.50.4` and `ibc-go` to `v8.1.0`
- [#4002](https://github.com/ignite/cli/pull/4002) Bump buf build
- [#4008](https://github.com/ignite/cli/pull/4008) Rename `pkg/yaml` to `pkg/xyaml`

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/base/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/imdario/mergo"

"github.com/ignite/cli/v29/ignite/config/chain/version"
xyaml "github.com/ignite/cli/v29/ignite/pkg/yaml"
"github.com/ignite/cli/v29/ignite/pkg/xyaml"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/v1/validator.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v1

import (
xyaml "github.com/ignite/cli/v29/ignite/pkg/yaml"
"github.com/ignite/cli/v29/ignite/pkg/xyaml"
)

// Validator holds info related to validator settings.
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/v1/validator_servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"

v1 "github.com/ignite/cli/v29/ignite/config/chain/v1"
xyaml "github.com/ignite/cli/v29/ignite/pkg/yaml"
"github.com/ignite/cli/v29/ignite/pkg/xyaml"
)

func TestValidatorGetServers(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ import (
marsmodulev1 "github.com/ignite/mars/api/mars/mars/module"
_ "github.com/ignite/mars/x/mars" // import for side-effects
marsmoduletypes "github.com/ignite/mars/x/mars/types"
// this line is used by starport scaffolding # stargate/app/moduleImport
)

var (
Expand Down
1 change: 0 additions & 1 deletion ignite/pkg/cosmosanalysis/app/testdata/modules/spn/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ import (
"github.com/tendermint/spn/x/reward"
rewardkeeper "github.com/tendermint/spn/x/reward/keeper"
rewardtypes "github.com/tendermint/spn/x/reward/types"
// this line is used by starport scaffolding # stargate/app/moduleImport
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ import (
marsmodulev1 "github.com/tendermint/mars/api/mars/mars/module"
_ "github.com/tendermint/mars/x/mars" // import for side-effects
marsmoduletypes "github.com/tendermint/mars/x/mars/types"
// this line is used by starport scaffolding # stargate/app/moduleImport
)

var (
Expand Down
35 changes: 34 additions & 1 deletion ignite/pkg/xast/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,50 @@ type (
}
)

// WithLastImport add a new import int the end.
func WithLastImport(repo string) ImportOptions {
return func(c *importOpts) {
c.imports = append(c.imports, imp{
repo: repo,
name: "",
index: -1,
})
}
}

// WithImport add a new import. If the index is -1 will append in the end of the imports.
func WithImport(repo, name string, index int) ImportOptions {
func WithImport(repo string, index int) ImportOptions {
return func(c *importOpts) {
c.imports = append(c.imports, imp{
repo: repo,
name: "",
index: index,
})
}
}

// WithNamedImport add a new import with name. If the index is -1 will append in the end of the imports.
func WithNamedImport(name, repo string, index int) ImportOptions {
return func(c *importOpts) {
c.imports = append(c.imports, imp{
name: name,
repo: repo,
index: index,
})
}
}

// WithLastNamedImport add a new import with name in the end of the imports.
func WithLastNamedImport(name, repo string) ImportOptions {
return func(c *importOpts) {
c.imports = append(c.imports, imp{
name: name,
repo: repo,
index: -1,
})
}
}

func newImportOptions() importOpts {
return importOpts{
imports: make([]imp, 0),
Expand Down
38 changes: 19 additions & 19 deletions ignite/pkg/xast/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
args: args{
fileContent: existingContent,
imports: []ImportOptions{
WithImport("strings", "", -1),
WithImport("strings", -1),
},
},
want: `package main
Expand All @@ -54,9 +54,9 @@ func main() {
args: args{
fileContent: existingContent,
imports: []ImportOptions{
WithImport("strings", "st", -1),
WithImport("strconv", "", -1),
WithImport("os", "", -1),
WithNamedImport("st", "strings", -1),
WithImport("strconv", -1),
WithLastImport("os"),
},
},
want: `package main
Expand All @@ -78,10 +78,10 @@ func main() {
args: args{
fileContent: existingContent,
imports: []ImportOptions{
WithImport("strings", "st", -1),
WithImport("strconv", "", -1),
WithImport("os", "", -1),
WithImport("fmt", "", -1),
WithNamedImport("st", "strings", -1),
WithImport("strconv", -1),
WithImport("os", -1),
WithLastImport("fmt"),
},
},
want: `package main
Expand Down Expand Up @@ -109,7 +109,7 @@ import (
st "strings"
)`,
imports: []ImportOptions{
WithImport("strconv", "", 1),
WithImport("strconv", 1),
},
},
want: `package main
Expand All @@ -133,9 +133,9 @@ import (
st "strings"
)`,
imports: []ImportOptions{
WithImport("strconv", "", 0),
WithImport("testing", "", 3),
WithImport("bytes", "", -1),
WithImport("strconv", 0),
WithNamedImport("", "testing", 3),
WithLastImport("bytes"),
},
},
want: `package main
Expand All @@ -155,7 +155,7 @@ import (
args: args{
fileContent: existingContent,
imports: []ImportOptions{
WithImport("fmt", "", -1),
WithLastImport("fmt"),
},
},
want: existingContent + "\n",
Expand All @@ -169,7 +169,7 @@ func main() {
fmt.Println("Hello, world!")
}`,
imports: []ImportOptions{
WithImport("fmt", "", -1),
WithImport("fmt", -1),
},
},
want: `package main
Expand All @@ -190,8 +190,8 @@ func main() {
fmt.Println("Hello, world!")
}`,
imports: []ImportOptions{
WithImport("fmt", "", -1),
WithImport("os", "", -1),
WithImport("fmt", -1),
WithLastImport("os"),
},
},
want: `package main
Expand All @@ -211,7 +211,7 @@ func main() {
args: args{
fileContent: existingContent,
imports: []ImportOptions{
WithImport("strings", "", 10),
WithImport("strings", 10),
},
},
err: errors.New("index out of range"),
Expand All @@ -221,7 +221,7 @@ func main() {
args: args{
fileContent: existingContent,
imports: []ImportOptions{
WithImport("fmt\"", "fmt\"", -1),
WithNamedImport("fmt\"", "fmt\"", -1),
},
},
err: errors.New("format.Node internal error (5:8: expected ';', found fmt (and 2 more errors))"),
Expand All @@ -231,7 +231,7 @@ func main() {
args: args{
fileContent: "",
imports: []ImportOptions{
WithImport("fmt", "", -1),
WithImport("fmt", -1),
},
},
err: errors.New("1:1: expected 'package', found 'EOF'"),
Expand Down
2 changes: 1 addition & 1 deletion ignite/pkg/yaml/map.go → ignite/pkg/xyaml/map.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yaml
package xyaml

// Map defines a map type that uses strings as key value.
// The map implements the Unmarshaller interface to convert
Expand Down
4 changes: 2 additions & 2 deletions ignite/pkg/yaml/map_test.go → ignite/pkg/xyaml/map_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package yaml_test
package xyaml_test

import (
"testing"

"github.com/stretchr/testify/require"
"gopkg.in/yaml.v2"

xyaml "github.com/ignite/cli/v29/ignite/pkg/yaml"
"github.com/ignite/cli/v29/ignite/pkg/xyaml"
)

func TestUnmarshalWithCustomMapType(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion ignite/pkg/yaml/yaml.go → ignite/pkg/xyaml/yaml.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yaml
package xyaml

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yaml
package xyaml

import (
"context"
Expand Down
4 changes: 1 addition & 3 deletions ignite/templates/app/files-minimal/app/app.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import (
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

// this line is used by starport scaffolding # stargate/app/moduleImport

"<%= ModulePath %>/docs"
)

Expand Down Expand Up @@ -181,7 +179,7 @@ func New(
&app.StakingKeeper,
&app.DistrKeeper,
&app.ConsensusParamsKeeper,
// this line is used by starport scaffolding # stargate/app/keeperDefinition

); err != nil {
panic(err)
}
Expand Down
2 changes: 0 additions & 2 deletions ignite/templates/app/files-minimal/app/app_config.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

// this line is used by starport scaffolding # stargate/app/moduleImport
)

var (
Expand Down
4 changes: 1 addition & 3 deletions ignite/templates/app/files/app/app.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ import (
ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"

// this line is used by starport scaffolding # stargate/app/moduleImport

"<%= ModulePath %>/docs"
)

Expand Down Expand Up @@ -278,7 +276,7 @@ func New(
&app.NFTKeeper,
&app.GroupKeeper,
&app.CircuitBreakerKeeper,
// this line is used by starport scaffolding # stargate/app/keeperDefinition

); err != nil {
panic(err)
}
Expand Down
2 changes: 0 additions & 2 deletions ignite/templates/app/files/app/app_config.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
"google.golang.org/protobuf/types/known/durationpb"

// this line is used by starport scaffolding # stargate/app/moduleImport
)

var (
Expand Down
2 changes: 0 additions & 2 deletions ignite/templates/app/files/app/ibc.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"

// this line is used by starport scaffolding # ibc/app/import
)

// registerIBCModules register IBC keepers and non dependency inject modules.
Expand Down
12 changes: 1 addition & 11 deletions ignite/templates/ibc/placeholders.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@ package ibc

//nolint:godot
const (
Placeholder = "// this line is used by starport scaffolding # 1"
Placeholder2 = "// this line is used by starport scaffolding # 2"
Placeholder3 = "// this line is used by starport scaffolding # 3"
Placeholder = "// this line is used by starport scaffolding # 1"

// Placeholders IBC packets
PlaceholderIBCPacketEvent = "// this line is used by starport scaffolding # ibc/packet/event"
PlaceholderIBCPacketModuleRecv = "// this line is used by starport scaffolding # ibc/packet/module/recv"
PlaceholderIBCPacketModuleAck = "// this line is used by starport scaffolding # ibc/packet/module/ack"
PlaceholderIBCPacketModuleTimeout = "// this line is used by starport scaffolding # ibc/packet/module/timeout"

// Placeholders for messages
PlaceholderProtoTxRPC = "// this line is used by starport scaffolding # proto/tx/rpc"
PlaceholderProtoTxMessage = "// this line is used by starport scaffolding # proto/tx/message"

// Placeholders AutoCLI
PlaceholderAutoCLIQuery = "// this line is used by ignite scaffolding # autocli/query"
PlaceholderAutoCLITx = "// this line is used by ignite scaffolding # autocli/tx"
)
1 change: 0 additions & 1 deletion ignite/templates/message/placeholders.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ package message

const (
Placeholder = "// this line is used by starport scaffolding # 1"
Placeholder2 = "// this line is used by starport scaffolding # 2"
Placeholder3 = "// this line is used by starport scaffolding # 3"
)
Loading

0 comments on commit 5d4b748

Please sign in to comment.