From baba43ec1c328899500f361b7fa26fba5ca6b842 Mon Sep 17 00:00:00 2001 From: Nico Schett Date: Thu, 11 Jul 2024 16:04:24 +0200 Subject: [PATCH] fix: template branch cloning --- packages/pylon-cli/src/commands/new.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/pylon-cli/src/commands/new.ts b/packages/pylon-cli/src/commands/new.ts index b20a006..f6b9f5a 100644 --- a/packages/pylon-cli/src/commands/new.ts +++ b/packages/pylon-cli/src/commands/new.ts @@ -24,7 +24,7 @@ export default async ( logger.info(`🚀 Starting project creation: ${name}`) logger.info(`📁 Destination: ${rootPath}`) - logger.info(`🔖 Template: ${template.url}`, { + logger.info(`🔖 Template: ${template.url} on branch ${template.branch}`, { template }) @@ -60,9 +60,16 @@ export default async ( // Clone the template repository into the project directory logger.info(`Cloning template from ${template.url} into ${projectDir}`) - await Bun.$`git clone ${template.branch ? `-b ${template.branch}` : ''} ${ - template.url - } "${projectDir}" --single-branch` + + Bun.spawnSync([ + 'git', + 'clone', + template.branch ? '-b' : '', + template.branch || '', + template.url, + projectDir, + '--single-branch' + ]) // Remove the .git directory from the project directory logger.info('Removing existing .git directory')