Skip to content

Commit 209b7c2

Browse files
authored
Migration preset windows support (#378)
* Test Windows pathing * Improve missing tsconfig error message * Ensure consistency for import filepath * Test filepath * Revert "Test filepath" This reverts commit e008341. * Try sending OS-aware filepath to codegen engine * Split setup vs migrate codegen config for operaration migration * Remove prettier * Fix formatting and avoid prettier output to verify changes * Use positional param when running assert-e2e * Fix Windows pathing issue * Fix linting config * Add changeset * Revert ignored deps * Remove unncessary comment * Run yarn * Sync eslint config for projects
1 parent c3af3e9 commit 209b7c2

File tree

26 files changed

+340
-462
lines changed

26 files changed

+340
-462
lines changed

.changeset/dull-deers-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@eddeee888/gcg-operation-location-migration': patch
3+
---
4+
5+
Fix Windows support

.github/workflows/operation-location-migration-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
operation-location-migration-e2e:
99
strategy:
1010
matrix:
11-
os: [ubuntu-22.04] # TODO: test with windows
11+
os: [ubuntu-22.04, windows-latest]
1212
node-version: [18.x, 20.x, 22.x]
1313
runs-on: ${{ matrix.os }}
1414
defaults:

packages/operation-location-migration-e2e/project.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
"options": {
1111
"commands": [
1212
"nx test-setup operation-location-migration-e2e -c test-index-to-colocation",
13-
"nx graphql-codegen operation-location-migration-e2e --verbose -c test-index-to-colocation",
13+
"nx graphql-codegen operation-location-migration-e2e --verbose -c test-index-to-colocation-migrate",
1414
"nx test-setup operation-location-migration-e2e -c test-near-operation-file-to-colocation",
15-
"nx graphql-codegen operation-location-migration-e2e --verbose -c test-near-operation-file-to-colocation",
16-
"OUTPUT_PATTERN=\"{projectRoot}/src/**/*.ts\" bash packages/testing-utils/bin/assert-e2e.sh"
15+
"nx graphql-codegen operation-location-migration-e2e --verbose -c test-near-operation-file-to-colocation-migrate",
16+
"bash packages/testing-utils/bin/assert-e2e.sh \"{projectRoot}/src/**/*.ts\""
1717
],
1818
"parallel": false
1919
}
@@ -24,12 +24,14 @@
2424
"configurations": {
2525
"test-index-to-colocation": {
2626
"commands": [
27-
"tsx --tsconfig={projectRoot}/tsconfig.json {projectRoot}/src/test-index-to-colocation/testSetup.ts"
27+
"tsx --tsconfig={projectRoot}/tsconfig.json {projectRoot}/src/test-index-to-colocation/testSetup.ts",
28+
"nx graphql-codegen operation-location-migration-e2e --verbose -c test-index-to-colocation-setup"
2829
]
2930
},
3031
"test-near-operation-file-to-colocation": {
3132
"commands": [
32-
"tsx --tsconfig={projectRoot}/tsconfig.json {projectRoot}/src/test-near-operation-file-to-colocation/testSetup.ts"
33+
"tsx --tsconfig={projectRoot}/tsconfig.json {projectRoot}/src/test-near-operation-file-to-colocation/testSetup.ts",
34+
"nx graphql-codegen operation-location-migration-e2e --verbose -c test-near-operation-file-to-colocation-setup"
3335
]
3436
}
3537
}
@@ -38,11 +40,17 @@
3840
"executor": "@eddeee888/nx-graphql-code-generator:codegen",
3941
"options": {},
4042
"configurations": {
41-
"test-index-to-colocation": {
42-
"configFile": "{projectRoot}/src/test-index-to-colocation/codegen.mts"
43+
"test-index-to-colocation-setup": {
44+
"configFile": "{projectRoot}/src/test-index-to-colocation/codegen.setup.mts"
4345
},
44-
"test-near-operation-file-to-colocation": {
45-
"configFile": "{projectRoot}/src/test-near-operation-file-to-colocation/codegen.mts"
46+
"test-index-to-colocation-migrate": {
47+
"configFile": "{projectRoot}/src/test-index-to-colocation/codegen.migrate.mts"
48+
},
49+
"test-near-operation-file-to-colocation-setup": {
50+
"configFile": "{projectRoot}/src/test-near-operation-file-to-colocation/codegen.setup.mts"
51+
},
52+
"test-near-operation-file-to-colocation-migrate": {
53+
"configFile": "{projectRoot}/src/test-near-operation-file-to-colocation/codegen.migrate.mts"
4654
}
4755
},
4856
"dependsOn": ["prepare-e2e-modules"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { CodegenConfig } from '@graphql-codegen/cli';
2+
import { defineConfig } from '@eddeee888/gcg-operation-location-migration';
3+
4+
const config: CodegenConfig = {
5+
schema:
6+
'packages/operation-location-migration-e2e/src/test-index-to-colocation/**/*.graphqls',
7+
documents:
8+
'packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/*.graphql',
9+
generates: {
10+
'packages/operation-location-migration-e2e/src/test-index-to-colocation':
11+
defineConfig({
12+
tsConfigFilePath:
13+
'packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json',
14+
gqlTag: {
15+
name: 'graphql',
16+
importFrom: './gql',
17+
importType: 'relative',
18+
},
19+
hooksImportFrom: '@apollo/client/react',
20+
}),
21+
},
22+
};
23+
24+
export default config;

packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { CodegenConfig } from '@graphql-codegen/cli';
2+
3+
const config: CodegenConfig = {
4+
schema:
5+
'packages/operation-location-migration-e2e/src/test-index-to-colocation/**/*.graphqls',
6+
documents:
7+
'packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/*.graphql',
8+
generates: {
9+
'packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts':
10+
{
11+
plugins: [
12+
'typescript',
13+
'typescript-operations',
14+
'typescript-react-apollo',
15+
],
16+
},
17+
},
18+
};
19+
20+
export default config;

packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */
2-
import { useLazyQuery } from '@apollo/client/react';
3-
import { graphql } from '../gql';
2+
import { useLazyQuery } from "@apollo/client/react";
3+
import { graphql } from "../gql";
44

55
const MeDoc = graphql(`
6-
query Me {
7-
me {
8-
__typename
9-
}
6+
query Me {
7+
me {
8+
__typename
109
}
11-
`);
10+
}
11+
`)
1212

1313
export const MeComponent = () => {
1414
useLazyQuery(MeDoc);

packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */
2-
import { useQuery } from '@apollo/client/react';
3-
import { graphql } from '../gql';
2+
import { useQuery } from "@apollo/client/react";
3+
import { graphql } from "../gql";
44

55
const MeDoc = graphql(`
6-
query Me {
7-
me {
8-
__typename
9-
}
6+
query Me {
7+
me {
8+
__typename
109
}
11-
`);
10+
}
11+
`)
1212

1313
export const MeComponent = () => {
1414
useQuery(MeDoc, { skip: true });

packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */
2-
import { useSuspenseQuery } from '@apollo/client/react';
3-
import { graphql } from '../gql';
2+
import { useSuspenseQuery } from "@apollo/client/react";
3+
import { graphql } from "../gql";
44

55
const MeDoc = graphql(`
6-
query Me {
7-
me {
8-
__typename
9-
}
6+
query Me {
7+
me {
8+
__typename
109
}
11-
`);
10+
}
11+
`)
1212

1313
export const MeComponent = () => {
1414
useSuspenseQuery(MeDoc);

packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */
22

33
import { useMeLazyQuery } from '../generated/hooks.generated';
4-
import { useQuery, useSuspenseQuery, useMutation } from '@apollo/client/react';
5-
import { graphql } from '../gql';
4+
import { useQuery, useSuspenseQuery, useMutation } from "@apollo/client/react";
5+
import { graphql } from "../gql";
66

77
const UpdateUserDoc = graphql(`
8-
mutation UpdateUser($input: UpdateUserInput!) {
9-
updateUser(input: $input) {
10-
id
11-
name
12-
}
8+
mutation UpdateUser($input: UpdateUserInput!) {
9+
updateUser(input: $input) {
10+
id
11+
name
1312
}
14-
`);
13+
}
14+
`)
1515

1616
const MeDoc = graphql(`
17-
query Me {
18-
me {
19-
__typename
20-
}
17+
query Me {
18+
me {
19+
__typename
2120
}
22-
`);
21+
}
22+
`)
2323

2424
export const UserComponent = () => {
2525
useQuery(MeDoc, { onCompleted: () => {} });

0 commit comments

Comments
 (0)