Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add skip-proto flag to s chain command #4019

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features

- [#4019](https://github.com/ignite/cli/pull/4019) Add `skip-proto` flag to `s chain` command
- [#3977](https://github.com/ignite/cli/pull/3977) Add `chain lint` command to lint the chain's codebase using `golangci-lint`
- [#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
Expand Down
3 changes: 3 additions & 0 deletions ignite/cmd/scaffold_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
c.Flags().StringSlice(flagParams, []string{}, "add default module parameters")
c.Flags().StringSlice(flagModuleConfigs, []string{}, "add module configs")
c.Flags().Bool(flagSkipGit, false, "skip Git repository initialization")
c.Flags().Bool(flagSkipProto, false, "skip proto generation")

Check warning on line 87 in ignite/cmd/scaffold_chain.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/scaffold_chain.go#L87

Added line #L87 was not covered by tests
c.Flags().Bool(flagMinimal, false, "create a minimal blockchain (with the minimum required Cosmos SDK modules)")
c.Flags().Bool(flagIsConsumer, false, "scafffold an ICS consumer chain")
// Cannot have both minimal and consumer flag
Expand All @@ -106,6 +107,7 @@
isConsumer, _ = cmd.Flags().GetBool(flagIsConsumer)
params, _ = cmd.Flags().GetStringSlice(flagParams)
moduleConfigs, _ = cmd.Flags().GetStringSlice(flagModuleConfigs)
skipProto, _ = cmd.Flags().GetBool(flagSkipProto)

Check warning on line 110 in ignite/cmd/scaffold_chain.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/scaffold_chain.go#L110

Added line #L110 was not covered by tests
)

if noDefaultModule {
Expand All @@ -130,6 +132,7 @@
addressPrefix,
noDefaultModule,
skipGit,
skipProto,

Check warning on line 135 in ignite/cmd/scaffold_chain.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/scaffold_chain.go#L135

Added line #L135 was not covered by tests
minimal,
isConsumer,
params,
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
return sm, err
}

return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath)
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath, false)

Check warning on line 76 in ignite/services/scaffolder/configs.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/configs.go#L76

Added line #L76 was not covered by tests
}

// checkConfigCreated checks if the config has been already created.
Expand Down
5 changes: 2 additions & 3 deletions ignite/services/scaffolder/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
cacheStorage cache.Storage,
tracer *placeholder.Tracer,
root, name, addressPrefix string,
noDefaultModule, skipGit, minimal, isConsumerChain bool,
noDefaultModule, skipGit, skipProto, minimal, isConsumerChain bool,
params, moduleConfigs []string,
) (path string, err error) {
pathInfo, err := gomodulepath.Parse(name)
Expand Down Expand Up @@ -61,8 +61,7 @@
return "", err
}

err = finish(ctx, cacheStorage, path, pathInfo.RawPath)
if err != nil {
if err = finish(ctx, cacheStorage, path, pathInfo.RawPath, skipProto); err != nil {

Check warning on line 64 in ignite/services/scaffolder/init.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/init.go#L64

Added line #L64 was not covered by tests
return "", err
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
if err != nil {
return sm, err
}
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath)
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath, false)

Check warning on line 161 in ignite/services/scaffolder/message.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/message.go#L161

Added line #L161 was not covered by tests
}

// checkForbiddenMessageField returns true if the name is forbidden as a message name.
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
return sm, runErr
}

return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath)
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath, false)

Check warning on line 260 in ignite/services/scaffolder/module.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/module.go#L260

Added line #L260 was not covered by tests
}

// moduleExists checks if the module exists in the app.
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
if err != nil {
return sm, err
}
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath)
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath, false)

Check warning on line 146 in ignite/services/scaffolder/packet.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/packet.go#L146

Added line #L146 was not covered by tests
}

// isIBCModule returns true if the provided module implements the IBC module interface
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
return sm, err
}

return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath)
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath, false)

Check warning on line 75 in ignite/services/scaffolder/params.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/params.go#L75

Added line #L75 was not covered by tests
}

// checkParamCreated checks if the parameter has been already created.
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@
if err != nil {
return sm, err
}
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath)
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath, false)

Check warning on line 90 in ignite/services/scaffolder/query.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/query.go#L90

Added line #L90 was not covered by tests
}
9 changes: 5 additions & 4 deletions ignite/services/scaffolder/scaffolder.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@
return s, nil
}

func finish(ctx context.Context, cacheStorage cache.Storage, path, gomodPath string) error {
err := protoc(ctx, cacheStorage, path, gomodPath)
if err != nil {
return err
func finish(ctx context.Context, cacheStorage cache.Storage, path, gomodPath string, skipProto bool) error {
if !skipProto {
if err := protoc(ctx, cacheStorage, path, gomodPath); err != nil {
return err
}

Check warning on line 70 in ignite/services/scaffolder/scaffolder.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/scaffolder.go#L66-L70

Added lines #L66 - L70 were not covered by tests
}

if err := gocmd.Fmt(ctx, path); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
return sm, err
}

return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath)
return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath, false)

Check warning on line 222 in ignite/services/scaffolder/type.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/type.go#L222

Added line #L222 was not covered by tests
}

// checkForbiddenTypeIndex returns true if the name is forbidden as a index name.
Expand Down
1 change: 1 addition & 0 deletions ignite/templates/app/files/app/ibc.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"cosmossdk.io/core/appmodule"
storetypes "cosmossdk.io/store/types"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
Expand Down
Loading