ignite / cli

Ignite is a CLI tool and hub designed for constructing Proof of Stake Blockchains rooted in Cosmos-SDK
https://ignite.com
Other
1.25k stars 549 forks source link

Scaffolding no longer works because of a TypeScript code gen bug #2829

Closed fadeev closed 2 years ago

fadeev commented 2 years ago

If you have the following in config.yml:

client:
  typescript:
    path: "ts-client"
  vuex:
    path: "vue/src/store"

And try scaffolding a message:

ignite s message create-foo bar

It will fail with vue/package.json: no such file or directory.

Removing the client from config.yml fixes the issue.

jeronimoalbi commented 2 years ago

I could not reproduce the vue/package.json: no such file or directory but there is another issue with the config:

client:
  vuex:
    path: "vue/src/store"

When the typescript config is removed with an error message similar to:

Rel: can't make  relative to /home/user/app/vue
clockworkgr commented 2 years ago

If you have the following in config.yml:

client:
  typescript:
    path: "ts-client"
  vuex:
    path: "vue/src/store"

And try scaffolding a message:

ignite s message create-foo bar

It will fail with vue/package.json: no such file or directory.

Removing the client from config.yml fixes the issue.

My guess at what happens:

When the ts-client is generated, it is generated as a package.....For our vue frontend to work, that package must be depended on in the vue template's package.json so when we generate it , we write that dependency entry.

Any scaffolding action triggers a client generation but user may not have scaffoled a vue frontend.

TL;DR @jeronimoalbi we should basically check for the existence of vue/ and vue/package.json before attempting to edit it.

jeronimoalbi commented 2 years ago

@clockworkgr I verified and the package.json will only be modified by updateVueDependencies() to link to the ts-client directory when the generate vuex command is executed. Only in that case, so the package.json file should be already in the vue app directory at that point.

clockworkgr commented 2 years ago

@clockworkgr I verified and the package.json will only be modified by updateVueDependencies() to link to the ts-client directory when the generate vuex command is executed. Only in that case, so the package.json file should be already in the vue app directory at that point.

not necessarily... user may have previously deleted vue/ or not scaffolded the vue app... vue/package.json is ensured by scaffolding the vue app...not by generate vuex

Someone may be generating the vuex stores for use on their own custom vue frontend. Hence an existence test to avoid such errors would be good...