Add --generate-graphql-schema CLI option#30
Open
dahlia wants to merge 2 commits into
Open
Conversation
[ci skip]
This adds a new mode to the drfed-server CLI that generates and outputs the GraphQL schema (via graphql's printSchema) instead of starting a server. The schema can be written to a file (--output-file) or printed to stdout (the default). Changes include: - Refactored the parser into separate serverParser and schemaGeneratorParser sub-parsers, combined via merge() and or() from @optique/core. - Extracted the server startup logic into a runServer() function. - Added runSchemaGenerator() that calls printSchema() and either writes to a file or prints to stdout. - Added a "generate:graphql-schema" mise task that runs the command and accepts an --output-file flag. - Added a "drfed-server" mise task for invoking the server directly. - Made graphql a catalog dependency in pnpm-workspace.yaml and referenced it from @drfed/drfed; updated @drfed/graphql to use the catalog reference as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The branch has two commits beyond the base:
npx skills add dahlia/optique, nothing to review.--generate-graphql-schemaCLI option to print the GraphQL schema”—the actual change. This is the only commit that needs review.This adds a new mode to
drfed-serverthat prints the compiled GraphQL schema (viagraphql'sprintSchema) instead of starting a server. You can write it to a file with--output-fileor print it to stdout (the default).The parser in packages/drfed/src/parser.ts was refactored into separate
serverParserandschemaGeneratorParsersub-parsers, merged throughmerge()andor()from Optique. The server startup logic moved into a dedicatedrunServer()function in packages/drfed/src/index.ts, and a newrunSchemaGenerator()function callsprintSchema()and handles the output. A mise.toml taskgenerate:graphql-schemaruns the command and accepts an--output-fileflag. Thegraphqlpackage was promoted to a catalog dependency in pnpm-workspace.yaml so both@drfed/drfedand@drfed/graphqlshare the same version.