@constructive-io/cli 6.1.6 → 6.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,24 +61,40 @@ cnc explorer --origin http://localhost:3000
61
61
  Generate TypeScript types, operations, and SDK from a GraphQL schema or endpoint.
62
62
 
63
63
  ```bash
64
- # From endpoint
65
- cnc codegen --endpoint http://localhost:5555/graphql --out ./codegen
64
+ # Generate React Query hooks from endpoint
65
+ cnc codegen --endpoint http://localhost:5555/graphql --output ./codegen --react-query
66
66
 
67
- # From database
68
- cnc codegen --database constructive_db --out ./codegen --verbose
67
+ # Generate ORM client from endpoint
68
+ cnc codegen --endpoint http://localhost:5555/graphql --output ./codegen --orm
69
+
70
+ # Generate both React Query hooks and ORM client
71
+ cnc codegen --endpoint http://localhost:5555/graphql --output ./codegen --react-query --orm
72
+
73
+ # From schema file
74
+ cnc codegen --schema-file ./schema.graphql --output ./codegen --react-query
75
+
76
+ # From database with schemas
77
+ cnc codegen --schemas public,app_public --output ./codegen --react-query
78
+
79
+ # From database with API names
80
+ cnc codegen --api-names my_api --output ./codegen --orm
69
81
  ```
70
82
 
71
83
  **Options:**
72
84
 
85
+ - `--config <path>` - Path to config file
73
86
  - `--endpoint <url>` - GraphQL endpoint URL
74
- - `--auth <token>` - Authorization header value (e.g., "Bearer 123")
75
- - `--out <dir>` - Output directory (default: graphql/codegen/dist)
87
+ - `--schema-file <path>` - Path to GraphQL schema file
88
+ - `--schemas <list>` - Comma-separated PostgreSQL schemas
89
+ - `--api-names <list>` - Comma-separated API names
90
+ - `--react-query` - Generate React Query hooks
91
+ - `--orm` - Generate ORM client
92
+ - `--output <dir>` - Output directory (default: ./codegen)
93
+ - `--authorization <token>` - Authorization header value
94
+ - `--browser-compatible` - Generate browser-compatible code (default: true)
76
95
  - `--dry-run` - Preview without writing files
77
96
  - `--verbose` - Verbose output
78
97
 
79
- - `--database <name>` - Database override for DB mode (defaults to PGDATABASE)
80
- - `--schemas <list>` - Comma-separated schemas (required unless using --endpoint)
81
-
82
98
  ### `cnc get-graphql-schema`
83
99
 
84
100
  Fetch or build GraphQL schema SDL.
@@ -9,20 +9,20 @@ Constructive GraphQL Codegen:
9
9
  Source Options (choose one):
10
10
  --config <path> Path to graphql-codegen config file
11
11
  --endpoint <url> GraphQL endpoint URL
12
- --schemaFile <path> Path to GraphQL schema file
12
+ --schema-file <path> Path to GraphQL schema file
13
13
 
14
14
  Database Options:
15
15
  --schemas <list> Comma-separated PostgreSQL schemas
16
- --apiNames <list> Comma-separated API names
16
+ --api-names <list> Comma-separated API names
17
17
 
18
18
  Generator Options:
19
- --reactQuery Generate React Query hooks (default)
19
+ --react-query Generate React Query hooks (default)
20
20
  --orm Generate ORM client
21
21
  --output <dir> Output directory (default: codegen)
22
22
  --authorization <token> Authorization header value
23
- --browserCompatible Generate browser-compatible code (default: true)
23
+ --browser-compatible Generate browser-compatible code (default: true)
24
24
  Set to false for Node.js with localhost DNS fix
25
- --dryRun Preview without writing files
25
+ --dry-run Preview without writing files
26
26
  --verbose Verbose output
27
27
 
28
28
  --help, -h Show this help message
@@ -42,22 +42,24 @@ exports.default = async (argv, prompter, _options) => {
42
42
  }
43
43
  // No config file - prompt for options using shared questions
44
44
  const answers = await prompter.prompt(argv, graphql_codegen_1.codegenQuestions);
45
+ // Convert kebab-case CLI args to camelCase for internal use
46
+ const camelized = (0, graphql_codegen_1.camelizeArgv)(answers);
45
47
  // Build db config if schemas or apiNames provided
46
- const db = (answers.schemas || answers.apiNames) ? {
47
- schemas: answers.schemas,
48
- apiNames: answers.apiNames,
48
+ const db = (camelized.schemas || camelized.apiNames) ? {
49
+ schemas: camelized.schemas,
50
+ apiNames: camelized.apiNames,
49
51
  } : undefined;
50
52
  const result = await (0, graphql_codegen_1.generate)({
51
- endpoint: answers.endpoint,
52
- schemaFile: answers.schemaFile,
53
+ endpoint: camelized.endpoint,
54
+ schemaFile: camelized.schemaFile,
53
55
  db,
54
- output: answers.output,
55
- authorization: answers.authorization,
56
- reactQuery: answers.reactQuery,
57
- orm: answers.orm,
58
- browserCompatible: answers.browserCompatible,
59
- dryRun: answers.dryRun,
60
- verbose: answers.verbose,
56
+ output: camelized.output,
57
+ authorization: camelized.authorization,
58
+ reactQuery: camelized.reactQuery,
59
+ orm: camelized.orm,
60
+ browserCompatible: camelized.browserCompatible,
61
+ dryRun: camelized.dryRun,
62
+ verbose: camelized.verbose,
61
63
  });
62
64
  (0, graphql_codegen_1.printResult)(result);
63
65
  };
@@ -1,4 +1,4 @@
1
- import { generate, findConfigFile, codegenQuestions, printResult, } from '@constructive-io/graphql-codegen';
1
+ import { generate, findConfigFile, codegenQuestions, printResult, camelizeArgv, } from '@constructive-io/graphql-codegen';
2
2
  const usage = `
3
3
  Constructive GraphQL Codegen:
4
4
 
@@ -7,20 +7,20 @@ Constructive GraphQL Codegen:
7
7
  Source Options (choose one):
8
8
  --config <path> Path to graphql-codegen config file
9
9
  --endpoint <url> GraphQL endpoint URL
10
- --schemaFile <path> Path to GraphQL schema file
10
+ --schema-file <path> Path to GraphQL schema file
11
11
 
12
12
  Database Options:
13
13
  --schemas <list> Comma-separated PostgreSQL schemas
14
- --apiNames <list> Comma-separated API names
14
+ --api-names <list> Comma-separated API names
15
15
 
16
16
  Generator Options:
17
- --reactQuery Generate React Query hooks (default)
17
+ --react-query Generate React Query hooks (default)
18
18
  --orm Generate ORM client
19
19
  --output <dir> Output directory (default: codegen)
20
20
  --authorization <token> Authorization header value
21
- --browserCompatible Generate browser-compatible code (default: true)
21
+ --browser-compatible Generate browser-compatible code (default: true)
22
22
  Set to false for Node.js with localhost DNS fix
23
- --dryRun Preview without writing files
23
+ --dry-run Preview without writing files
24
24
  --verbose Verbose output
25
25
 
26
26
  --help, -h Show this help message
@@ -40,22 +40,24 @@ export default async (argv, prompter, _options) => {
40
40
  }
41
41
  // No config file - prompt for options using shared questions
42
42
  const answers = await prompter.prompt(argv, codegenQuestions);
43
+ // Convert kebab-case CLI args to camelCase for internal use
44
+ const camelized = camelizeArgv(answers);
43
45
  // Build db config if schemas or apiNames provided
44
- const db = (answers.schemas || answers.apiNames) ? {
45
- schemas: answers.schemas,
46
- apiNames: answers.apiNames,
46
+ const db = (camelized.schemas || camelized.apiNames) ? {
47
+ schemas: camelized.schemas,
48
+ apiNames: camelized.apiNames,
47
49
  } : undefined;
48
50
  const result = await generate({
49
- endpoint: answers.endpoint,
50
- schemaFile: answers.schemaFile,
51
+ endpoint: camelized.endpoint,
52
+ schemaFile: camelized.schemaFile,
51
53
  db,
52
- output: answers.output,
53
- authorization: answers.authorization,
54
- reactQuery: answers.reactQuery,
55
- orm: answers.orm,
56
- browserCompatible: answers.browserCompatible,
57
- dryRun: answers.dryRun,
58
- verbose: answers.verbose,
54
+ output: camelized.output,
55
+ authorization: camelized.authorization,
56
+ reactQuery: camelized.reactQuery,
57
+ orm: camelized.orm,
58
+ browserCompatible: camelized.browserCompatible,
59
+ dryRun: camelized.dryRun,
60
+ verbose: camelized.verbose,
59
61
  });
60
62
  printResult(result);
61
63
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/cli",
3
- "version": "6.1.6",
3
+ "version": "6.1.7",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "Constructive CLI",
6
6
  "main": "index.js",
@@ -45,7 +45,7 @@
45
45
  "ts-node": "^10.9.2"
46
46
  },
47
47
  "dependencies": {
48
- "@constructive-io/graphql-codegen": "^3.2.0",
48
+ "@constructive-io/graphql-codegen": "^3.2.1",
49
49
  "@constructive-io/graphql-env": "^2.9.4",
50
50
  "@constructive-io/graphql-explorer": "^3.0.5",
51
51
  "@constructive-io/graphql-server": "^3.0.5",
@@ -76,5 +76,5 @@
76
76
  "postgres",
77
77
  "graphile"
78
78
  ],
79
- "gitHead": "6c33cfe4fcc43de961a33603989ffb8adbaecc09"
79
+ "gitHead": "013a736cd2b09d465697c58c1b807858129c16b5"
80
80
  }