build2.ps1
# Set the path to your .psd1 manifest $psd1Path = ".\OMG.PSUtilities.psd1" $IncreaseModuleVersion = $true # Get all public function names (from Public\*.ps1) $functions = ( Get-ChildItem -Path ".\Public\*.ps1" | ForEach-Object { "'$($_.BaseName)'" } ) -join ",`n " # Proper replacement block with closing ) $replacement = "FunctionsToExport = @(`n $functions`n )" # Read current psd1 content $psd1Content = Get-Content $psd1Path -Raw # Replace the FunctionsToExport block $updatedContent = $psd1Content -replace "(?s)FunctionsToExport\s*=\s*@\([^\)]*\)", $replacement #Increase the module version if ($updatedContent -match "ModuleVersion\s*=\s*'(\d+)\.(\d+)\.(\d+)'" -and $IncreaseModuleVersion) { $major = [int]$matches[1] $minor = [int]$matches[2] $patch = [int]$matches[3] + 1 $newVersion = "$major.$minor.$patch" # Replace the line with the updated version $updatedContent = $updatedContent -replace "ModuleVersion\s*=\s*'\d+\.\d+\.\d+'", "ModuleVersion = '$newVersion'" Write-Host "✅ Module version updated to $newVersion" } else { Write-Warning "⚠️ ModuleVersion not found in the .psd1 file." } # Save updated content Set-Content -Path $psd1Path -Value $updatedContent -Encoding utf8 Write-Host "✅ FunctionsToExport updated in $psd1Path" #Review the changes made in the module's files and folders and update accordingly: # 1. Update the changelog.md with the new version and features. # 2. Update the README.md to reflect the new and revised functions. # 3. Update the OMG.PSUtilities.psd1 with the new version and functions # 3. Update the plasterManifest.xml with the required updates to include the new and revised functions. # 4. Ensure the module manifest (OMG.PSUtilities.psd1) reflects the correct version, functions, and other metadata. # 5. Ensure the module exports are correctly defined in the OMG.PSUtilities.psd1. # 6. Ensure all functions have proper comment-based help and parameter documentation. # Please suggest if module is ready for publish? |