Skip to content

Commit

Permalink
Merge branch 'main' into feat/plugin-system-improvements-versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
jeronimoalbi committed Nov 6, 2023
2 parents e55b4c9 + 897b1cc commit b4b128c
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 44 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
with:
PATTERNS: |
**/*.go
**/*.plush
go.mod
go.sum
**/testdata/**
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
with:
PATTERNS: |
**/*.go
**/*.plush
go.mod
go.sum
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
with:
PATTERNS: |
**/*.go
**/*.plush
go.mod
go.sum
**/testdata/**
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
- [#3631](https://github.com/ignite/cli/pull/3631) Fix unnecessary vue import in hooks/composables template
- [#3655](https://github.com/ignite/cli/pull/3655) Re-enable TS client generation
- [#3661](https://github.com/ignite/cli/pull/3661) Change `pkg/cosmosanalysis` to find Cosmos SDK runtime app registered modules
- [#3716](https://github.com/ignite/cli/pull/3716) Fix invalid plugin hook check
- [#3725](https://github.com/ignite/cli/pull/3725) Fix flaky TS client generation issues on linux
- [#3729](https://github.com/ignite/cli/pull/3729) Fix broken generator due to caching /tmp include folders

## [`v0.27.0`](https://github.com/ignite/cli/releases/tag/v0.27.0)

Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"autoprefixer": "^10.4.14",
"clsx": "^1.2.1",
"docusaurus-plugin-image-zoom": "^0.1.1",
"postcss": "^8.4.21",
"postcss": "^8.4.31",
"postcss-import": "^15.1.0",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
Expand Down
12 changes: 6 additions & 6 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5302,7 +5302,7 @@ mz@^2.7.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"

nanoid@^3.3.4:
nanoid@^3.3.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
Expand Down Expand Up @@ -6015,12 +6015,12 @@ postcss-zindex@^5.1.0:
resolved "https://registry.yarnpkg.com/postcss-zindex/-/postcss-zindex-5.1.0.tgz#4a5c7e5ff1050bd4c01d95b1847dfdcc58a496ff"
integrity sha512-fgFMf0OtVSBR1va1JNHYgMxYk73yhn/qb4uQDq1DLGYolz8gHCyr/sesEuGUaYs58E3ZJRcpoGuPVoB7Meiq9A==

postcss@^8.0.9, postcss@^8.3.11, postcss@^8.4.14, postcss@^8.4.17, postcss@^8.4.19, postcss@^8.4.21:
version "8.4.21"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.21.tgz#c639b719a57efc3187b13a1d765675485f4134f4"
integrity sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==
postcss@^8.0.9, postcss@^8.3.11, postcss@^8.4.14, postcss@^8.4.17, postcss@^8.4.19, postcss@^8.4.31:
version "8.4.31"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d"
integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==
dependencies:
nanoid "^3.3.4"
nanoid "^3.3.6"
picocolors "^1.0.0"
source-map-js "^1.0.2"

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ require (
golang.org/x/text v0.13.0
golang.org/x/tools v0.9.1
golang.org/x/vuln v0.1.0
google.golang.org/grpc v1.55.0
google.golang.org/grpc v1.56.3
google.golang.org/protobuf v1.30.0
gopkg.in/yaml.v2 v2.4.0
mvdan.cc/gofumpt v0.5.0
Expand Down Expand Up @@ -169,7 +169,7 @@ require (
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dlclark/regexp2 v1.2.0 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v24.0.1+incompatible // indirect
github.com/docker/docker v24.0.7+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand Down
20 changes: 12 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/compute v1.19.0 h1:+9zda3WGgW1ZSTlVppLCYFIr48Pa35q1uG2N1itbCEQ=
cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU=
cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY=
cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE=
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
Expand Down Expand Up @@ -279,6 +279,8 @@ github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUK
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k=
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E=
github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw=
github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w=
Expand Down Expand Up @@ -390,8 +392,8 @@ github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v24.0.1+incompatible h1:NxN81beIxDlUaVt46iUQrYHD9/W3u9EGl52r86O/IGw=
github.com/docker/docker v24.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM=
github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
Expand All @@ -415,6 +417,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8=
github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss=
github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA=
github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0=
github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw=
Expand Down Expand Up @@ -1536,8 +1540,8 @@ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw=
golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw=
golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g=
golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -1866,8 +1870,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc=
google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook)
}
}()

if preRun != nil {
if postCmd != nil {
err := postCmd(cmd, args)
if err != nil {
// dont return the error, log it and let execution continue to `Run`
Expand Down
28 changes: 15 additions & 13 deletions ignite/pkg/cosmosgen/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (g *generator) setup() (err error) {
if err != nil {
return err
}
g.appIncludes, err = g.resolveIncludes(g.appPath)
g.appIncludes, _, err = g.resolveIncludes(g.appPath)
if err != nil {
return err
}
Expand Down Expand Up @@ -120,9 +120,10 @@ func (g *generator) setup() (err error) {
}

var includes []string
cacheable := true
if len(modules) > 0 {
// For versioning issues, we do dependency/includes resolution per module
includes, err = g.resolveIncludes(path)
includes, cacheable, err = g.resolveIncludes(path)
if err != nil {
return err
}
Expand All @@ -133,9 +134,10 @@ func (g *generator) setup() (err error) {
Modules: modules,
Includes: includes,
}

if err := moduleCache.Put(cacheKey, modulesInPath); err != nil {
return err
if cacheable {
if err := moduleCache.Put(cacheKey, modulesInPath); err != nil {
return err
}
}
}

Expand Down Expand Up @@ -197,21 +199,21 @@ func (g *generator) generateBufIncludeFolder(modpath string) (string, error) {
return protoPath, nil
}

func (g *generator) resolveIncludes(path string) (paths []string, err error) {
func (g *generator) resolveIncludes(path string) (paths []string, cacheable bool, err error) {
// Init paths with the global include paths for protoc
paths, err = protocGlobalInclude()
if err != nil {
return nil, err
return nil, false, err
}

// Check that the app proto directory exists
protoPath := filepath.Join(path, g.protoDir)
fi, err := os.Stat(protoPath)
if err != nil && !os.IsNotExist(err) {
return nil, err
return nil, false, err
} else if !fi.IsDir() {
// Just return the global includes when a proto directory doesn't exist
return paths, nil
return paths, true, nil
}

// Add app's proto path to the list of proto paths
Expand All @@ -220,25 +222,25 @@ func (g *generator) resolveIncludes(path string) (paths []string, err error) {
// Check if a Buf config file is present
bufPath, err := g.findBufPath(protoPath)
if err != nil {
return nil, err
return nil, false, err
}

// When a Buf config exists export all protos needed
// to build the modules to a temporary include folder.
if bufPath != "" {
includePath, err := g.generateBufIncludeFolder(protoPath)
if err != nil && !errors.Is(err, cosmosbuf.ErrProtoFilesNotFound) {
return nil, err
return nil, false, err
}

// Use exported files only when the path contains ".proto" files
if includePath != "" {
return append(paths, includePath), nil
return append(paths, includePath), false, nil
}
}

// By default use the configured directories
return append(paths, g.getProtoIncludeFolders(path)...), nil
return append(paths, g.getProtoIncludeFolders(path)...), true, nil
}

func (g *generator) discoverModules(path, protoDir string) ([]module.Module, error) {
Expand Down
17 changes: 13 additions & 4 deletions ignite/pkg/cosmosgen/generate_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ignite/cli/ignite/pkg/cache"
"github.com/ignite/cli/ignite/pkg/cosmosanalysis/module"
"github.com/ignite/cli/ignite/pkg/dirchange"
"github.com/ignite/cli/ignite/pkg/nodetime"
swaggercombine "github.com/ignite/cli/ignite/pkg/nodetime/programs/swagger-combine"
"github.com/ignite/cli/ignite/pkg/xos"
)
Expand Down Expand Up @@ -39,7 +40,11 @@ func (g *generator) generateOpenAPISpec() error {
},
}
)

command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine)
if err != nil {
return err
}
defer cleanup()
defer func() {
for _, dir := range specDirs {
os.RemoveAll(dir)
Expand Down Expand Up @@ -157,7 +162,7 @@ func (g *generator) generateOpenAPISpec() error {
}

// combine specs into one and save to out.
if err := swaggercombine.Combine(g.ctx, conf, out); err != nil {
if err := swaggercombine.Combine(g.ctx, conf, command, out); err != nil {
return err
}

Expand All @@ -174,6 +179,11 @@ func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error
},
}
)
command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine)
if err != nil {
return err
}
defer cleanup()

defer func() {
for _, dir := range specDirs {
Expand Down Expand Up @@ -242,7 +252,6 @@ func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error
if err := os.MkdirAll(outDir, 0o766); err != nil {
return err
}

// combine specs into one and save to out.
return swaggercombine.Combine(g.ctx, conf, out)
return swaggercombine.Combine(g.ctx, conf, command, out)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"regexp"

"github.com/ignite/cli/ignite/pkg/cmdrunner/exec"
"github.com/ignite/cli/ignite/pkg/nodetime"
)

// Config represent swagger-combine config.
Expand Down Expand Up @@ -81,13 +80,7 @@ func (c *Config) AddSpec(id, path string, makeUnique bool) error {

// Combine combines openapi specs into one and saves to out path.
// specs is a spec id-fs path pair.
func Combine(ctx context.Context, c Config, out string) error {
command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine)
if err != nil {
return err
}
defer cleanup()

func Combine(ctx context.Context, c Config, command []string, out string) error {
f, err := os.CreateTemp("", "*.json")
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion ignite/templates/app/files/go.mod.plush
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
Expand Down
1 change: 1 addition & 0 deletions ignite/templates/app/files/proto/buf.gen.sta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ plugins:
opt:
- logtostderr=true
- openapi_naming_strategy=simple
- ignore_comments=true
- simple_operation_ids=false
- json_names_for_fields=false

0 comments on commit b4b128c

Please sign in to comment.