You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now we abstract away the need for top-level await in Redwood console by automatically resolving promises. This works but it'd I think it'd still be super nice to have top level await.
Original
Right now the console command requires the NODE_OPTIONS env var be set to --experimental-repl-await. This isn't an ideal workflow, especially since the console command will be in the tutorial II, so I tried to fix this by using execa (see this PR: #1603). But now the repl is starting on every command. It seems that yargs is executing the asyncRepl.js file no matter what.
The only reason I abstracted the code to start the repl into another file was, you have to pass files to the node CLI: node --experimental-repl-await asyncRepl.js. Maybe you can just pass a giant string to be evaled (I didn't try) but that doesn't seem sustainable, especially once we add all the services to the repl's context.
@peterp at the contributor's meetup today, @mojombo suggested we resolve promises automatically. that could be a lot easier than enabling top-level await. I think we'd have to override the repl's eval, but there's examples for that.
to be more explicit, using the console would just be like:
Update (05.28.2021)
Right now we abstract away the need for top-level await in Redwood console by automatically resolving promises. This works but it'd I think it'd still be super nice to have top level await.
Original
Right now the console command requires the
NODE_OPTIONS
env var be set to--experimental-repl-await
. This isn't an ideal workflow, especially since the console command will be in the tutorial II, so I tried to fix this by using execa (see this PR: #1603). But now the repl is starting on every command. It seems that yargs is executing theasyncRepl.js
file no matter what.The only reason I abstracted the code to start the repl into another file was, you have to pass files to the node CLI:
node --experimental-repl-await asyncRepl.js
. Maybe you can just pass a giant string to be evaled (I didn't try) but that doesn't seem sustainable, especially once we add all the services to the repl's context.Another option is to hack the eval the repl uses: nodejs/node#13209 (comment).
Note that the console command breaks if the prisma client isn't generated. This definitely has to be fixed, but isn't the same problem.
The text was updated successfully, but these errors were encountered: