From 4e4372ba7cb3752edc4b48cd381bdc7b71a708f6 Mon Sep 17 00:00:00 2001 From: BWsix Date: Wed, 10 Aug 2022 20:53:20 +0800 Subject: [PATCH] fix: parse path returned from process.cwd() before using it --- src/utils/parseNameAndPath.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/parseNameAndPath.ts b/src/utils/parseNameAndPath.ts index 911fdde3cb..fb85bceb4a 100644 --- a/src/utils/parseNameAndPath.ts +++ b/src/utils/parseNameAndPath.ts @@ -1,3 +1,5 @@ +import pathModule from "path"; + /** * Parses the appName and its path from the user input. * Returns an array of [appName, path] where appName is the name put in the package.json and @@ -15,7 +17,8 @@ export const parseNameAndPath = (input: string) => { // If the user ran `npx create-t3-app .` or similar, the appName should be the current directory if (appName === ".") { - appName = process.cwd().split("/").pop(); + const parsedCwd = pathModule.resolve(process.cwd()); + appName = pathModule.basename(parsedCwd); } // If the first part is a @, it's a scoped package