-
Notifications
You must be signed in to change notification settings - Fork 2
feat: create a codegen command #214
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
Conversation
Reviewer's Guide by SourceryThis pull request implements a new 'codegen' command in the CLI, enhances environment handling, and updates the connect command. It introduces GraphQL schema generation for different endpoints (Hasura, Portal, TheGraph) and improves the way environment variables are managed and written. Sequence diagram for the codegen command executionsequenceDiagram
actor User
participant CLI as CLI
participant CodegenCommand as CodegenCommand
participant GqltadaSpinner as GqltadaSpinner
participant Terminal as Terminal
participant LoadEnv as LoadEnv
User ->> CLI: Run codegen command
CLI ->> CodegenCommand: Execute codegenCommand()
CodegenCommand ->> Terminal: intro()
CodegenCommand ->> LoadEnv: loadEnv()
LoadEnv -->> CodegenCommand: env
CodegenCommand ->> GqltadaSpinner: gqltadaSpinner(env)
GqltadaSpinner -->> CodegenCommand: Codegen complete
CodegenCommand ->> Terminal: outro()
Sequence diagram for the updated connect commandsequenceDiagram
actor User
participant CLI as CLI
participant ConnectCommand as ConnectCommand
participant WriteEnvSpinner as WriteEnvSpinner
participant Terminal as Terminal
User ->> CLI: Run connect command
CLI ->> ConnectCommand: Execute connectCommand()
ConnectCommand ->> WriteEnvSpinner: writeEnvSpinner(env)
WriteEnvSpinner -->> ConnectCommand: Env written
ConnectCommand ->> Terminal: outro()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📦 Packages
|
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.
Hey @roderik - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Review instructions: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| * "development" | ||
| * ); | ||
| */ | ||
| export async function gqltadaSpinner(env: DotEnv) { |
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.
suggestion: Consider refactoring gqltadaCodegen to reduce repetition in the switch statement
You could create a configuration object that maps types to their respective settings, reducing the need for the switch statement and making it easier to add new types in the future.
export async function gqltadaSpinner(env: DotEnv) {
const typeConfigs = {
HASURA: { /* Hasura-specific config */ },
APOLLO: { /* Apollo-specific config */ },
// Add other types here
};
await gqltadaCodegen(typeConfigs[env.GQLTADA_TYPE] || {});
}
Summary by Sourcery
Add a new 'codegen' command to the CLI for generating GraphQL and REST types and queries. Enhance environment variable handling by allowing overrides and defaulting to 'development'. Update the CI workflow to refine the file pattern for version updates.
New Features:
Enhancements:
CI: