File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -63,16 +63,27 @@ export function makeDirIfNotExists(dir: string): void {
63
63
}
64
64
}
65
65
66
+ export function buildFixedPath ( dir : string , provider ?: string ) : string {
67
+ const dirArray = provider ?. replace ( / \\ / g, '/' ) . includes ( '/' )
68
+ ? provider ?. replace ( / \\ / g, '/' ) . split ( '/' )
69
+ : [ ]
70
+ return path . normalize (
71
+ `${ dir } /${ dirArray . slice ( 0 , dirArray . length - 1 ) . join ( '/' ) } `
72
+ )
73
+ }
74
+
66
75
export function writeGraphqlSchemaToFile (
67
76
dirPath : string ,
68
77
schema : string ,
69
78
provider ?: string
70
79
) : void {
71
- makeDirIfNotExists ( dirPath )
80
+ makeDirIfNotExists ( buildFixedPath ( dirPath , provider ) )
72
81
fs . writeFileSync (
73
- path . join (
74
- dirPath ,
75
- provider ? `/${ provider } _schema.graphql` : '/schema.graphql'
82
+ path . normalize (
83
+ path . join (
84
+ dirPath ,
85
+ provider ? `/${ provider } _schema.graphql` : '/schema.graphql'
86
+ )
76
87
) ,
77
88
schema
78
89
)
You can’t perform that action at this time.
0 commit comments