Skip to content

Commit e13cd76

Browse files
committed
feat: consolidate codegen test helper + runtime sub-export
#1: Move runCodegenAndLoad into @constructive-io/graphql-test - New codegen-helper.ts in graphql-test/src/ with full codegen pipeline - Supports both positional (GraphQLQueryFn) and object-style (GraphQLQueryFnObj) - Re-exports getDbConnections and types from pgsql-test for two-phase patterns - orm-test now imports from @constructive-io/graphql-test instead of local copy - Deleted local orm-test codegen-helper.ts #2: Add runtime sub-export to @constructive-io/graphql-query - New graphql-query/src/runtime/index.ts re-exports: - parseType, print from @0no-co/graphql.web - All gql-ast exports - GraphQLAdapter, GraphQLError, QueryResult types from graphql-types - Updated codegen templates (query-builder.ts, orm-client.ts) to import from @constructive-io/graphql-query/runtime instead of 3 separate packages - Updated codegen test snapshots and assertions to match new import paths
1 parent d172d10 commit e13cd76

16 files changed

Lines changed: 2869 additions & 7598 deletions

File tree

graphql/codegen/src/__tests__/codegen/__snapshots__/client-generator.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ import type {
108108
GraphQLAdapter,
109109
GraphQLError,
110110
QueryResult,
111-
} from '@constructive-io/graphql-types';
111+
} from '@constructive-io/graphql-query/runtime';
112112
113113
export type {
114114
GraphQLAdapter,
115115
GraphQLError,
116116
QueryResult,
117-
} from '@constructive-io/graphql-types';
117+
} from '@constructive-io/graphql-query/runtime';
118118
119119
/**
120120
* Default adapter that uses fetch for HTTP requests.

graphql/codegen/src/__tests__/codegen/client-generator.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('client-generator', () => {
7373
expect(result.content).toContain('buildCreateDocument');
7474
expect(result.content).toContain('buildUpdateDocument');
7575
expect(result.content).toContain('buildDeleteDocument');
76-
expect(result.content).toContain("import * as t from 'gql-ast'");
76+
expect(result.content).toContain("import * as t from '@constructive-io/graphql-query/runtime'");
7777
});
7878
});
7979

graphql/codegen/src/core/codegen/templates/orm-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import type {
1212
GraphQLAdapter,
1313
GraphQLError,
1414
QueryResult,
15-
} from '@constructive-io/graphql-types';
15+
} from '@constructive-io/graphql-query/runtime';
1616

1717
export type {
1818
GraphQLAdapter,
1919
GraphQLError,
2020
QueryResult,
21-
} from '@constructive-io/graphql-types';
21+
} from '@constructive-io/graphql-query/runtime';
2222

2323
/**
2424
* Default adapter that uses fetch for HTTP requests.

graphql/codegen/src/core/codegen/templates/query-builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* Any changes here will affect all generated ORM clients.
99
*/
1010

11-
import { parseType, print } from '@0no-co/graphql.web';
12-
import * as t from 'gql-ast';
11+
import { parseType, print } from '@constructive-io/graphql-query/runtime';
12+
import * as t from '@constructive-io/graphql-query/runtime';
1313
import type {
1414
ArgumentNode,
1515
EnumValueNode,

graphql/orm-test/__tests__/helpers/codegen-helper.ts

Lines changed: 0 additions & 141 deletions
This file was deleted.

graphql/orm-test/__tests__/mega-query.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { join } from 'path';
2020
import { getConnectionsObject, seed } from 'graphile-test';
2121
import type { GraphQLQueryFnObj, GraphQLResponse } from 'graphile-test';
2222
import { ConstructivePreset } from 'graphile-settings';
23-
import { runCodegenAndLoad } from './helpers/codegen-helper';
23+
import { runCodegenAndLoad } from '@constructive-io/graphql-test';
2424
import { GraphileTestAdapter } from './helpers/graphile-adapter';
2525

2626
jest.setTimeout(120000);

graphql/orm-test/__tests__/orm-m2n.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { getConnectionsObject, seed } from 'graphile-test';
1616
import type { GraphQLQueryFnObj } from 'graphile-test';
1717
import type { PgTestClient } from 'pgsql-test';
1818
import { ConstructivePreset } from 'graphile-settings';
19-
import { runCodegenAndLoad } from './helpers/codegen-helper';
19+
import { runCodegenAndLoad } from '@constructive-io/graphql-test';
2020
import { GraphileTestAdapter } from './helpers/graphile-adapter';
2121

2222
jest.setTimeout(120000);

graphql/orm-test/__tests__/postgis-spatial-relations.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { join } from 'path';
1717
import { getConnectionsObject, seed } from 'graphile-test';
1818
import type { GraphQLQueryFnObj } from 'graphile-test';
1919
import { ConstructivePreset } from 'graphile-settings';
20-
import { runCodegenAndLoad } from './helpers/codegen-helper';
20+
import { runCodegenAndLoad } from '@constructive-io/graphql-test';
2121
import { GraphileTestAdapter } from './helpers/graphile-adapter';
2222

2323
jest.setTimeout(120000);

graphql/orm-test/__tests__/postgis-spatial.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { join } from 'path';
2424
import { getConnectionsObject, seed } from 'graphile-test';
2525
import type { GraphQLQueryFnObj } from 'graphile-test';
2626
import { ConstructivePreset } from 'graphile-settings';
27-
import { runCodegenAndLoad } from './helpers/codegen-helper';
27+
import { runCodegenAndLoad } from '@constructive-io/graphql-test';
2828
import { GraphileTestAdapter } from './helpers/graphile-adapter';
2929

3030
jest.setTimeout(120000);

graphql/orm-test/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@0no-co/graphql.web": "^1.1.2",
1313
"@constructive-io/graphql-codegen": "workspace:^",
1414
"@constructive-io/graphql-query": "workspace:^",
15+
"@constructive-io/graphql-test": "workspace:^",
1516
"@constructive-io/graphql-types": "workspace:^",
1617
"@types/pg": "^8.18.0",
1718
"gql-ast": "workspace:^",

0 commit comments

Comments
 (0)