@constructive-io/graphql-codegen 2.28.1 → 2.28.3
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,8 @@ 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
|
|
61
|
-
* Runs
|
|
60
|
+
* Format generated files using prettier
|
|
61
|
+
* Runs prettier on the output directory after all files are written
|
|
62
62
|
*/
|
|
63
63
|
export declare function formatOutput(outputDir: string): {
|
|
64
64
|
success: boolean;
|
package/cli/commands/generate.js
CHANGED
|
@@ -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
|
|
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,20 @@ async function writeGeneratedFiles(files, outputDir, subdirs, options = {}) {
|
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
414
|
/**
|
|
415
|
-
* Format generated files using
|
|
416
|
-
* Runs
|
|
415
|
+
* Format generated files using prettier
|
|
416
|
+
* Runs prettier on the output directory after all files are written
|
|
417
417
|
*/
|
|
418
418
|
function formatOutput(outputDir) {
|
|
419
|
-
// Resolve to absolute path for reliable execution
|
|
420
419
|
const absoluteOutputDir = path.resolve(outputDir);
|
|
421
420
|
try {
|
|
422
|
-
|
|
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}"`, {
|
|
421
|
+
(0, node_child_process_1.execSync)(`npx prettier --write --single-quote --trailing-comma all --tab-width 2 --semi "${absoluteOutputDir}"`, {
|
|
428
422
|
stdio: 'pipe',
|
|
429
423
|
encoding: 'utf-8',
|
|
430
424
|
});
|
|
431
425
|
return { success: true };
|
|
432
426
|
}
|
|
433
427
|
catch (err) {
|
|
434
|
-
|
|
435
|
-
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
428
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
436
429
|
return { success: false, error: message };
|
|
437
430
|
}
|
|
438
431
|
}
|
|
@@ -57,8 +57,8 @@ 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
|
|
61
|
-
* Runs
|
|
60
|
+
* Format generated files using prettier
|
|
61
|
+
* Runs prettier on the output directory after all files are written
|
|
62
62
|
*/
|
|
63
63
|
export declare function formatOutput(outputDir: string): {
|
|
64
64
|
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
|
|
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,20 @@ export async function writeGeneratedFiles(files, outputDir, subdirs, options = {
|
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
|
-
* Format generated files using
|
|
378
|
-
* Runs
|
|
377
|
+
* Format generated files using prettier
|
|
378
|
+
* Runs prettier on the output directory after all files are written
|
|
379
379
|
*/
|
|
380
380
|
export function formatOutput(outputDir) {
|
|
381
|
-
// Resolve to absolute path for reliable execution
|
|
382
381
|
const absoluteOutputDir = path.resolve(outputDir);
|
|
383
382
|
try {
|
|
384
|
-
|
|
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}"`, {
|
|
383
|
+
execSync(`npx prettier --write --single-quote --trailing-comma all --tab-width 2 --semi "${absoluteOutputDir}"`, {
|
|
390
384
|
stdio: 'pipe',
|
|
391
385
|
encoding: 'utf-8',
|
|
392
386
|
});
|
|
393
387
|
return { success: true };
|
|
394
388
|
}
|
|
395
389
|
catch (err) {
|
|
396
|
-
|
|
397
|
-
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
390
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
398
391
|
return { success: false, error: message };
|
|
399
392
|
}
|
|
400
393
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-codegen",
|
|
3
|
-
"version": "2.28.
|
|
3
|
+
"version": "2.28.3",
|
|
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": "
|
|
43
|
-
"fmt: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
|
-
"
|
|
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": "
|
|
91
|
+
"gitHead": "06cc06455356911bf9a24245849138892267b87d"
|
|
92
92
|
}
|