@@ -661,7 +661,7 @@ Filter patterns support wildcards:
661661
662662The CLI provides a convenient way to run code generation from the command line.
663663
664- ### ` graphql-sdk generate `
664+ ### ` graphql-codegen `
665665
666666Generate React Query hooks and/or ORM client from various sources.
667667
@@ -682,62 +682,57 @@ Database Options (for pgpm modes):
682682Generator Options:
683683 --react-query Generate React Query hooks
684684 --orm Generate ORM client
685- -t, --target < name> Target name in config file
686685 -o, --output < dir> Output directory
686+ -t, --target < name> Target name (for multi-target configs)
687687 -a, --authorization < token> Authorization header value
688688 --browser-compatible Generate browser-compatible code (default: true)
689689 Set to false for Node.js with localhost DNS fix
690690 --skip-custom-operations Only generate table CRUD operations
691691 --dry-run Preview without writing files
692- --keep-db Keep ephemeral database after generation (pgpm modes)
693692 -v, --verbose Show detailed output
694-
695- Watch Mode Options:
696- -w, --watch Watch for schema changes and regenerate
697- --poll-interval < ms> Polling interval in milliseconds (default: 5000)
698- --debounce < ms> Debounce delay in milliseconds (default: 500)
699- --touch < path> Touch file after regeneration
700- --no-clear Don' t clear console on regeneration
693+ --keep-db Keep ephemeral database after generation (pgpm modes)
694+ -h, --help Show help message
695+ --version Show version number
701696```
702697
703698Examples:
704699
705700``` bash
706701# Generate React Query hooks from an endpoint
707- npx graphql-sdk generate --endpoint https://api.example.com/graphql --output ./generated --react-query
702+ npx @constructive-io/ graphql-codegen --endpoint https://api.example.com/graphql --output ./generated --react-query
708703
709704# Generate ORM client from an endpoint
710- npx graphql-sdk generate --endpoint https://api.example.com/graphql --output ./generated --orm
705+ npx @constructive-io/ graphql-codegen --endpoint https://api.example.com/graphql --output ./generated --orm
711706
712707# Generate both React Query hooks and ORM client
713- npx graphql-sdk generate --endpoint https://api.example.com/graphql --output ./generated --react-query --orm
708+ npx @constructive-io/ graphql-codegen --endpoint https://api.example.com/graphql --output ./generated --react-query --orm
714709
715- # Generate from a PGPM module
716- npx graphql-sdk generate --pgpm-module-path ./packages/my-module --schemas public --react-query
710+ # Generate from schema file
711+ npx @constructive-io/ graphql-codegen --schema-file ./schema.graphql --output ./generated --react-query
717712
718- # Generate using apiNames for automatic schema discovery
719- npx graphql-sdk generate --pgpm-module-path ./packages/my-module --api-names my_api --react-query --orm
720- ```
713+ # Generate from database with schemas
714+ npx @constructive-io/graphql-codegen --schemas public,app_public --output ./generated --react-query
721715
722- ### `graphql-sdk init`
716+ # Generate from database with API names
717+ npx @constructive-io/graphql-codegen --api-names my_api --output ./generated --orm
723718
724- Create a configuration file.
719+ # Use config file
720+ npx @constructive-io/graphql-codegen --config ./graphql-codegen.config.ts
725721
726- ```bash
727- Options:
728- -f, --format <format> Config format: ts, js, json (default: ts)
729- -o, --output <path> Output path for config file
722+ # Generate specific target from multi-target config
723+ npx @constructive-io/graphql-codegen --config ./graphql-codegen.config.ts --target admin
730724```
731725
732- ### `graphql-sdk introspect`
726+ ### Using with Constructive CLI
733727
734- Inspect schema without generating code.
728+ The ` @constructive-io/cli ` package includes the codegen command:
735729
736730``` bash
737- Options:
738- -e, --endpoint <url> GraphQL endpoint URL
739- --json Output as JSON
740- -v, --verbose Show detailed output
731+ # Install Constructive CLI
732+ npm install -g @constructive-io/cli
733+
734+ # Run codegen via cnc
735+ cnc codegen --endpoint http://localhost:5555/graphql --output ./codegen --react-query
741736```
742737
743738## Architecture
0 commit comments