@@ -2,7 +2,8 @@ const graphQLConfig = require('graphql-config');
2
2
const { isAbsolute, relative, join } = require ( 'path' ) ;
3
3
const slash = require ( 'slash' ) ;
4
4
const { graphQlToAmplifyConfig } = require ( './utils' ) ;
5
- const fs = require ( 'fs-extra' ) ;
5
+ const fs = require ( 'fs-extra' ) ;
6
+ const path = require ( 'path' ) ;
6
7
7
8
class AmplifyCodeGenConfig {
8
9
static configFileName = '.graphqlconfig.yml' ;
@@ -15,10 +16,9 @@ class AmplifyCodeGenConfig {
15
16
if ( e instanceof graphQLConfig . ConfigNotFoundError ) {
16
17
const projectRoot = projectPath || process . cwd ( ) ;
17
18
const configPath = join ( projectRoot , '.graphqlconfig.yml' ) ;
18
- if ( fs . existsSync ( configPath ) ) {
19
+ if ( fs . existsSync ( configPath ) ) {
19
20
this . gqlConfig = graphQLConfig . getGraphQLConfig ( projectRoot ) ;
20
- }
21
- else {
21
+ } else {
22
22
this . gqlConfig = new graphQLConfig . GraphQLConfig ( null , configPath ) ;
23
23
this . gqlConfig . config = { } ;
24
24
}
@@ -45,7 +45,11 @@ class AmplifyCodeGenConfig {
45
45
if ( ! this . constructor . isValidAmplifyProject ( project ) ) {
46
46
return false ;
47
47
}
48
- const schemaPath = isAbsolute ( project . schema ) ? relative ( this . gqlConfig . configDir , project . schema ) : project . schema ;
48
+ // Set schemaPath to use posix separators. Node can handle windows and posix separators regradless of platform
49
+ // Ensures all paths in .graphlqconfig.yml use posix style
50
+ const schemaPath = ( isAbsolute ( project . schema ) ? relative ( this . gqlConfig . configDir , project . schema ) : project . schema )
51
+ . split ( path . win32 . sep )
52
+ . join ( path . posix . sep ) ;
49
53
const newProject = {
50
54
schemaPath,
51
55
includes : project . includes ,
0 commit comments