Scripts/Set-ProjectNameForTemplate.ps1
function Set-ProjectNameForTemplate { [CmdletBinding()] Param( [string] [Parameter(Mandatory = $true)] $ProjectName, [string] [Parameter(Mandatory = $true)] $ProjectPath, [string] [Parameter(Mandatory = $true)] $Branch ) try { $global:devops_gitRepo = $ProjectName $global:devops_projectLocation = "$ProjectPath\Source" Set-Location -Path "$global:devops_projectLocation" ls Write-Host $global:devops_projectLocation Write-Host "Email - " $Email if ((Test-Path -Path "$global:devops_projectLocation")) { Set-Location -Path "$global:devops_projectLocation" git -c http.extraheader="AUTHORIZATION: bearer $global:gitToken" git checkout origin/$Branch --track $message = "Setting up PowerPlatform.DevOps Project" Write-Host $message Write-Host "Rename PowerPlatformDevOps.sln to $global:devops_gitRepo.sln" Rename-Item -Path $global:devops_projectLocation\PowerPlatformDevOps.sln -NewName "$global:devops_gitRepo.sln" Write-Host "Rename dot files" Rename-Item -Path $global:devops_projectLocation\file.gitignore -NewName ".gitignore" Rename-Item -Path $global:devops_projectLocation\file.artifactignore -NewName ".artifactignore" Rename-Item -Path $global:devops_projectLocation\file.gitattributes -NewName ".gitattributes" Rename-Item -Path $global:devops_projectLocation\SolutionTemplate\file.eslintrc.json -NewName ".eslintrc.json" Rename-Item -Path $global:devops_projectLocation\SolutionTemplate\file.prettierrc.json -NewName ".prettierrc.json" ls git add -A git commit -m "Set Project Name to $global:devops_gitRepo" git push origin } } catch { Write-Host "Error: $_" } } |