@constructive-io/graphql-codegen 2.28.1 → 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.
@@ -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
  }
@@ -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.1",
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": "b10f4573bc0daa50502a1a5ea8ba610e00c3996b"
91
+ "gitHead": "b1665179fec45aef7cb4c7f4e5bcd6990d2d3bb7"
92
92
  }