From e476a978a442fe0aa305923a76bab40c772538e6 Mon Sep 17 00:00:00 2001 From: Jits Date: Wed, 1 Nov 2023 14:21:46 +0000 Subject: [PATCH] fix(init): handle init in current directory (when using pnpm) Fixes #213 --- src/commands/init.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commands/init.ts b/src/commands/init.ts index 3612a5cb..c48b66af 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -110,9 +110,12 @@ export default defineCommand({ }) // Get relative project path - const relativeProjectPath = relative(process.cwd(), template.dir) + let relativeProjectPath = relative(process.cwd(), template.dir) + if (relativeProjectPath === '') { + relativeProjectPath = '.'; + } - // Write .nuxtrc with `shamefully-hoist=true` for pnpm + // Write .npmrc with `shamefully-hoist=true` for pnpm if (selectedPackageManager === 'pnpm') { await writeFile(`${relativeProjectPath}/.npmrc`, 'shamefully-hoist=true') }