You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be possible to utilize the existing App cmdlets and react client-side JavaScript to produce a static site generator with PSU. You could either host it in PSU or export it into a deployable ZIP that just contained the react app and one or more JSON files from the output of the cmdlets.
Static sites wouldn't support any interaction from PowerShell but could actually load data in a chunked manner to improve performance. Some components wouldn't make sense to provide in static sites (e.g. UDDataGrid) but it would be possible to inject a bit of JavaScript using New-UDEndpoint to allow basic interactivity from a client-side level.
PSU Hosting
In PSU, you could mark an app as static. The editor would load some custom PSScriptAnalyzer rules to ensure that users are aware of which cmdlets won't work. When the app is "started", it will just generate one or more JSON files that contain the output from the New-UD* cmdlets. PSU already hosts the React app, so it would just serve the JSON files rather than calling PowerShell at all.
If we built it right, you might be able to just call the PSU cmdlets without the server at all to generate the static site since the cmdlets already contain the React app.
There would then be a way to export the PSU app into a ZIP for hosting elsewhere.
External Hosting
Since static sites would just be JavaScript and JSON, it would be possible to host on very simple providers, like Azure Blob Storage. The ZIP could be extracted and served by these web servers without the need for any custom backend.
Caveats
Due to how PSU Apps are designed, it really wouldn't be a true static site, in terms of SEO. PSU Apps call back to the serve to get more data. Usually, this is done with PowerShell but in a static PSU app, it would just return JSON. Since this JSON isn't standard HTML until the JS renders it, web crawlers wouldn't (easily) discover the document contents.
SEO is a valid concern along with caching and would potentially limit my personal use cases but would still be a very useful tool.
At $job[-1] we generate a lot of static reporting files from air-gapped environments: CSV; JSON; plain text; and Excel. In that scenario I want to define a "template" to generate a consistent artifact.
Summary of the new feature / enhancement
It would be possible to utilize the existing App cmdlets and react client-side JavaScript to produce a static site generator with PSU. You could either host it in PSU or export it into a deployable ZIP that just contained the react app and one or more JSON files from the output of the cmdlets.
Static sites wouldn't support any interaction from PowerShell but could actually load data in a chunked manner to improve performance. Some components wouldn't make sense to provide in static sites (e.g. UDDataGrid) but it would be possible to inject a bit of JavaScript using New-UDEndpoint to allow basic interactivity from a client-side level.
PSU Hosting
In PSU, you could mark an app as static. The editor would load some custom PSScriptAnalyzer rules to ensure that users are aware of which cmdlets won't work. When the app is "started", it will just generate one or more JSON files that contain the output from the
New-UD*
cmdlets. PSU already hosts the React app, so it would just serve the JSON files rather than calling PowerShell at all.If we built it right, you might be able to just call the PSU cmdlets without the server at all to generate the static site since the cmdlets already contain the React app.
There would then be a way to export the PSU app into a ZIP for hosting elsewhere.
External Hosting
Since static sites would just be JavaScript and JSON, it would be possible to host on very simple providers, like Azure Blob Storage. The ZIP could be extracted and served by these web servers without the need for any custom backend.
Caveats
Due to how PSU Apps are designed, it really wouldn't be a true static site, in terms of SEO. PSU Apps call back to the serve to get more data. Usually, this is done with PowerShell but in a static PSU app, it would just return JSON. Since this JSON isn't standard HTML until the JS renders it, web crawlers wouldn't (easily) discover the document contents.
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: