ZhangShaobo.Templates
1.0.11
dotnet new install ZhangShaobo.Templates@1.0.11
What's this?
The default dotnet new blazor templates shipped with dotnet sdk is fine, there are just some tiny annoying things make me feel uncomfortable, like:
- bootstrap & jQuery are always included
- the default pages and layouts will always be deleted eventually
- since .NET 6,
implicit usingwas enabled as default. - since .NET 6, no
Programclass &Mainfunction anymore
Actually these changes are not big deals, just I don't like it, so I've decided to create ZhangShaobo.Templates to fix these annoying things:
implicit usingdisabledProgramclass andMainfunction as the old way- no default pages(well, the default
Indexstill had to be there) - no external front-end web libraries involved: like jQuery & bootstrap
- add scripts like
Build.ps1,Clean.ps1andStart.ps1etc. for convenience. and as you can see from the script suffix: these are PowerShell scripts, they should also works fine on Powershell of non-windows platform.
You might wonder what the fuck is ZhangShaobo & Shaobo, well, I have to confess that I didn't thought too much when I started, the biggest mistake I've made and realized so far is to use my real name as the nupkg package name and template name:
- it made the package name and template name too long..😒
- I should not mark my name to such a toy project, I should made something that change the world, not this piece of crap. It's harmful to my reputation..😒😒😒
- #2 is a joke: actually I'm proud of every piece of crap I've made: the world is made up of craps, all craps matters! 🤪🤪🤪🤪🤪🤪🤪
Templates
1. Blazor WASM application : shaobo_wasm, shaobo_wasm_full
these two templates are all similiar to the official dotnet new blazorwasm --hosted template: create a hosted Blazor WASM solution with several projects inside
shaobo_wasmis the most simple, clean one : just nothing except a default page: no controllers, no layout components, no webapi, nothing.shaobo_wasm_fullis my personal used "all-in-one" template, it contains:AntDesignUI libraryUnit test related libraries & tools:
package:
xUnit,bUnit,coverlet.collector,Moq,RichardSzalay.MockHttptool:
dotnet-reportgenerator-globaltoola unit test project inside the solution
helper script
Test.ps1to execute unit tests and generate cc reporthelper utilities to access browser
localStorageviaJSInteropstate management library
Fluxorand related test suite library
Parameters & Usage:
all those templates shares the same usage and parameter definitions
| Parameter | Default Value | Options | Description |
|---|---|---|---|
__PROJECT_NAME__ |
HelloBlazorWASM |
-o, --output |
the project name |
__DEV_HTTP_PORT__ |
5018 | -H, --HttpDevPort |
HTTP Port number in development env |
__DEV_HTTPS_PORT__ |
7284 | -Ht, --HttpsDevPort |
HTTPs Port number in development env |
examples:
dotnet new shaobo_wasm -o MyFirstWASMApp -H 5000 -Ht 5001
Helper Scripts:
| Script name | Parameters | Description |
|---|---|---|
Build.ps1 |
-- | build & restore the whole solution, include Client & Server and Shared, and Test as well if it exist |
Clean.ps1 |
-- | delete all the intermidiate files & folders generated by build or test procedure |
Start.ps1 |
-- | start the local development server in watch(hot reload enabled) mode |
Test.ps1 |
-- | only available for shaobo_wasm_full : execute unit tests and generate readable cc report |
Notes:
${__PROJECT_NAME__}.Shared\BlankModel.csis a blank class definition. I have to place at least one class definition in theSharedproject otherwise statementusing ${__PROJECT_NAME__}.Sharedwill be treat as a compile error inClient&Serverproject${__PROJECT_NAME__}.Sharedis just a regular class library, it's not Blazor Component Library, so don't put any shared Blazor Components or statis assets into it
2. Blazor Server application : shaobo_blazor
similar with the official dotnet new blazorserver, this template will create a single project instead of a solution with project(s).
Parameters & Usage:
| Parameter | Default Value | Options | Description |
|---|---|---|---|
__PROJECT_NAME__ |
HelloBlazorServer |
-o, --output |
the project name |
__DEV_HTTP_PORT__ |
3037 | -H, --HttpDevPort |
HTTP Port number in development env |
__DEV_HTTPS_PORT__ |
6428 | -Ht, --HttpsDevPort |
HTTPs Port number in development env |
examples:
dotnet new shaobo_blazor -o MyFirstBlazorServerApp -H 5000 -Ht 5001
Helper Scripts:
| Script name | Parameters | Description |
|---|---|---|
Clean.ps1 |
-- | delete all the intermidiate files & folders generated by build procedure |
release note (order by release time ASC)
1.0.0 ~ 1.0.3
- the initial releases, only contains two template :
shaobo_wasm&shaobo_blazor
1.0.4, 2023-03-29
- add template
shaobo_wasm_antd
1.0.5, 2023-03-31
migrate to net7.0
set
*.Server.csprojas the default start up project for blazor wasm templatesbug fix: blazor wasm templates use hard coded GUID as solution & project GUID in
slnfilenow the templates will generate solution GUID & project GUID dynamically
1.0.6, 2023-03-31
add template
shaobo_wasm_antd_utmake
README.mdcleaner
1.0.7, 2023-04-01
- add
Test.ps1helper script forshaobo_wasm_ant_ut: execute UT & generate CC report
1.0.8, 2023-04-01
bug fix: for blazor wasm templates, css isolation doesn't work
make
README.mdcleaner
1.0.9, 2023-04-03
bug fix: helper scripts doesn't work on non-Windows platform.
since
1.0.8, all helper scripts should works fine onPowerShellon non-windows platforms.bug fix:
Test.ps1doesn't restorereportgeneratorautomaticallysince
1.0.8,Test.ps1will always rundotnet tool restorefirst before generate the cc report.
1.0.10, 2023-04-06
rename template
shaobo_wasm_antd_uttoshaobo_wasm_fullsince this version,
shaobo_wasm_fullmeans my personal "all-in-one" template- add localStorage utilities to
shaobo_wasm_full
- add localStorage utilities to
remove template
shaobo_wasm_antdbugfix: helper scripts doesn't work on old version powershell due to
Join-Pathdoesn't support multiple parameters in older powershellreplace all
Join-Pathin powershell script with[IO.Path]::Combine()functionalthough powershell is way much better than bash, but still too 🤮🤮🤮 to use.. I hate shell scripts!(include python, bite me!)
bugfix:
Test.ps1would open cc report by test editor if user set text editor as default open app of*.htmljust use microsoft edge exe bin path to launch browser..
1.0.11, 2023-04-06
add state management library
Fluxorforshaobo_wasm_fullrearrange file structure of
shaobo_wasm_full: put lots of things intoSharedproject, makeClientandServeras thin as possible
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.