Types/OpenPackage.Publisher/org.poshweb.op.ps1
|
<# .SYNOPSIS Publishes org.poshweb.op .DESCRIPTION Publishes a package summary. This will take create a static xrpc endpoint that returns a package summary. #> [CmdletBinding(PositionalBinding=$false)] param( # The destination path. By default _site. [Parameter(Position=0)] [string] $DestinationPath = './_site', # The namespace identifier. By default `org.poshweb.op` [Alias('NSID')] [ValidatePattern('(?>\.[^\.]+){3,}')] [string] $NamespaceIdentifier = 'org.poshweb.op', # One or more input packages. # If no packages is provided, will get the current directory as a package. [Parameter(ValueFromPipeline)] [Alias('Package')] [PSObject[]] $InputObject ) $allInput = @($input) if (-not $allInput -and $InputObject) { $allInput += $InputObject } if (-not $allInput) { $excludeWildCard = $DestinationPath -replace './', '*' -replace '$', '*' $allInput = @(Get-OpenPackage -FilePath . -Exclude $excludeWildCard) } if (-not $allInput) { return } $allInput = @(foreach ($in in $allInput) { if ($in.Package -is [IO.Packaging.Package]) { $in.Package } else { $in } }) $openPackageXrpc = $allInput | Format-OpenPackage -View org.poshweb.op $openPackageXrpcPath = Join-Path $DestinationPath "./xrpc/$NamespaceIdentifier/index.json" New-Item -ItemType File -Path $openPackageXrpcPath -Value ( $openPackageXrpc | ConvertTo-Json -Depth 10 ) -Force |