fix(providence-analytics): fix relative source path util for windows

This commit is contained in:
Joren Broekema 2020-12-07 20:12:01 +01:00
parent 9a7522f844
commit 3cd1cf95e0
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'providence-analytics': patch
---
Relative source path util take posix path for both full path and root path, to ensure the replace happens properly.

View file

@ -20,7 +20,7 @@ function isRelativeSourcePath(source) {
* @param {string} rootPath like '/path/to/repo'
*/
function toRelativeSourcePath(fullPath, rootPath) {
return toPosixPath(fullPath).replace(rootPath, '.');
return toPosixPath(fullPath).replace(toPosixPath(rootPath), '.');
}
module.exports = { isRelativeSourcePath, toRelativeSourcePath };