Skip to content

Commit 3b98730

Browse files
refactor!: remove react frontend + re-enable disabled integration tests (backport #4744) (#4756)
* 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 * conflicts * conflicts * up * update --------- Co-authored-by: julienrbrt <julien@rbrt.fr>
1 parent 78886ca commit 3b98730

28 files changed

Lines changed: 111 additions & 847 deletions

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
- [#4686](https://github.com/ignite/cli/pull/4686) Filter discovered protos to only messages.
1515
- [#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.
16-
- [#4742](https://github.com/ignite/cli/pull/4742) Updates Vue composables template for new ts-client and tanstack/vue-query v5
16+
- [#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.
1717

1818
## [`v28.10.0`](https://github.com/ignite/cli/releases/tag/v28.10.0)
1919

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ require (
5656
github.com/hashicorp/go-plugin v1.6.0
5757
github.com/iancoleman/strcase v0.3.0
5858
github.com/ignite/ignite-files/protoc v0.0.1
59-
github.com/ignite/web v0.6.1
59+
github.com/ignite/web v1.0.8
6060
github.com/imdario/mergo v0.3.13
6161
github.com/jpillora/chisel v1.9.1
6262
github.com/lib/pq v1.10.9

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:
835835
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
836836
github.com/ignite/ignite-files/protoc v0.0.1 h1:wXxU1dzruUgSVl1diAuAOA+xv0NQKXJFsDWht2+tAP8=
837837
github.com/ignite/ignite-files/protoc v0.0.1/go.mod h1:cVCHJbEHPIeKHMPk3ZoPS0Xw4XQfUc76BAMAPU9Fwjg=
838-
github.com/ignite/web v0.6.1 h1:kHG+T7NnR8cCPjAGxEFQD+njVYM08toeG57iYRXzpwo=
839-
github.com/ignite/web v0.6.1/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
838+
github.com/ignite/web v1.0.8 h1:St3L6UJj70+h16+No5em8Vn2Hx93tS2G1MyWO/Kt1cc=
839+
github.com/ignite/web v1.0.8/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
840840
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
841841
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
842842
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=

ignite/cmd/generate.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ meant to be edited by hand.
3636
c.AddCommand(NewGenerateTSClient())
3737
c.AddCommand(NewGenerateVuex())
3838
c.AddCommand(NewGenerateComposables())
39-
c.AddCommand(NewGenerateHooks())
4039
c.AddCommand(NewGenerateOpenAPI())
4140

4241
return c

ignite/cmd/generate_hooks.go

Lines changed: 0 additions & 58 deletions
This file was deleted.

ignite/cmd/scaffold_react.go

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

33
import (
44
"github.com/spf13/cobra"
5-
6-
chainconfig "github.com/ignite/cli/v28/ignite/config/chain"
7-
"github.com/ignite/cli/v28/ignite/pkg/cliui"
8-
"github.com/ignite/cli/v28/ignite/pkg/cosmosgen"
95
)
106

117
// NewScaffoldReact scaffolds a React app for a chain.
128
func NewScaffoldReact() *cobra.Command {
139
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,
10+
Use: "react",
11+
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",
2012
}
2113

22-
c.Flags().AddFlagSet(flagSetYes())
23-
c.Flags().StringP(flagPath, "p", "./"+chainconfig.DefaultReactPath, "path to scaffold content of the React app")
24-
2514
return c
2615
}
27-
28-
func scaffoldReactHandler(cmd *cobra.Command, _ []string) error {
29-
session := cliui.New(cliui.StartSpinnerWithText(statusScaffolding))
30-
defer session.End()
31-
32-
path := flagGetPath(cmd)
33-
if err := cosmosgen.React(path); err != nil {
34-
return err
35-
}
36-
37-
return session.Printf("\n🎉 Scaffolded a React app in %s.\n\n", path)
38-
}

ignite/cmd/scaffold_vue.go

Lines changed: 4 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,7 @@ 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.
16+
Hidden: true,
1517
Use: "vue",
1618
Short: "Vue 3 web app template",
1719
Args: cobra.NoArgs,
@@ -20,7 +22,6 @@ func NewScaffoldVue() *cobra.Command {
2022
}
2123

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

2526
return c
2627
}
@@ -29,7 +30,7 @@ func scaffoldVueHandler(cmd *cobra.Command, _ []string) error {
2930
session := cliui.New(cliui.StartSpinnerWithText(statusScaffolding))
3031
defer session.End()
3132

32-
path := flagGetPath(cmd)
33+
path := filepath.Join(".", chainconfig.DefaultVuePath)
3334
if err := cosmosgen.Vue(path); err != nil {
3435
return err
3536
}

ignite/config/chain/base/config.go

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

66-
// Hooks configures code generation for React hooks.
67-
Hooks Hooks `yaml:"hooks,omitempty"`
68-
6966
// OpenAPI configures OpenAPI spec generation for API.
7067
OpenAPI OpenAPI `yaml:"openapi,omitempty"`
7168
}
@@ -90,12 +87,6 @@ type Composables struct {
9087
Path string `yaml:"path"`
9188
}
9289

93-
// Hooks configures code generation for react-query hooks.
94-
type Hooks struct {
95-
// Path configures out location for generated vue-query hooks.
96-
Path string `yaml:"path"`
97-
}
98-
9990
// OpenAPI configures OpenAPI spec generation for API.
10091
type OpenAPI struct {
10192
Path string `yaml:"path"`

ignite/config/chain/config.go

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

29-
// DefaultReactPath defines the default relative path to use when scaffolding a React app.
30-
// The path is relative to the app's directory.
31-
DefaultReactPath = "react"
32-
3329
// DefaultVuexPath defines the default relative path to use when generating Vuex stores for a Vue app.
3430
// The path is relative to the app's directory.
3531
DefaultVuexPath = "vue/src/store"
@@ -38,9 +34,8 @@ var (
3834
// The path is relative to the app's directory.
3935
DefaultComposablesPath = "vue/src/composables"
4036

41-
// DefaultHooksPath defines the default relative path to use when generating useQuery hooks for a React app.
42-
// The path is relative to the app's directory.
43-
DefaultHooksPath = "react/src/hooks"
37+
// DefaultVueTypesPath defines the default vue types path.
38+
DefaultVueTypesPath = "vue/src/views/Types.vue"
4439

4540
// DefaultOpenAPIPath defines the default relative path to use when generating an OpenAPI schema.
4641
// The path is relative to the app's directory.
@@ -112,16 +107,6 @@ func ComposablesPath(conf *Config) string {
112107
return DefaultComposablesPath
113108
}
114109

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-
125110
// LocateDefault locates the default path for the config file.
126111
// Returns ErrConfigNotFound when no config file found.
127112
func LocateDefault(root string) (path string, err error) {

0 commit comments

Comments
 (0)