Nulah.PowerShell/PowershellModule/build/build.ps1
Scott 274d279732 feat: Add Get-Calendar command and Debug harnesses
- add Get-Calendar command
- add initial debug harness for local debug
2026-07-19 00:32:32 +00:00

48 lines
1.9 KiB
PowerShell

param (
[switch] $release
)
$wdir = $PSScriptRoot
$module = "PowershellModule"
$output = "$wdir/$module"
if (Test-Path $output)
{
Remove-Item $output -Recurse
}
New-Item $output -ItemType Directory
# copy the built dlls to this directory
if($release){
# For release we'll get a bunch of dependencies that we honestly do not need.
# This module is built to run assuming the dotnet 10 runtime exists, and powershell is 7.6 or higher,
# because of this we really don't need the system.* dlls that come with the publish, or the random ass
# newtonsoft.json.dll that comes from ???? publish fucking sucks for libraries even with framework-dependent
# selected as the publish option
Copy-Item -Path "$( $wdir )\..\bin\Release\net10.0\publish\$module.dll" -Destination $output
Copy-Item -Path "$( $wdir )\..\bin\Release\net10.0\publish\ModuleCore.dll" -Destination $output
} else
{
Copy-Item -Path "$( $wdir )\..\bin\Debug\net10.0\*.dll" -Destination $output
}
#Copy-Item -Path "$( $wdir )\..\bin\Debug\netstandard2.1\*.dll" -Destination $output
$manifestSplat = @{
Path = "$output/$module.psd1"
Author = 'Me'
# technically we only need the base module here and it'll locate any dlls it needs
NestedModules = @("$module.dll")#(Get-ChildItem "$output/*.dll" | Select-Object { $_.Name } -ExpandProperty Name)
RootModule = "$module.psm1"
# FunctionsToExport = @('Get-Calendar')
CmdletsToExport = @('Get-Calendar')
# These should all be empty arrays - otherwise they default to wildcard which the generated psd1 will helpfully
# tell you not to do for performance reasons, as the fallback if these are left out is to use wildcard...
FunctionsToExport = @()
VariablesToExport = @()
AliasesToExport = @()
}
New-ModuleManifest @manifestSplat
# We don't actually need content here, it's just so PowerShell has an entry point
New-Item "$output/$module.psm1" -ItemType File