Skip to content

Commit 4191b07

Browse files
committed
fix: Rename files in proper order and don't replace tokens in initialization script
1 parent 29a348d commit 4191b07

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

_InitializeRepository.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ Begin
6666
[string] $moduleManifestFilePath = "$moduleDirectoryPath\__NewModuleName__.psd1"
6767
[string] $moduleTestsFilePath = "$moduleDirectoryPath\__NewModuleName__.Tests.ps1"
6868

69-
if (Test-Path -Path $moduleDirectoryPath -PathType Container)
70-
{
71-
Rename-Item -Path $moduleDirectoryPath -NewName $moduleName -Force
72-
}
73-
7469
if (Test-Path -Path $moduleFilePath -PathType Leaf)
7570
{
7671
Rename-Item -Path $moduleFilePath -NewName "$moduleName.psm1" -Force
@@ -85,11 +80,17 @@ Begin
8580
{
8681
Rename-Item -Path $moduleTestsFilePath -NewName "$moduleName.Tests.ps1" -Force
8782
}
83+
84+
# Rename the directory last.
85+
if (Test-Path -Path $moduleDirectoryPath -PathType Container)
86+
{
87+
Rename-Item -Path $moduleDirectoryPath -NewName $moduleName -Force
88+
}
8889
}
8990

9091
function Set-TemplateTokenValuesInAllRepoFiles([string] $moduleName, [string] $organizationName)
9192
{
92-
$repositoryFiles = Get-ChildItem -Path $RepositoryRoot -Recurse -File
93+
$repositoryFiles = Get-ChildItem -Path $RepositoryRoot -Recurse -File -Exclude '_InitializeRepository.ps1'
9394
foreach ($file in $repositoryFiles)
9495
{
9596
$filePath = $file.FullName

0 commit comments

Comments
 (0)