I love this.
I create a multi-file structure such as :
dashboard.ps1 (Start the dashboard file located in src/Root.ps1)
- src
- src/pages (Each page is a PS1 file in the pages folder)
- src/Endpoints (Each endpoints is a PS1 file)
I had a small personal issue with the UDHotReloader because I couldn’t use it to update the endpoints the same way I was updating to the dashboard.
I came up with a solution for IIS where I use a modified UDHotReloader that will restart the designated web apppool instead of updating the dashboard when a file from the Endpoints folder is modified.
The core change is:
if ($event.SourceEventArgs.FullPath -like '*\Endpoints\*' ) {
Restart-WebAppPool -Name $event.MessageData.AppPool
} else {
Update-UDDashboard -Url $event.M$EessageData.Url -UpdateToken $event.MessageData.UpdateToken -FilePath $event.MessageData.Root
}
(You’ll also need to add the $Apppool variable to the function definition and to the MessageData of the Register-ObjectEvent section)
I am leaving the gist here for anyone interested: