Open tyler-burkett opened 4 years ago
up :)
Hi all! đź‘‹ Is there any update on this? I do see there's a PR attached but is in draft now. I'm trying to use github actions to build and test my app, but it's not working since I cannot generate these files. Is there another way to have these files generated during a workflow in github? So far the Amplify auth service it's working fine but because it does have a headless interface.
I was trying to use an env variable for the app id inside of .graphqlconfig.yml
file and just run amplify codegen
in the action but doesn't seem to work neither, so I'm kinda stuck now.
Do you need anything besides code generation from Amplify?
You can use graphql-codegen
to generate TS types and React hooks, if that's what's the only thing you need.
I don't need more than code & types generation, but does that mean that I'll need to track graphql/schema.json
file? I'm not sure if I would want to track that file since its a large file, is there a way to get the file directly from amplify? like using an url?
Is your feature request related to a problem? Please describe. When setting up the build configuration for multiple frontend environments with a shared backend, I have the need to make the build process use
amplify pull
to get the most up-to-date metadata to connect to the backend (e.x. theaws-exports.js
file for a React webapp). However, to use any of the GraphQL statements generated byamplify codegen
, it seems like I need to store a copy of the statements in each one of the frontend repositories in order to use them. It would be preferable if I could generate the statements during/after pulling to reduce manually duplicating the same files across multiple repositories.Describe the solution you'd like I think either one of these proposed solutions would work, though the latter would most likely be easier to implement.
amplify pull
to generate the GraphQL statements if a GraphQL API is detected in the backend (possibly only on the first pull). Something likeAlong with the other prompts which appear when running
amplify codegen
. For headless mode, it would work similarly to how it does foramplify push
by providing a--codegen
flag to the command.amplify codegen add
a headless mode, similar to that suggested in aws-amplify/amplify-cli#2005 and aws-amplify/amplify-cli#852. This would allow for automated statement generation if I useamplify pull
to get the entire backend definition, which would include the schema. Alternatively, I could just include the schema file in each repository, which would at least minimize the number of files that need to be manually copied and maintained across each one.Describe alternatives you've considered
amplify pull
to get the entire backend definition and then usingamplify push --codegen
in headless mode. This doesn't work in this case since just pulling the backend means there are no changes and thusamplify push
doesn't run. Even if it did, it wouldn't be ideal to allow the build process to potentially change the backend since it doesn't need to do so.