-
Notifications
You must be signed in to change notification settings - Fork 969
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
feature: Generate boilerplate to create RedwoodJS Realtime with GraphQL Live Queries or Subscriptions #8710
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this out and it's good. I've left a few questions and comments, none of them too serious.
packages/cli/src/commands/experimental/templates/liveQueries/auctions/auctions.ts.template
Show resolved
Hide resolved
...ages/cli/src/commands/experimental/templates/subscriptions/newMessage/newMessage.ts.template
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/experimental/templates/realtime.ts.template
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/experimental/generateRealtimeHandler.js
Outdated
Show resolved
Hide resolved
}, | ||
}, | ||
{ | ||
title: 'Adding Countdown example subscription ...', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have some sort of prompt or option to avoid generating the examples? I'm not that fussed about it just in case someone doesn't want the new sdls, services and subscriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Am implementing.
Oh can you confirm if this PR would close #8594? This one seems to supersede that one? |
@Josh-Walker-GM I think I have in all the suggestions, thanks! I am having problems building locally at the moment:
So, I have not been able to test my updates yet. I'll try to figure out why my build is not working properly, but if you have a chance to test with the latest and approve if ok, that would be a huge help. Thanks. |
I checked this out locally and didn't have any errors. I see CI is failing but I don't really know why straight away. I probably wasn't clear enough about the examples flag I wanted. I meant that the setup command should be able to not generate any examples. The flag you added was on the generate command. I was about to switch them over but realised the template file for import type { NewMessageChannel } from 'src/subscriptions/newMessage/newMessage' which is intrinsically linked to the examples. I'd be happy to approve if we switch the example flag from the generate to the setup command. If you feel it'll be too much of a pain to have the setup command not generate examples then I'd be happy to approve it in it's existing state given this is still 'experimental'. I don't think this should get held up on little details. Let's get it out and get people playing with it 🚀 |
Ok let me double check. I got distracted with the build error and perhaps didn’t think through |
Thanks for catching that. I intended it to the the setup command but the exp are all so named so similar I picked the wrong one :) As for
Yeah. Not ideal. I thin I will lease as is for now since the default behavior makes them. And then I can revisit with better regex of codemods to cleanup these templates if feedback shows. Added a few comments to clarify temporarily. @Josh-Walker-GM this look ok? |
This PR adds the ability to generate starter boilerplate to create a live query or a subscription for redwoodJS realtime with GraphQL.
Prerequisites and the the app is serverful (ie, uses the server file) and already has setup realtime via its setup command.
Note: This command is experimental.
Use
When run, you can chose from the options to stub out a Live Query or Subscription:
and prompted to:
Then generation proceeds:
Note: based on the event type selected, it will skip either LQ or Subscription templating.
After Generating
The command will generate basic, SDL, service resolvers, and subscription types/handling needed.
For subscription, instructions how to test are provided:
As well as for Live Queries: