Skip to content

Commit

Permalink
Updated to new PlatyPS version
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinvanhunen committed Nov 27, 2024
1 parent 9214ac4 commit f8bd8e8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
18 changes: 10 additions & 8 deletions build/Build-HelpFile.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$documentsFolder = [environment]::getfolderpath("mydocuments")
if($IsLinux -or $isMacOS)
{
$destinationFolder = "$HOME/.local/share/powershell/Modules/PnP.PowerShell"
$destinationFolder = "$HOME/.local/share/powershell/Modules"
} else {
$destinationFolder = "$documentsFolder/PowerShell/Modules/PnP.PowerShell"
$destinationFolder = "$documentsFolder/PowerShell/Modules"
}

$tempFolder = [System.IO.Path]::GetTempPath()
Expand All @@ -14,24 +14,26 @@ if($runsInAction -ne [String]::Empty)
# We are running in a GitHub Action
Write-Host "Installing PlatyPS"
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module PlatyPS -ErrorAction Stop
Install-Module -Name Microsoft.PowerShell.PlatyPS -AllowPrerelease -RequiredVersion 1.0.0-preview1
Write-Host "Generating external help"
New-ExternalHelp -Path ./documentation -OutputPath $tempFolder -Force
$mdFiles = Measure-PlatyPSMarkdown -Path ./documentation/*.md
$mdFiles | Import-MarkdownCommandHelp -Path {$_.FilePath} | Export-MamlCommandHelp -OutputFolder $tempFolder -Force
} else {
# We are running locally, check if platyps is installed
$modules = Get-Module -Name platyPS -ListAvailable
$modules = Get-Module -Name Microsoft.PowerShell.PlatyPS -ListAvailable
if($modules.Count -eq 0)
{
# Not installed
$choices = '&Yes','&No'
$install = $Host.UI.PromptForChoice("Install PlatyPS","We need the PowerShell PlatyPS module to generate documentation. Install this?",$choices, 1)
$install = $Host.UI.PromptForChoice("Install Microsoft.PowerShell.PlatyPS","We need the PowerShell Microsoft.PowerShell.PlatyPS module to generate documentation. Install this?",$choices, 1)
if($install -eq 0)
{
Install-Module -Name PlatyPS -ErrorAction Stop
Install-Module -Name Microsoft.PowerShell.PlatyPS -AllowPrerelease -RequiredVersion 1.0.0-preview1 -ErrorAction Stop
} else {
exit
}
}
Write-Host "Generating external help"
New-ExternalHelp -Path ./../documentation -OutputPath $destinationFolder -Force
$mdFiles = Measure-PlatyPSMarkdown -Path ./../documentation/*.md
$mdFiles | Import-MarkdownCommandHelp -Path {$_.FilePath} | Export-MamlCommandHelp -OutputFolder $destinationFolder -Force
}
13 changes: 10 additions & 3 deletions build/Build-Nightly.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@ if ($runPublish -eq $true) {

if ($IsLinux) {
$destinationFolder = "$documentsFolder/.local/share/powershell/Modules/PnP.PowerShell"
$helpfileDestinationFolder = "$documentsFolder/.local/share/powershell/Modules"
}
elseif ($IsMacOS) {
$destinationFolder = "~/.local/share/powershell/Modules/PnP.PowerShell"
$destinationFolder = "$HOME/.local/share/powershell/Modules/PnP.PowerShell"
$helpfileDestinationFolder = "$HOME/.local/share/powershell/Modules"
}
else {
$destinationFolder = "$documentsFolder/PowerShell/Modules/PnP.PowerShell"
$helpfileDestinationFolder = "$documentsFolder/PowerShell/Modules"
}

$corePath = "$destinationFolder/Core"
Expand Down Expand Up @@ -189,8 +192,12 @@ if ($runPublish -eq $true) {

Write-Host "Generating Documentation" -ForegroundColor Yellow
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module PlatyPS -ErrorAction Stop
New-ExternalHelp -Path ./documentation -OutputPath $destinationFolder -Force
Install-Module -Name Microsoft.PowerShell.PlatyPS -AllowPrerelease -RequiredVersion 1.0.0-preview1
Write-Host "Generating external help"
$mdFiles = Measure-PlatyPSMarkdown -Path ./documentation/*.md
$mdFiles | Import-MarkdownCommandHelp -Path {$_.FilePath} | Export-MamlCommandHelp -OutputFolder $helpfileDestinationFolder -Force
# Install-Module Microsoft.PlatyPS -ErrorAction Stop
# New-ExternalHelp -Path ./documentation -OutputPath $destinationFolder -Force

$apiKey = $("$env:POWERSHELLGALLERY_API_KEY")

Expand Down

0 comments on commit f8bd8e8

Please sign in to comment.