File tree 2 files changed +10
-1
lines changed
packages/graphql-codegen-cli/src/utils 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @graphql-codegen/cli ' : patch
3
+ ---
4
+
5
+ fix watcher unable to find highest common directory on Windows
Original file line number Diff line number Diff line change @@ -229,7 +229,11 @@ const findHighestCommonDirectory = async (files: string[]): Promise<string> => {
229
229
// e.g. mm.scan("/**/foo/bar").base -> "/" ; mm.scan("/foo/bar/**/fizz/*.graphql") -> /foo/bar
230
230
const dirPaths = files
231
231
. map ( filePath => ( isAbsolute ( filePath ) ? filePath : resolve ( filePath ) ) )
232
- . map ( patterned => mm . scan ( patterned ) . base ) ;
232
+ // mm.scan doesn't know how to handle Windows \ path separator
233
+ . map ( patterned => patterned . replace ( / \\ / g, '/' ) )
234
+ . map ( patterned => mm . scan ( patterned ) . base )
235
+ // revert the separators to the platform-supported ones
236
+ . map ( base => base . replace ( / \/ / g, sep ) ) ;
233
237
234
238
// Return longest common prefix if it's accessible, otherwise process.cwd()
235
239
return ( async ( maybeValidPath : string ) => {
You can’t perform that action at this time.
0 commit comments