From 54bb6b49e964de6a245e1763c6fd77fb90e75dbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:22:14 +0100 Subject: [PATCH 1/3] chore(deps): bump postcss from 8.4.21 to 8.4.31 in /docs (#3685) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Danilo Pantani --- docs/package.json | 2 +- docs/yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/package.json b/docs/package.json index 1c6777c7dc..018f10ac78 100644 --- a/docs/package.json +++ b/docs/package.json @@ -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", diff --git a/docs/yarn.lock b/docs/yarn.lock index 0e67e05c3b..f3dfd7b93a 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -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== @@ -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" From af33f162de7e176e44d82a676186fe814a8d4278 Mon Sep 17 00:00:00 2001 From: Clockwork Date: Thu, 2 Nov 2023 18:42:33 +0200 Subject: [PATCH 2/3] fix: Optimise ts-client generation (#3725) * fix: Optimise ts-client generation * chore: Update changelog --- changelog.md | 1 + ignite/pkg/cosmosgen/generate_openapi.go | 17 +++++++++++++---- .../programs/swagger-combine/swagger-combine.go | 9 +-------- ignite/templates/app/files/go.mod.plush | 2 +- .../templates/app/files/proto/buf.gen.sta.yaml | 1 + 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index 3c6ba3b648..e66c21b220 100644 --- a/changelog.md +++ b/changelog.md @@ -36,6 +36,7 @@ - [#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 ## [`v0.27.0`](https://github.com/ignite/cli/releases/tag/v0.27.0) diff --git a/ignite/pkg/cosmosgen/generate_openapi.go b/ignite/pkg/cosmosgen/generate_openapi.go index f4897d5472..84623e6b68 100644 --- a/ignite/pkg/cosmosgen/generate_openapi.go +++ b/ignite/pkg/cosmosgen/generate_openapi.go @@ -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" ) @@ -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) @@ -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 } @@ -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 { @@ -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) } diff --git a/ignite/pkg/nodetime/programs/swagger-combine/swagger-combine.go b/ignite/pkg/nodetime/programs/swagger-combine/swagger-combine.go index a1ec01ede4..2b0c3da375 100644 --- a/ignite/pkg/nodetime/programs/swagger-combine/swagger-combine.go +++ b/ignite/pkg/nodetime/programs/swagger-combine/swagger-combine.go @@ -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. @@ -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 diff --git a/ignite/templates/app/files/go.mod.plush b/ignite/templates/app/files/go.mod.plush index 578f6def14..6dab72199d 100644 --- a/ignite/templates/app/files/go.mod.plush +++ b/ignite/templates/app/files/go.mod.plush @@ -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 diff --git a/ignite/templates/app/files/proto/buf.gen.sta.yaml b/ignite/templates/app/files/proto/buf.gen.sta.yaml index d8cea8b342..4444f5e75c 100644 --- a/ignite/templates/app/files/proto/buf.gen.sta.yaml +++ b/ignite/templates/app/files/proto/buf.gen.sta.yaml @@ -10,5 +10,6 @@ plugins: opt: - logtostderr=true - openapi_naming_strategy=simple + - ignore_comments=true - simple_operation_ids=false - json_names_for_fields=false From 897b1cc783eee9f9ffd6232584826938fc2b79e1 Mon Sep 17 00:00:00 2001 From: Clockwork Date: Fri, 3 Nov 2023 17:34:57 +0200 Subject: [PATCH 3/3] fix: Don't cache modules with tmp includes (#3729) * fix: Don't cache modules with tmp includes * chore: Add changelog --- changelog.md | 1 + ignite/pkg/cosmosgen/generate.go | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index e66c21b220..5581e423dc 100644 --- a/changelog.md +++ b/changelog.md @@ -37,6 +37,7 @@ - [#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) diff --git a/ignite/pkg/cosmosgen/generate.go b/ignite/pkg/cosmosgen/generate.go index fd85995f57..05cc679089 100644 --- a/ignite/pkg/cosmosgen/generate.go +++ b/ignite/pkg/cosmosgen/generate.go @@ -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 } @@ -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 } @@ -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 + } } } @@ -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 @@ -220,7 +222,7 @@ 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 @@ -228,17 +230,17 @@ func (g *generator) resolveIncludes(path string) (paths []string, err error) { 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) {