From 01dd87bdad12bb8da47cb5f9fd6060891cac5bc1 Mon Sep 17 00:00:00 2001 From: Thomas Knickman Date: Thu, 15 Aug 2024 09:48:46 -0400 Subject: [PATCH] fix(create-turbo): correct path usage (#9014) ### Description Don't use platform specific path separator when filtering the download from Github. ### Testing Instructions --- packages/turbo-utils/src/examples.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/turbo-utils/src/examples.ts b/packages/turbo-utils/src/examples.ts index d912807f72b87..d41eff1f4f26f 100644 --- a/packages/turbo-utils/src/examples.ts +++ b/packages/turbo-utils/src/examples.ts @@ -1,6 +1,6 @@ import { Stream } from "node:stream"; import { promisify } from "node:util"; -import { join, sep } from "node:path"; +import { join } from "node:path"; import { tmpdir } from "node:os"; import { createWriteStream, promises as fs } from "node:fs"; import { x as extract } from "tar"; @@ -123,7 +123,7 @@ export async function downloadAndExtractRepo( // old repository name is used to fetch the example. The tar download will work as it is redirected automatically, but the root directory of the extracted // example will be the new, renamed name instead of the name used to fetch the example. if (rootPath === null) { - const pathSegments = p.split(sep); + const pathSegments = p.split("/"); rootPath = pathSegments.length ? pathSegments[0] : null; } return p.startsWith(`${rootPath}${filePath ? `/${filePath}/` : "/"}`); @@ -149,7 +149,7 @@ export async function downloadAndExtractExample(root: string, name: string) { // old repository name is used to fetch the example. The tar download will work as it is redirected automatically, but the root directory of the extracted // example will be the new, renamed name instead of the name used to fetch the example. if (rootPath === null) { - const pathSegments = p.split(sep); + const pathSegments = p.split("/"); rootPath = pathSegments.length ? pathSegments[0] : null; }