Windows: Path normalisation for changedFiles/base path (TurboSnap) #881
Labels
bug
Classification: Something isn't working
CLI
needs triage
Tracking: Issue needs confirmation
Support Priority
Bug report
I faced the issue that the TurboSnap functionality is not detecting changed stories on windows while it works on Mac. I traced the issue and detected following bugs:
You can try it out by running node inside your repository and execute
Mac:
Windows:
but without the hard drive letter it works fine
Tracing this to the root issue:
const baseDir = storybookBaseDir ? posix(storybookBaseDir) : path.posix.relative(rootPath, '');
and this base dir behaves differently between Windows and Mac. The reason for this is that
rootPath
on Windows contains the hard drive letter (causing exactly the wrong relative path) as this path is not treated as an absolute path in posix due to not starting with '/'.getRepositoryRoot
which assumes to always have returned an absolute "posix" path, however the commandgit rev-parse --show-toplevel
returns a posix path but with hard disk drive letter, which causes the issue.Not sure whether there is other code as well that is affected by a similar issue.
Workaround:
Provide a relative --storybook-base-dir path (e.g., just "./") so that it works also on Windows
The text was updated successfully, but these errors were encountered: