Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Commit

Permalink
fix(pluggable-widgets-tools): duplicate path separators on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Wesley committed Oct 21, 2021
1 parent 8a976c5 commit 3098a09
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -28,9 +28,7 @@ export function widgetTyping({ sourceDir }) {
await execShellCommand(
`npx pluggable-widgets-tools format:custom-files -- ${propsTypingFilePaths
.map(f =>
platform() === "win32"
? `${f.replace(/(?<=[/\\])([^/\\]* [^/\\]*)(?=[/\\])/g, '"$1"')}`
: `'"${f}"'`
platform() === "win32" ? duplicatePathSeparators(quoteFoldersWithSpaces(f)) : `'"${f}"'`
)
.join(" ")}`,
sourceDir
Expand All @@ -43,3 +41,10 @@ export function widgetTyping({ sourceDir }) {
async function runTransformation(sourceDir) {
return transformPackage(await fs.readFile(join(sourceDir, "package.xml"), { encoding: "utf8" }), sourceDir);
}

function duplicatePathSeparators(path) {
return path.replace(/(?<=[^/\\])([/\\])(?=[^/\\])/g, "$1$1");
}
function quoteFoldersWithSpaces(path) {
return path.replace(/(?<=[/\\])([^/\\]* [^/\\]*)(?=[/\\])/g, '"$1"');
}

0 comments on commit 3098a09

Please sign in to comment.