File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,16 +63,27 @@ export function makeDirIfNotExists(dir: string): void {
6363 }
6464}
6565
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+
6675export function writeGraphqlSchemaToFile (
6776 dirPath : string ,
6877 schema : string ,
6978 provider ?: string
7079) : void {
71- makeDirIfNotExists ( dirPath )
80+ makeDirIfNotExists ( buildFixedPath ( dirPath , provider ) )
7281 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+ )
7687 ) ,
7788 schema
7889 )
You can’t perform that action at this time.
0 commit comments