8000 refactor!: remove react frontend + re-enable disabled integration tests (backport #4744) by mergify[bot] · Pull Request #4756 · ignite/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor!: remove react frontend + re-enable disabled integration tests (backport #4744) #4756

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

Draft
wants to merge 4 commits into
base: release/v28.x.y
Choose a base branch
from
Draft
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
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

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

### Changes

- [#4718](https://github.com/ignite/cli/pull/4718) Bump default Ignite Apps.
Expand All @@ -10,7 +12,7 @@

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

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

Expand Down
14 changes: 8 additions & 6 deletions docs/docs/03-clients/03-vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,22 @@ purposes, but you should not do this in production.

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

```
```bash
ignite chain serve
```

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

```
npm install && npm run dev
:::note
Make sure you have [pnpm](https://pnpm.io/) installed.
:::

```bash
pnpm install && pnpm dev
```

It is recommended to run `npm install` before starting your app with `npm run
dev` to ensure that all dependencies are installed (including the ones that the
API client has, see `vue/postinstall.js`).
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`).

Open your browser and navigate to
[http://localhost:5173/](http://localhost:5173/).
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ require (
github.com/hashicorp/go-plugin v1.6.0
github.com/iancoleman/strcase v0.3.0
github.com/ignite/ignite-files/protoc v0.0.1
github.com/ignite/web v0.6.1
github.com/ignite/web v1.0.8
github.com/imdario/mergo v0.3.13
github.com/jpillora/chisel v1.9.1
github.com/lib/pq v1.10.9
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
github.com/ignite/ignite-files/protoc v0.0.1 h1:wXxU1dzruUgSVl1diAuAOA+xv0NQKXJFsDWht2+tAP8=
github.com/ignite/ignite-files/protoc v0.0.1/go.mod h1:cVCHJbEHPIeKHMPk3ZoPS0Xw4XQfUc76BAMAPU9Fwjg=
github.com/ignite/web v0.6.1 h1:kHG+T7NnR8cCPjAGxEFQD+njVYM08toeG57iYRXzpwo=
github.com/ignite/web v0.6.1/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
github.com/ignite/web v1.0.8 h1:St3L6UJj70+h16+No5em8Vn2Hx93tS2G1MyWO/Kt1cc=
github.com/ignite/web v1.0.8/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
Expand Down
1 change: 0 additions & 1 deletion ignite/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ meant to be edited by hand.
c.AddCommand(NewGenerateTSClient())
c.AddCommand(NewGenerateVuex())
c.AddCommand(NewGenerateComposables())
c.AddCommand(NewGenerateHooks())
c.AddCommand(NewGenerateOpenAPI())

return c
Expand Down
58 changes: 0 additions & 58 deletions ignite/cmd/generate_hooks.go

This file was deleted.

27 changes: 2 additions & 25 deletions ignite/cmd/scaffold_react.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,14 @@ package ignitecmd

import (
"github.com/spf13/cobra"

chainconfig "github.com/ignite/cli/v28/ignite/config/chain"
"github.com/ignite/cli/v28/ignite/pkg/cliui"
"github.com/ignite/cli/v28/ignite/pkg/cosmosgen"
)

// NewScaffoldReact scaffolds a React app for a chain.
func NewScaffoldReact() *cobra.Command {
c := &cobra.Command{
Hidden: true, // hidden util we have a better ts-client.
Use: "react",
Short: "React web app template",
Args: cobra.NoArgs,
PreRunE: migrationPreRunHandler,
RunE: scaffoldReactHandler,
Use: "react",
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",
}

c.Flags().AddFlagSet(flagSetYes())
c.Flags().StringP(flagPath, "p", "./"+chainconfig.DefaultReactPath, "path to scaffold content of the React app")

return c
}

func scaffoldReactHandler(cmd *cobra.Command, _ []string) error {
session := cliui.New(cliui.StartSpinnerWithText(statusScaffolding))
defer session.End()

path := flagGetPath(cmd)
if err := cosmosgen.React(path); err != nil {
return err
}

return session.Printf("\n🎉 Scaffolded a React app in %s.\n\n", path)
}
6 changes: 3 additions & 3 deletions ignite/cmd/scaffold_vue.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package ignitecmd

import (
"path/filepath"

"github.com/spf13/cobra"

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

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

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

path := flagGetPath(cmd)
path := filepath.Join(".", chainconfig.DefaultVuePath)
if err := cosmosgen.Vue(path); err != nil {
return err
}
Expand Down
9 changes: 0 additions & 9 deletions ignite/config/chain/base/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ type Client struct {
// Composables configures code generation for Vue 3 composables.
Composables Composables `yaml:"composables,omitempty"`

// Hooks configures code generation for React hooks.
Hooks Hooks `yaml:"hooks,omitempty"`

// OpenAPI configures OpenAPI spec generation for API.
OpenAPI OpenAPI `yaml:"openapi,omitempty"`
}
Expand All @@ -90,12 +87,6 @@ type Composables struct {
Path string `yaml:"path"`
}

// Hooks configures code generation for react-query hooks.
type Hooks struct {
// Path configures out location for generated vue-query hooks.
Path string `yaml:"path"`
}

// OpenAPI configures OpenAPI spec generation for API.
type OpenAPI struct {
Path string `yaml:"path"`
Expand Down
19 changes: 2 additions & 17 deletions ignite/config/chain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ var (
// The path is relative to the app's directory.
DefaultVuePath = "vue"

// DefaultReactPath defines the default relative path to use when scaffolding a React app.
// The path is relative to the app's directory.
DefaultReactPath = "react"

// DefaultVuexPath defines the default relative path to use when generating Vuex stores for a Vue app.
// The path is relative to the app's directory.
DefaultVuexPath = "vue/src/store"
Expand All @@ -38,9 +34,8 @@ var (
// The path is relative to the app's directory.
DefaultComposablesPath = "vue/src/composables"

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

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

// HooksPath returns the relative path to the React useQuery hooks directory.
// Path is relative to the app's directory.
func HooksPath(conf *Config) string {
if path := strings.TrimSpace(conf.Client.Hooks.Path); path != "" {
return filepath.Clean(path)
}

return DefaultHooksPath
}

// LocateDefault locates the default path for the config file.
// Returns ErrConfigNotFound when no config file found.
func LocateDefault(root string) (path string, err error) {
Expand Down
32 changes: 6 additions & 26 deletions ignite/pkg/cosmosgen/cosmosgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ type generateOptions struct {
composablesOut func(module.Module) string
composablesRootPath string

hooksOut func(module.Module) string
hooksRootPath string

specOut string
}

Expand Down Expand Up @@ -68,14 +65,7 @@ func WithComposablesGeneration(out ModulePathFunc, composablesRootPath string) O
}
}

func WithHooksGeneration(out ModulePathFunc, hooksRootPath string) Option {
return func(o *generateOptions) {
o.hooksOut = out
o.hooksRootPath = hooksRootPath
}
}

// WithGoGeneration adds protobuf (gogoproto and pulsar) code generation.
// WithGoGeneration adds protobuf (gogoproto) code generation.
func WithGoGeneration() Option {
return func(o *generateOptions) {
o.generateProtobuf = true
Expand Down Expand Up @@ -112,6 +102,7 @@ type generator struct {
appPath string
protoDir string
goModPath string
frontendPath string
opts *generateOptions
sdkImport string
sdkDir string
Expand All @@ -132,7 +123,7 @@ func (g *generator) cleanup() {

// Generate generates code from protoDir of an SDK app residing at appPath with given options.
// protoDir must be relative to the projectPath.
func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir, goModPath string, options ...Option) error {
func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir, goModPath string, frontendPath string, options ...Option) error {
b, err := cosmosbuf.New(cacheStorage, goModPath)
if err != nil {
return err
Expand All @@ -143,6 +134,7 @@ func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir
appPath: appPath,
protoDir: protoDir,
goModPath: goModPath,
frontendPath: frontendPath,
opts: &generateOptions{},
thirdModules: make(map[string][]module.Module),
thirdModuleIncludes: make(map[string]protoIncludes),
Expand Down Expand Up @@ -215,26 +207,14 @@ func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir
}

if g.opts.composablesRootPath != "" {
if err := g.generateComposables("vue"); err != nil {
if err := g.generateComposables(); err != nil {
return err
}

// Update Vue app dependencies when Vue composables are generated.
// This update is required to link the "ts-client" folder so the
// package is available during development before publishing it.
if err := g.updateComposableDependencies("vue"); err != nil {
return err
}
}
if g.opts.hooksRootPath != "" {
if err := g.generateComposables("react"); err != nil {
return err
}

// Update React app dependencies when React hooks are generated.
// This update is required to link the "ts-client" folder so the
// package is available during development before publishing it.
if err := g.updateComposableDependencies("react"); err != nil {
if err := g.updateComposableDependencies(); err != nil {
return err
}
}
Expand Down
Loading
Loading
0