@constructive-io/graphql-codegen 2.28.0 → 2.28.2

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.
@@ -333,7 +333,6 @@ function buildDeleteMutationAST(config) {
333
333
  selectionSet: t.selectionSet({
334
334
  selections: [
335
335
  t.field({ name: 'clientMutationId' }),
336
- t.field({ name: 'deletedId' }),
337
336
  ],
338
337
  }),
339
338
  }),
@@ -415,10 +415,9 @@ function generateDeleteMutationHook(table, options = {}) {
415
415
  ]);
416
416
  const variablesInterface = t.tsInterfaceDeclaration(t.identifier(`${(0, utils_1.ucFirst)(mutationName)}MutationVariables`), null, null, variablesInterfaceBody);
417
417
  statements.push(t.exportNamedDeclaration(variablesInterface));
418
- const deletedPkProp = t.tsPropertySignature(t.identifier(`deleted${(0, utils_1.ucFirst)(pkField.name)}`), t.tsTypeAnnotation(t.tsUnionType([pkTypeAnnotation, t.tsNullKeyword()])));
419
418
  const clientMutationIdProp = t.tsPropertySignature(t.identifier('clientMutationId'), t.tsTypeAnnotation(t.tsUnionType([t.tsStringKeyword(), t.tsNullKeyword()])));
420
419
  const resultInterfaceBody = t.tsInterfaceBody([
421
- t.tsPropertySignature(t.identifier(mutationName), t.tsTypeAnnotation(t.tsTypeLiteral([clientMutationIdProp, deletedPkProp]))),
420
+ t.tsPropertySignature(t.identifier(mutationName), t.tsTypeAnnotation(t.tsTypeLiteral([clientMutationIdProp]))),
422
421
  ]);
423
422
  const resultInterface = t.tsInterfaceDeclaration(t.identifier(`${(0, utils_1.ucFirst)(mutationName)}MutationResult`), null, null, resultInterfaceBody);
424
423
  statements.push(t.exportNamedDeclaration(resultInterface));
@@ -57,8 +57,9 @@ export interface WriteOptions {
57
57
  }
58
58
  export declare function writeGeneratedFiles(files: GeneratedFile[], outputDir: string, subdirs: string[], options?: WriteOptions): Promise<WriteResult>;
59
59
  /**
60
- * Format generated files using oxfmt
61
- * Runs oxfmt on the output directory after all files are written
60
+ * Format generated files using prettier
61
+ * Runs prettier on the output directory after all files are written
62
+ * Uses bundled config with sensible defaults (singleQuote, trailingComma, etc.)
62
63
  */
63
64
  export declare function formatOutput(outputDir: string): {
64
65
  success: boolean;
@@ -395,7 +395,7 @@ async function writeGeneratedFiles(files, outputDir, subdirs, options = {}) {
395
395
  if (showProgress && isTTY) {
396
396
  process.stdout.write('\r' + ' '.repeat(40) + '\r');
397
397
  }
398
- // Format all generated files with oxfmt
398
+ // Format all generated files with prettier
399
399
  if (errors.length === 0) {
400
400
  if (showProgress) {
401
401
  console.log('Formatting generated files...');
@@ -412,27 +412,30 @@ async function writeGeneratedFiles(files, outputDir, subdirs, options = {}) {
412
412
  };
413
413
  }
414
414
  /**
415
- * Format generated files using oxfmt
416
- * Runs oxfmt on the output directory after all files are written
415
+ * Format generated files using prettier
416
+ * Runs prettier on the output directory after all files are written
417
+ * Uses bundled config with sensible defaults (singleQuote, trailingComma, etc.)
417
418
  */
418
419
  function formatOutput(outputDir) {
419
420
  // Resolve to absolute path for reliable execution
420
421
  const absoluteOutputDir = path.resolve(outputDir);
421
422
  try {
422
- // Find oxfmt binary from this package's node_modules/.bin
423
- // oxfmt is a dependency of @constructive-io/graphql-codegen
424
- const oxfmtPkgPath = require.resolve('oxfmt/package.json');
425
- const oxfmtDir = path.dirname(oxfmtPkgPath);
426
- const oxfmtBin = path.join(oxfmtDir, 'bin', 'oxfmt');
427
- (0, node_child_process_1.execSync)(`"${oxfmtBin}" "${absoluteOutputDir}"`, {
423
+ // Find prettier binary from this package's node_modules/.bin
424
+ // prettier is a dependency of @constructive-io/graphql-codegen
425
+ const prettierPkgPath = require.resolve('prettier/package.json');
426
+ const prettierDir = path.dirname(prettierPkgPath);
427
+ const prettierBin = path.join(prettierDir, 'bin', 'prettier.cjs');
428
+ // Use bundled config with sensible defaults
429
+ const configPath = path.join(__dirname, 'codegen-prettier.json');
430
+ (0, node_child_process_1.execSync)(`"${prettierBin}" --write --config "${configPath}" "${absoluteOutputDir}"`, {
428
431
  stdio: 'pipe',
429
432
  encoding: 'utf-8',
430
433
  });
431
434
  return { success: true };
432
435
  }
433
436
  catch (err) {
434
- // oxfmt may fail if files have syntax errors or if not installed
435
- const message = err instanceof Error ? err.message : 'Unknown error';
437
+ // prettier may fail if files have syntax errors or if not installed
438
+ const message = err instanceof Error ? err.message : String(err);
436
439
  return { success: false, error: message };
437
440
  }
438
441
  }
@@ -292,7 +292,6 @@ export function buildDeleteMutationAST(config) {
292
292
  selectionSet: t.selectionSet({
293
293
  selections: [
294
294
  t.field({ name: 'clientMutationId' }),
295
- t.field({ name: 'deletedId' }),
296
295
  ],
297
296
  }),
298
297
  }),
@@ -376,10 +376,9 @@ export function generateDeleteMutationHook(table, options = {}) {
376
376
  ]);
377
377
  const variablesInterface = t.tsInterfaceDeclaration(t.identifier(`${ucFirst(mutationName)}MutationVariables`), null, null, variablesInterfaceBody);
378
378
  statements.push(t.exportNamedDeclaration(variablesInterface));
379
- const deletedPkProp = t.tsPropertySignature(t.identifier(`deleted${ucFirst(pkField.name)}`), t.tsTypeAnnotation(t.tsUnionType([pkTypeAnnotation, t.tsNullKeyword()])));
380
379
  const clientMutationIdProp = t.tsPropertySignature(t.identifier('clientMutationId'), t.tsTypeAnnotation(t.tsUnionType([t.tsStringKeyword(), t.tsNullKeyword()])));
381
380
  const resultInterfaceBody = t.tsInterfaceBody([
382
- t.tsPropertySignature(t.identifier(mutationName), t.tsTypeAnnotation(t.tsTypeLiteral([clientMutationIdProp, deletedPkProp]))),
381
+ t.tsPropertySignature(t.identifier(mutationName), t.tsTypeAnnotation(t.tsTypeLiteral([clientMutationIdProp]))),
383
382
  ]);
384
383
  const resultInterface = t.tsInterfaceDeclaration(t.identifier(`${ucFirst(mutationName)}MutationResult`), null, null, resultInterfaceBody);
385
384
  statements.push(t.exportNamedDeclaration(resultInterface));
@@ -57,8 +57,9 @@ export interface WriteOptions {
57
57
  }
58
58
  export declare function writeGeneratedFiles(files: GeneratedFile[], outputDir: string, subdirs: string[], options?: WriteOptions): Promise<WriteResult>;
59
59
  /**
60
- * Format generated files using oxfmt
61
- * Runs oxfmt on the output directory after all files are written
60
+ * Format generated files using prettier
61
+ * Runs prettier on the output directory after all files are written
62
+ * Uses bundled config with sensible defaults (singleQuote, trailingComma, etc.)
62
63
  */
63
64
  export declare function formatOutput(outputDir: string): {
64
65
  success: boolean;
@@ -357,7 +357,7 @@ export async function writeGeneratedFiles(files, outputDir, subdirs, options = {
357
357
  if (showProgress && isTTY) {
358
358
  process.stdout.write('\r' + ' '.repeat(40) + '\r');
359
359
  }
360
- // Format all generated files with oxfmt
360
+ // Format all generated files with prettier
361
361
  if (errors.length === 0) {
362
362
  if (showProgress) {
363
363
  console.log('Formatting generated files...');
@@ -374,27 +374,30 @@ export async function writeGeneratedFiles(files, outputDir, subdirs, options = {
374
374
  };
375
375
  }
376
376
  /**
377
- * Format generated files using oxfmt
378
- * Runs oxfmt on the output directory after all files are written
377
+ * Format generated files using prettier
378
+ * Runs prettier on the output directory after all files are written
379
+ * Uses bundled config with sensible defaults (singleQuote, trailingComma, etc.)
379
380
  */
380
381
  export function formatOutput(outputDir) {
381
382
  // Resolve to absolute path for reliable execution
382
383
  const absoluteOutputDir = path.resolve(outputDir);
383
384
  try {
384
- // Find oxfmt binary from this package's node_modules/.bin
385
- // oxfmt is a dependency of @constructive-io/graphql-codegen
386
- const oxfmtPkgPath = require.resolve('oxfmt/package.json');
387
- const oxfmtDir = path.dirname(oxfmtPkgPath);
388
- const oxfmtBin = path.join(oxfmtDir, 'bin', 'oxfmt');
389
- execSync(`"${oxfmtBin}" "${absoluteOutputDir}"`, {
385
+ // Find prettier binary from this package's node_modules/.bin
386
+ // prettier is a dependency of @constructive-io/graphql-codegen
387
+ const prettierPkgPath = require.resolve('prettier/package.json');
388
+ const prettierDir = path.dirname(prettierPkgPath);
389
+ const prettierBin = path.join(prettierDir, 'bin', 'prettier.cjs');
390
+ // Use bundled config with sensible defaults
391
+ const configPath = path.join(__dirname, 'codegen-prettier.json');
392
+ execSync(`"${prettierBin}" --write --config "${configPath}" "${absoluteOutputDir}"`, {
390
393
  stdio: 'pipe',
391
394
  encoding: 'utf-8',
392
395
  });
393
396
  return { success: true };
394
397
  }
395
398
  catch (err) {
396
- // oxfmt may fail if files have syntax errors or if not installed
397
- const message = err instanceof Error ? err.message : 'Unknown error';
399
+ // prettier may fail if files have syntax errors or if not installed
400
+ const message = err instanceof Error ? err.message : String(err);
398
401
  return { success: false, error: message };
399
402
  }
400
403
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-codegen",
3
- "version": "2.28.0",
3
+ "version": "2.28.2",
4
4
  "description": "CLI-based GraphQL SDK generator for PostGraphile endpoints with React Query hooks",
5
5
  "keywords": [
6
6
  "graphql",
@@ -39,8 +39,8 @@
39
39
  "build:dev": "makage build --dev",
40
40
  "dev": "ts-node ./src/index.ts",
41
41
  "lint": "eslint . --fix",
42
- "fmt": "oxfmt",
43
- "fmt:check": "oxfmt --check",
42
+ "fmt": "prettier --write .",
43
+ "fmt:check": "prettier --check .",
44
44
  "test": "jest --passWithNoTests",
45
45
  "test:watch": "jest --watch",
46
46
  "example:codegen:sdk": "tsx src/cli/index.ts generate --config examples/multi-target.config.ts",
@@ -62,7 +62,7 @@
62
62
  "inflekt": "^0.3.0",
63
63
  "inquirerer": "^4.4.0",
64
64
  "jiti": "^2.6.1",
65
- "oxfmt": "^0.13.0"
65
+ "prettier": "^3.7.4"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@tanstack/react-query": "^5.0.0",
@@ -88,5 +88,5 @@
88
88
  "tsx": "^4.21.0",
89
89
  "typescript": "^5.9.3"
90
90
  },
91
- "gitHead": "ec2b5f644c479626305ef85a05a6e7105c2c58cd"
91
+ "gitHead": "b1665179fec45aef7cb4c7f4e5bcd6990d2d3bb7"
92
92
  }