diff --git a/src/utils/parseNameAndPath.ts b/src/utils/parseNameAndPath.ts index 97425828b9..911fdde3cb 100644 --- a/src/utils/parseNameAndPath.ts +++ b/src/utils/parseNameAndPath.ts @@ -2,6 +2,7 @@ * 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 * path is the path to the directory where the app will be created. + * If the appName is '.', the name of the directory will be used instead. * Handles the case where the input includes a scoped package name * in which case that is being parsed as the name, but not included as the path * e.g. dir/@mono/app => ["@mono/app", "dir/app"] @@ -12,6 +13,11 @@ export const parseNameAndPath = (input: string) => { let appName = paths[paths.length - 1]; + // If the user ran `npx create-t3-app .` or similar, the appName should be the current directory + if (appName === ".") { + appName = process.cwd().split("/").pop(); + } + // If the first part is a @, it's a scoped package const indexOfDelimiter = paths.findIndex((p) => p.startsWith("@")); if (paths.findIndex((p) => p.startsWith("@")) !== -1) {