Skip to content

Commit

Permalink
feat: Group --server and --render as --render
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmil committed May 25, 2024
1 parent e05e48d commit 40207bf
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 75 deletions.
43 changes: 23 additions & 20 deletions .build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,41 @@ let buildOutputDir = slnDir </> "build"
let packageName = "Bolero.Templates"
let packageOutputFile o = buildOutputDir </> $"{packageName}.{version o}.nupkg"
let variantsToTest =
let serverModes = [
("LegacyWasm","LegacyWebAssembly")
("LegacyServer","LegacyServer")
("IntServer", "InteractiveServer")
("IntWasm", "InteractiveWebAssembly")
("IntAuto", "InteractiveAuto")
]
[
for pwak, pwav in [("Pwa", "true"); ("NoPwa", "false")] do
// Server
for hostk, hostv in [("Bolero", "bolero"); ("Razor", "razor"); ("Html", "html")] do
for minik, miniv in [("Minimal", "true"); ("Full", "false")] do
for htmlk, reloadv, htmlv in [("Reload", "true", "true"); ("NoReload", "false", "true"); ("NoHtml", "false", "false")] do
for minik, miniv in [("Minimal", "true"); ("Full", "false")] do
if not (miniv = "true" && htmlv = "true") then
$"{minik}.Server{hostk}.{htmlk}.{pwak}", [
"--server"
$"--minimal={miniv}"
$"--hostpage={hostv}"
$"--pwa={pwav}"
$"--html={htmlv}"
$"--hotreload={reloadv}"
]
if (hostv = "bolero") then
for renderk, renderv in [("IntServer", "InteractiveServer");("IntWasm", "InteractiveWebAssembly");("IntAuto", "InteractiveAuto");] do
if not (miniv = "true" && htmlv = "true") then
for renderk, renderv in serverModes do
if renderv.StartsWith("Legacy") then
for hostk, hostv in [("Bolero", "bolero"); ("Razor", "razor"); ("Html", "html")] do
$"{minik}.{renderk}.{hostk}.{htmlk}.{pwak}", [
"--server"
$"--minimal={miniv}"
$"--hostpage={hostv}"
$"--pwa={pwav}"
$"--html={htmlv}"
$"--hotreload={reloadv}"
$"--render={renderv}"
]
// Client
for htmlk, htmlv in [("Html", "true"); ("NoHtml", "false")] do
for minik, miniv in [("Minimal", "true"); ("Full", "false")] do
else
$"{minik}.{renderk}.{htmlk}.{pwak}", [
$"--minimal={miniv}"
$"--pwa={pwav}"
$"--html={htmlv}"
$"--hotreload={reloadv}"
$"--render={renderv}"
]
for htmlk, htmlv in [("Html", "true"); ("NoHtml", "false")] do
if not (miniv = "true" && htmlv = "true") then
$"{minik}.NoServer.{htmlk}.{pwak}", [
"--server=false"
$"{minik}.Wasm.{htmlk}.{pwak}", [
"--render=WebAssembly"
$"--minimal={miniv}"
$"--pwa={pwav}"
$"--html={htmlv}"
Expand Down
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## 0.24

* [#50](https://github.com/fsbolero/Template/issues/50) Add option `--render` to decide the render mode. Possible values are:
* `Server` for classic server-side mode.
* `WebAssembly` for classic client-side mode.
* [#50](https://github.com/fsbolero/Template/issues/50) Replace option `--server` with `--render` to decide the render mode. Possible values are:
* `LegacyServer` for classic server-side mode.
* `LegacyWebAssembly` for classic client-side mode.
* `WebAssembly` for client-only WebAssembly mode without a server project.
* `InteractiveServer` for server-side interactive render mode (see https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0).
* `InteractiveWebAssembly` for client-side interactive render mode.
* `InteractiveAuto` for automatic interactive render mode (client-side if available, otherwise server-side while downloading the client-side runtime in the background).
Expand Down
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,33 @@ You can use the following options to customize the project being created:

If `false` (the default), the created project includes Bolero features such as routed pages, HTML templates and remoting.

* `--server`, `-s`:

If `true` (the default), the solution includes a `Server` project, which is an ASP.NET Core server that hosts the application.

If `false`, the solution only contains the `Client` project that is compiled to WebAssembly.

* `--hostpage`, `-hp`:
* `--render`, `-r`:

Determines how the server-side HTML page content is written. Can be one of:
Determines the render mode. Can be one of:

* `bolero`: using Bolero.Html functions.
* `InteractiveWebAssembly` (the default) for client-side interactive render mode.

* `razor`: using a dynamically-compiled Razor page.
* `InteractiveServer` for server-side interactive render mode (see https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0).

* `html`: using a plain .html file.
* `InteractiveAuto` for automatic interactive render mode (client-side if available, otherwise server-side while downloading the client-side runtime in the background).

This is ignored if `server=false`.
* `WebAssembly` for client-only WebAssembly without a server project.

* `--render`, `-r`:
* `LegacyServer` for classic (pre-.NET 8) server-side mode.

Determines the render mode. Can be one of:
* `LegacyWebAssembly` for classic (pre-.NET 8) client-side mode.

* `Server` for classic server-side mode.
* `--hostpage`, `-hp`:

* `WebAssembly` for classic client-side mode.
Determines how the server-side HTML page content is written for `LegacyServer`. Can be one of:

* `InteractiveServer` for server-side interactive render mode (see https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0).
* `bolero` (the default): using Bolero.Html functions.

* `InteractiveWebAssembly` for client-side interactive render mode.
* `razor`: using a dynamically-compiled Razor page.

* `InteractiveAuto` for automatic interactive render mode (client-side if available, otherwise server-side while downloading the client-side runtime in the background).
* `html`: using a plain .html file.

This is ignored if `server=false`. Moreover, the `Interactive*` render modes are only compatible with `hostpage=bolero`.
This is ignored if `render` is not `LegacyServer`.

* `--html`, `-ht`:

Expand Down
63 changes: 31 additions & 32 deletions content/application/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,26 @@
"dataType": "bool",
"defaultValue": "false"
},
"server": {
"type": "parameter",
"isRequired": false,
"description": "Include an ASP.NET Core server-side host",
"dataType": "bool",
"defaultValue": "true"
},
"html": {
"type": "parameter",
"isRequired": false,
"description": "Use HTML templates (ignored if minimal=true)",
"dataType": "bool",
"defaultValue": "true"
},
"hotreload": {
"render": {
"type": "parameter",
"isRequired": false,
"description": "Include hot reload for HTML templates (ignored if html=false or server=false)",
"dataType": "bool",
"defaultValue": "true"
"description": "The type of rendering to use",
"dataType": "choice",
"replaces": "RENDER_MODE",
"choices": [
{"choice":"WebAssembly","description":"WebAssembly only (no server project)"},
{"choice":"InteractiveServer","description":"InteractiveServer render mode"},
{"choice":"InteractiveWebAssembly","description":"InteractiveWebAssembly render mode"},
{"choice":"InteractiveAuto","description":"InteractiveAuto render mode"},
{"choice":"LegacyServer","description":"Legacy server-side mode"},
{"choice":"LegacyWebAssembly","description":"Legacy client-side mode"}
],
"defaultValue": "InteractiveWebAssembly"
},
"hostpage": {
"type": "parameter",
"isRequired": false,
"description": "How the static HTML content is generated (ignored if server=false)",
"description": "How the static HTML content is generated with render=LegacyServer",
"dataType": "choice",
"choices": [
{"choice":"bolero","description":"A page defined with Bolero's html functions"},
Expand All @@ -52,25 +47,29 @@
],
"defaultValue":"bolero"
},
"render": {
"html": {
"type": "parameter",
"isRequired": false,
"description": "The type of rendering to use (ignored if server=false or hostpage!=bolero)",
"dataType": "choice",
"replaces": "RENDER_MODE",
"choices": [
{"choice":"InteractiveServer","description":"Use InteractiveServer render mode"},
{"choice":"InteractiveWebAssembly","description":"Use InteractiveWebAssembly render mode"},
{"choice":"InteractiveAuto","description":"Use InteractiveAuto render mode"},
{"choice":"Server","description":"Use classic server-side mode"},
{"choice":"WebAssembly","description":"Use classic client-side mode"}
],
"defaultValue": "WebAssembly"
"description": "Use HTML templates (ignored if minimal=true)",
"dataType": "bool",
"defaultValue": "true"
},
"hotreload": {
"type": "parameter",
"isRequired": false,
"description": "Include hot reload for HTML templates (ignored if html=false or render=WebAssembly)",
"dataType": "bool",
"defaultValue": "true"
},
"server": {
"type": "computed",
"dataType": "bool",
"value": "(render != \"WebAssembly\")"
},
"isInteractive": {
"type": "computed",
"dataType": "bool",
"value": "(hostpage == \"bolero\" && (render == \"InteractiveServer\" || render == \"InteractiveWebAssembly\" || render == \"InteractiveAuto\"))"
"value": "(render == \"InteractiveServer\" || render == \"InteractiveWebAssembly\" || render == \"InteractiveAuto\")"
},
"renderServer": {
"type": "generated",
Expand Down

0 comments on commit 40207bf

Please sign in to comment.