From 9eb2fb7e6138e197e69eb916577275011058422c Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Wed, 28 Aug 2024 16:27:16 +0200 Subject: [PATCH] feat: allow providing current directory ini `init` command --- packages/cli/src/commands/init/init.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/init/init.ts b/packages/cli/src/commands/init/init.ts index f4da03370..63892986a 100644 --- a/packages/cli/src/commands/init/init.ts +++ b/packages/cli/src/commands/init/init.ts @@ -166,7 +166,7 @@ async function setProjectDirectory( try { if (deleteDirectory) { - fs.removeSync(directory); + fs.emptyDirSync(directory); } fs.mkdirSync(directory, {recursive: true}); @@ -243,6 +243,10 @@ async function createFromTemplate({ // if the project with the name already has cache, remove the cache to avoid problems with pods installation cacheManager.removeProjectCache(projectName); + if (directory === '') { + directory = process.cwd(); + } + const projectDirectory = await setProjectDirectory( directory, String(replaceDirectory),