Skip to content

Commit 0b1af1e

Browse files
julienrbrtmergify[bot]
authored andcommitted
refactor!: remove react frontend + re-enable disabled integration tests (#4744)
* refactor!: remove react frontend + re-enable disabled integration tests * deprecate command and no-op it * lint * bump web to v1.0.8 * remove hooks * improvements * update index.ts.tpl * fix * improve ux * add pnpm instructions * fixes * fix integration test * rename * uncomment other test * updates --------- Co-authored-by: Danilo Pantani <danpantani@gmail.com> (cherry picked from commit d1bf508) # Conflicts: # docs/docs/03-clients/04-react.md # go.mod # go.sum # ignite/cmd/generate.go # ignite/cmd/generate_hooks.go # ignite/cmd/scaffold_react.go # ignite/config/chain/base/config.go # ignite/config/chain/config.go # ignite/pkg/cosmosgen/cosmosgen.go # ignite/services/chain/generate.go # ignite/services/scaffolder/scaffolder.go # integration/app.go # integration/client.go # integration/cosmosgen/bank_module_test.go # integration/cosmosgen/cosmosgen_composables_test.go # integration/cosmosgen/cosmosgen_hooks_test.go # integration/cosmosgen/custom_module_test.go
1 parent 9054536 commit 0b1af1e

23 files changed

Lines changed: 371 additions & 240 deletions

File tree

changelog.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,32 @@
55
### Changes
66

77
- [#4718](https://github.com/ignite/cli/pull/4718) Bump default Ignite Apps.
8+
- [#4741](https://github.com/ignite/cli/pull/4741) Let `generate openapi` generate external modules OpenAPI spec.
9+
- [#4747](https://github.com/ignite/cli/pull/4747) Improve Ignite UI.
10+
11+
### Fixes
12+
13+
- [#4691](https://github.com/ignite/cli/pull/4691), [#4706](https://github.com/ignite/cli/pull/4706), [#4725](https://github.com/ignite/cli/pull/4725), [#4737](https://github.com/ignite/cli/pull/4737) Fix ts-client query template and solely Go template for `ts-client` generation.
14+
- [#4742](https://github.com/ignite/cli/pull/4742) Updates Vue composables template for new ts-client and tanstack/vue-query v5
15+
- [#4744](https://github.com/ignite/cli/pull/4744) Remove `react` frontend generation via `s react` command. Use the [Ignite CCA App](https://github.com/ignite/apps) instead.
16+
17+
## [`v29.0.0`](https://github.com/ignite/cli/releases/tag/v29.0.0)
18+
19+
### Features
20+
21+
- [#4614](https://github.com/ignite/cli/pull/4614) Improve integration tests and add query tests.
22+
- [#4683](https://github.com/ignite/cli/pull/4683) Allow to change default denom via flag.
23+
- [#4687](https://github.com/ignite/cli/pull/4687) Add address type with `scalar` annotations, and add `scalar` type to signer field.
24+
25+
### Changes
26+
27+
- [#4689](https://github.com/ignite/cli/pull/4689) Revert `HasGenesis` implementation from retracted `core` v1 to SDK `HasGenesis` interface.
28+
- [#4701](https://github.com/ignite/cli/pull/4701) Improve `ignite doctor` by removing manual migration step. Additionally, remove protoc to buf migrations logic.
29+
- [#4703](https://github.com/ignite/cli/pull/4703) Remove testutil.Register function.
30+
- [#4702](https://github.com/ignite/cli/pull/4702) Improve app detection by checking for inheritance instead of interface implementation.
31+
- [#4707](https://github.com/ignite/cli/pull/4707) Show `buf` version in `ignite version` only when in a go module.
32+
- [#4709](https://github.com/ignite/cli/pull/4709) Remove legacy msgServer support
33+
- [#4710](https://github.com/ignite/cli/pull/4710) Remove the `nullify` pkg from the chain `testutil`
834

935
### Fixes
1036

docs/docs/03-clients/03-vue.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,22 @@ purposes, but you should not do this in production.
9494

9595
In the `example` directory run the following command to start your blockchain:
9696

97-
```
97+
```bash
9898
ignite chain serve
9999
```
100100

101101
To start your Vue application, go to the `vue` directory and run the following
102102
command in a separate terminal window:
103103

104-
```
105-
npm install && npm run dev
104+
:::note
105+
Make sure you have [pnpm](https://pnpm.io/) installed.
106+
:::
107+
108+
```bash
109+
pnpm install && pnpm dev
106110
```
107111

108-
It is recommended to run `npm install` before starting your app with `npm run
109-
dev` to ensure that all dependencies are installed (including the ones that the
110-
API client has, see `vue/postinstall.js`).
112+
It is recommended to run `pnpm install` before starting your app with `pnpm dev` to ensure that all dependencies are installed (including the ones that the API client has, see `vue/postinstall.js`).
111113

112114
Open your browser and navigate to
113115
[http://localhost:5173/](http://localhost:5173/).

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ require (
5555
github.com/hashicorp/go-hclog v1.6.3
5656
github.com/hashicorp/go-plugin v1.6.0
5757
github.com/iancoleman/strcase v0.3.0
58+
<<<<<<< HEAD
5859
github.com/ignite/ignite-files/protoc v0.0.1
5960
github.com/ignite/web v0.6.1
6061
github.com/imdario/mergo v0.3.13
6162
github.com/jpillora/chisel v1.9.1
63+
=======
64+
github.com/ignite/web v1.0.8
65+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
6266
github.com/lib/pq v1.10.9
6367
github.com/manifoldco/promptui v0.9.0
6468
github.com/mitchellh/mapstructure v1.5.0

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,15 @@ github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSAS
833833
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
834834
github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
835835
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
836+
<<<<<<< HEAD
836837
github.com/ignite/ignite-files/protoc v0.0.1 h1:wXxU1dzruUgSVl1diAuAOA+xv0NQKXJFsDWht2+tAP8=
837838
github.com/ignite/ignite-files/protoc v0.0.1/go.mod h1:cVCHJbEHPIeKHMPk3ZoPS0Xw4XQfUc76BAMAPU9Fwjg=
838839
github.com/ignite/web v0.6.1 h1:kHG+T7NnR8cCPjAGxEFQD+njVYM08toeG57iYRXzpwo=
839840
github.com/ignite/web v0.6.1/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
841+
=======
842+
github.com/ignite/web v1.0.8 h1:St3L6UJj70+h16+No5em8Vn2Hx93tS2G1MyWO/Kt1cc=
843+
github.com/ignite/web v1.0.8/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
844+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
840845
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
841846
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
842847
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=

ignite/cmd/generate.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,21 @@ meant to be edited by hand.
3232
flagSetPath(c)
3333
flagSetClearCache(c)
3434

35+
<<<<<<< HEAD
3536
c.AddCommand(NewGenerateGo())
3637
c.AddCommand(NewGenerateTSClient())
3738
c.AddCommand(NewGenerateVuex())
3839
c.AddCommand(NewGenerateComposables())
3940
c.AddCommand(NewGenerateHooks())
4041
c.AddCommand(NewGenerateOpenAPI())
42+
=======
43+
c.AddCommand(
44+
NewGenerateGo(),
45+
NewGenerateTSClient(),
46+
NewGenerateComposables(),
47+
NewGenerateOpenAPI(),
48+
)
49+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
4150

4251
return c
4352
}

ignite/cmd/scaffold_react.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,25 @@ package ignitecmd
22

33
import (
44
"github.com/spf13/cobra"
5+
<<<<<<< HEAD
56

67
chainconfig "github.com/ignite/cli/v28/ignite/config/chain"
78
"github.com/ignite/cli/v28/ignite/pkg/cliui"
89
"github.com/ignite/cli/v28/ignite/pkg/cosmosgen"
10+
=======
11+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
912
)
1013

1114
// NewScaffoldReact scaffolds a React app for a chain.
1215
func NewScaffoldReact() *cobra.Command {
1316
c := &cobra.Command{
14-
Hidden: true, // hidden util we have a better ts-client.
15-
Use: "react",
16-
Short: "React web app template",
17-
Args: cobra.NoArgs,
18-
PreRunE: migrationPreRunHandler,
19-
RunE: scaffoldReactHandler,
17+
Use: "react",
18+
Deprecated: "the React scaffolding feature is removed from Ignite CLI.\nPlease use the Ignite CCA app to create a React app.\nFor more information, visit: https://ignite.com/marketplace/CCA",
2019
}
2120

22-
c.Flags().AddFlagSet(flagSetYes())
23-
c.Flags().StringP(flagPath, "p", "./"+chainconfig.DefaultReactPath, "path to scaffold content of the React app")
24-
2521
return c
2622
}
23+
<<<<<<< HEAD
2724

2825
func scaffoldReactHandler(cmd *cobra.Command, _ []string) error {
2926
session := cliui.New(cliui.StartSpinnerWithText(statusScaffolding))
@@ -36,3 +33,5 @@ func scaffoldReactHandler(cmd *cobra.Command, _ []string) error {
3633

3734
return session.Printf("\n🎉 Scaffolded a React app in %s.\n\n", path)
3835
}
36+
=======
37+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))

ignite/cmd/scaffold_vue.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package ignitecmd
22

33
import (
4+
"path/filepath"
5+
46
"github.com/spf13/cobra"
57

68
chainconfig "github.com/ignite/cli/v28/ignite/config/chain"
@@ -11,7 +13,6 @@ import (
1113
// NewScaffoldVue scaffolds a Vue.js app for a chain.
1214
func NewScaffoldVue() *cobra.Command {
1315
c := &cobra.Command{
14-
Hidden: true, // hidden util we have a better ts-client.
1516
Use: "vue",
1617
Short: "Vue 3 web app template",
1718
Args: cobra.NoArgs,
@@ -20,7 +21,6 @@ func NewScaffoldVue() *cobra.Command {
2021
}
2122

2223
c.Flags().AddFlagSet(flagSetYes())
23-
c.Flags().StringP(flagPath, "p", "./"+chainconfig.DefaultVuePath, "path to scaffold content of the Vue.js app")
2424

2525
return c
2626
}
@@ -29,7 +29,7 @@ func scaffoldVueHandler(cmd *cobra.Command, _ []string) error {
2929
session := cliui.New(cliui.StartSpinnerWithText(statusScaffolding))
3030
defer session.End()
3131

32-
path := flagGetPath(cmd)
32+
path := filepath.Join(".", chainconfig.DefaultVuePath)
3333
if err := cosmosgen.Vue(path); err != nil {
3434
return err
3535
}

ignite/config/chain/base/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,12 @@ type Client struct {
6363
// Composables configures code generation for Vue 3 composables.
6464
Composables Composables `yaml:"composables,omitempty"`
6565

66+
<<<<<<< HEAD
6667
// Hooks configures code generation for React hooks.
6768
Hooks Hooks `yaml:"hooks,omitempty"`
6869

70+
=======
71+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
6972
// OpenAPI configures OpenAPI spec generation for API.
7073
OpenAPI OpenAPI `yaml:"openapi,omitempty"`
7174
}
@@ -90,12 +93,15 @@ type Composables struct {
9093
Path string `yaml:"path"`
9194
}
9295

96+
<<<<<<< HEAD
9397
// Hooks configures code generation for react-query hooks.
9498
type Hooks struct {
9599
// Path configures out location for generated vue-query hooks.
96100
Path string `yaml:"path"`
97101
}
98102

103+
=======
104+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
99105
// OpenAPI configures OpenAPI spec generation for API.
100106
type OpenAPI struct {
101107
Path string `yaml:"path"`

ignite/config/chain/config.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var (
2626
// The path is relative to the app's directory.
2727
DefaultVuePath = "vue"
2828

29+
<<<<<<< HEAD
2930
// DefaultReactPath defines the default relative path to use when scaffolding a React app.
3031
// The path is relative to the app's directory.
3132
DefaultReactPath = "react"
@@ -34,13 +35,20 @@ var (
3435
// The path is relative to the app's directory.
3536
DefaultVuexPath = "vue/src/store"
3637

38+
=======
39+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
3740
// DefaultComposablesPath defines the default relative path to use when generating useQuery composables for a Vue app.
3841
// The path is relative to the app's directory.
3942
DefaultComposablesPath = "vue/src/composables"
4043

44+
<<<<<<< HEAD
4145
// DefaultHooksPath defines the default relative path to use when generating useQuery hooks for a React app.
4246
// The path is relative to the app's directory.
4347
DefaultHooksPath = "react/src/hooks"
48+
=======
49+
// DefaultVueTypesPath defines the default vue types path.
50+
DefaultVueTypesPath = "vue/src/views/Types.vue"
51+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
4452

4553
// DefaultOpenAPIPath defines the default relative path to use when generating an OpenAPI schema.
4654
// The path is relative to the app's directory.
@@ -112,16 +120,6 @@ func ComposablesPath(conf *Config) string {
112120
return DefaultComposablesPath
113121
}
114122

115-
// HooksPath returns the relative path to the React useQuery hooks directory.
116-
// Path is relative to the app's directory.
117-
func HooksPath(conf *Config) string {
118-
if path := strings.TrimSpace(conf.Client.Hooks.Path); path != "" {
119-
return filepath.Clean(path)
120-
}
121-
122-
return DefaultHooksPath
123-
}
124-
125123
// LocateDefault locates the default path for the config file.
126124
// Returns ErrConfigNotFound when no config file found.
127125
func LocateDefault(root string) (path string, err error) {

ignite/pkg/cosmosgen/cosmosgen.go

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ type generateOptions struct {
3232
composablesOut func(module.Module) string
3333
composablesRootPath string
3434

35-
hooksOut func(module.Module) string
36-
hooksRootPath string
37-
3835
specOut string
3936
}
4037

@@ -68,6 +65,7 @@ func WithComposablesGeneration(out ModulePathFunc, composablesRootPath string) O
6865
}
6966
}
7067

68+
<<<<<<< HEAD
7169
func WithHooksGeneration(out ModulePathFunc, hooksRootPath string) Option {
7270
return func(o *generateOptions) {
7371
o.hooksOut = out
@@ -76,6 +74,9 @@ func WithHooksGeneration(out ModulePathFunc, hooksRootPath string) Option {
7674
}
7775

7876
// WithGoGeneration adds protobuf (gogoproto and pulsar) code generation.
77+
=======
78+
// WithGoGeneration adds protobuf (gogoproto) code generation.
79+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
7980
func WithGoGeneration() Option {
8081
return func(o *generateOptions) {
8182
o.generateProtobuf = true
@@ -112,6 +113,7 @@ type generator struct {
112113
appPath string
113114
protoDir string
114115
goModPath string
116+
frontendPath string
115117
opts *generateOptions
116118
sdkImport string
117119
sdkDir string
@@ -132,8 +134,13 @@ func (g *generator) cleanup() {
132134

133135
// Generate generates code from protoDir of an SDK app residing at appPath with given options.
134136
// protoDir must be relative to the projectPath.
137+
<<<<<<< HEAD
135138
func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir, goModPath string, options ...Option) error {
136139
b, err := cosmosbuf.New(cacheStorage, goModPath)
140+
=======
141+
func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir, goModPath string, frontendPath string, options ...Option) error {
142+
buf, err := cosmosbuf.New(cacheStorage, goModPath)
143+
>>>>>>> d1bf508a (refactor!: remove react frontend + re-enable disabled integration tests (#4744))
137144
if err != nil {
138145
return err
139146
}
@@ -143,6 +150,7 @@ func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir
143150
appPath: appPath,
144151
protoDir: protoDir,
145152
goModPath: goModPath,
153+
frontendPath: frontendPath,
146154
opts: &generateOptions{},
147155
thirdModules: make(map[string][]module.Module),
148156
thirdModuleIncludes: make(map[string]protoIncludes),
@@ -215,26 +223,14 @@ func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir
215223
}
216224

217225
if g.opts.composablesRootPath != "" {
218-
if err := g.generateComposables("vue"); err != nil {
226+
if err := g.generateComposables(); err != nil {
219227
return err
220228
}
221229

222230
// Update Vue app dependencies when Vue composables are generated.
223231
// This update is required to link the "ts-client" folder so the
224232
// package is available during development before publishing it.
225-
if err := g.updateComposableDependencies("vue"); err != nil {
226-
return err
227-
}
228-
}
229-
if g.opts.hooksRootPath != "" {
230-
if err := g.generateComposables("react"); err != nil {
231-
return err
232-
}
233-
234-
// Update React app dependencies when React hooks are generated.
235-
// This update is required to link the "ts-client" folder so the
236-
// package is available during development before publishing it.
237-
if err := g.updateComposableDependencies("react"); err != nil {
233+
if err := g.updateComposableDependencies(); err != nil {
238234
return err
239235
}
240236
}

0 commit comments

Comments
 (0)