Skip to content
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

Query builder generator gets stuck on prompt #12

Open
juni0r opened this issue Nov 27, 2023 · 2 comments
Open

Query builder generator gets stuck on prompt #12

juni0r opened this issue Nov 27, 2023 · 2 comments

Comments

@juni0r
Copy link
Contributor

juni0r commented Nov 27, 2023

The generateQueryBuilder method runs @edgedb/generate edgeql-js but if the generated folder doesn't exist will prompt the user to add it to .gitignore. Since by default generation is quiet, server startup gets stuck at this point. It will work subsequently as soon as the folder has been created.

To fix this, the command needs to be invoked with yes n, like so: yes n | @edgedb/generate edgeql-js [...] to dismiss the prompt. I think this should be easy with execa, similar to this example.

I'd also suggest that even in quiet mode, there should be one line per generator to give some status information, which isn't exactly verbose but still gives useful feedback. Like so:

Generating EdgeDb queries.
Generating EdgeDb query builder.
...

The quiet option could become 'verbose' and show the full output of the generators.

@Tahul
Copy link
Owner

Tahul commented Nov 27, 2023

Excellent suggestion, prompts while the Nuxt server is running is quite a tricky context, but seem to work.

I will apply the fix you suggest in next release, do you have any other suggestions over the generate commands?

@juni0r
Copy link
Contributor Author

juni0r commented Nov 27, 2023

Since you asked, I like the batteries-included-approach with running generators etc. automatically and even installing / setting up EdgeDB if it isnt' configured yet.

It seems to me though, that doing this every time the module is loaded might not be the best place to do it. Sure, there's the possibility to disable generation with flags but the workflow is a bit cumbersome. Edit my schema, set generate-flags to true in nuxt.config.js, starting the server and setting them back to false again (same goes for projectInit and installCli).

But what would be a better place to put it? Maybe adding a bin script to the npm package might be an option, like nuxt-edgedb with sub-commands like generate and setup.

You could still perform some checks during module setup (like checking if the EdgeDB project has been initialized or if env variables are set and issue warnings and provide hints, like 'No EdgeDB installation found in current project. Run nuxt-edgedb setup.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants