Node's process.cwd() has different behaviour between unix OS's and Windows when the cwd is inside a symlink. This PR fixes this inconsistency by calling node's fs.realpathSync to follow the directory symlink and simulate unix's behaviour on Windows.
This incosistency causes patch-package to fail on Windows when it runs on a postinstall of a workspace package since yarn (and possibly other package managers as well) use symlinks to hoist packages to the root node_modules.
This PR also fixes the path comparison on the getAppRootPath, since Windows can have both \ and / path separators.
Node's
process.cwd()
has different behaviour between unix OS's and Windows when the cwd is inside a symlink. This PR fixes this inconsistency by calling node'sfs.realpathSync
to follow the directory symlink and simulate unix's behaviour on Windows.This incosistency causes patch-package to fail on Windows when it runs on a postinstall of a workspace package since yarn (and possibly other package managers as well) use symlinks to hoist packages to the root node_modules.
This PR also fixes the path comparison on the
getAppRootPath
, since Windows can have both\
and/
path separators.