Skip to content

Commit

Permalink
Fix create tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto committed Aug 22, 2024
1 parent 190958c commit c6bb5e5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions programs/create/steps/import-external-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ export async function importExternalTemplate(
templatePath = path.join(installationPath, templateName)
}

// Copy the contents of the template to the desired project path
await fs.cp(templatePath, projectPath, {recursive: true})
// Ensure we're not trying to copy the template into itself
if (templatePath !== projectPath) {
// Copy the contents of the template to the desired project path
await fs.cp(templatePath, projectPath, {recursive: true})

// Remove the original template directory
await fs.rm(templatePath, {recursive: true, force: true})
// Remove the original template directory
await fs.rm(templatePath, {recursive: true, force: true})
}
} catch (error: any) {
console.error(
messages.installingFromTemplateError(projectName, templateName, error)
Expand Down

0 comments on commit c6bb5e5

Please sign in to comment.