Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions graphql/codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ interface GraphQLSDKConfigTarget {
// Generator flags
reactQuery?: boolean; // Generate React Query hooks (output: {output}/hooks)
orm?: boolean; // Generate ORM client (output: {output}/orm)
browserCompatible?: boolean; // Generate browser-compatible code (default: true)
// Set to false for Node.js with localhost DNS fix

// Table filtering (for CRUD operations from _meta)
tables?: {
Expand Down Expand Up @@ -683,6 +685,8 @@ Generator Options:
-t, --target <name> Target name in config file
-o, --output <dir> Output directory
-a, --authorization <token> Authorization header value
--browser-compatible Generate browser-compatible code (default: true)
Set to false for Node.js with localhost DNS fix
--skip-custom-operations Only generate table CRUD operations
--dry-run Preview without writing files
--keep-db Keep ephemeral database after generation (pgpm modes)
Expand Down
5 changes: 4 additions & 1 deletion graphql/codegen/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Generator Options:
-o, --output <dir> Output directory
-t, --target <name> Target name (for multi-target configs)
-a, --authorization <token> Authorization header value
--browser-compatible Generate browser-compatible code (default: true)
Set to false for Node.js with localhost DNS fix
--dry-run Preview without writing files
-v, --verbose Show detailed output

Expand Down Expand Up @@ -120,6 +122,7 @@ export const commands = async (
authorization: answers.authorization,
reactQuery: answers.reactQuery,
orm: answers.orm,
browserCompatible: answers.browserCompatible,
dryRun: answers.dryRun,
verbose: answers.verbose,
});
Expand All @@ -142,7 +145,7 @@ export const options: Partial<CLIOptions> = {
v: 'verbose',
},
boolean: [
'help', 'version', 'verbose', 'dry-run', 'react-query', 'orm', 'keep-db',
'help', 'version', 'verbose', 'dry-run', 'react-query', 'orm', 'keep-db', 'browser-compatible',
],
string: [
'config', 'endpoint', 'schema-file', 'output', 'target', 'authorization',
Expand Down
9 changes: 9 additions & 0 deletions graphql/codegen/src/cli/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface CodegenAnswers {
apiNames?: string[];
reactQuery?: boolean;
orm?: boolean;
browserCompatible?: boolean;
authorization?: string;
dryRun?: boolean;
verbose?: boolean;
Expand Down Expand Up @@ -85,6 +86,14 @@ export const codegenQuestions: Question[] = [
default: false,
useDefault: true,
},
{
name: 'browserCompatible',
message: 'Generate browser-compatible code?',
type: 'confirm',
required: false,
default: true,
useDefault: true,
},
{
name: 'authorization',
message: 'Authorization header value',
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/commands/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Generator Options:
--orm Generate ORM client
--output <dir> Output directory (default: codegen)
--authorization <token> Authorization header value
--browserCompatible Generate browser-compatible code (default: true)
Set to false for Node.js with localhost DNS fix
--dryRun Preview without writing files
--verbose Verbose output

Expand Down Expand Up @@ -68,6 +70,7 @@ export default async (
authorization: answers.authorization,
reactQuery: answers.reactQuery,
orm: answers.orm,
browserCompatible: answers.browserCompatible,
dryRun: answers.dryRun,
verbose: answers.verbose,
});
Expand Down