ZhangShaobo.Templates 1.0.11

dotnet new install ZhangShaobo.Templates@1.0.11
                    
This package contains a .NET Template Package you can call from the shell/command line.

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:

  1. bootstrap & jQuery are always included
  2. the default pages and layouts will always be deleted eventually
  3. since .NET 6, implicit using was enabled as default.
  4. since .NET 6, no Program class & Main function 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:

  1. implicit using disabled
  2. Program class and Main function as the old way
  3. no default pages(well, the default Index still had to be there)
  4. no external front-end web libraries involved: like jQuery & bootstrap
  5. add scripts like Build.ps1, Clean.ps1 and Start.ps1 etc. 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:

  1. it made the package name and template name too long..😒
  2. 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..😒😒😒
  3. #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

  1. shaobo_wasm is the most simple, clean one : just nothing except a default page: no controllers, no layout components, no webapi, nothing.

  2. shaobo_wasm_full is my personal used "all-in-one" template, it contains:

    1. AntDesign UI library

    2. Unit test related libraries & tools:

      package: xUnit, bUnit, coverlet.collector, Moq, RichardSzalay.MockHttp

      tool: dotnet-reportgenerator-globaltool

    3. a unit test project inside the solution

    4. helper script Test.ps1 to execute unit tests and generate cc report

    5. helper utilities to access browser localStorage via JSInterop

    6. state management library Fluxor and 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:

  1. ${__PROJECT_NAME__}.Shared\BlankModel.cs is a blank class definition. I have to place at least one class definition in the Shared project otherwise statement using ${__PROJECT_NAME__}.Shared will be treat as a compile error in Client & Server project
  2. ${__PROJECT_NAME__}.Shared is 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

  1. the initial releases, only contains two template : shaobo_wasm & shaobo_blazor

1.0.4, 2023-03-29

  1. add template shaobo_wasm_antd

1.0.5, 2023-03-31

  1. migrate to net7.0

  2. set *.Server.csproj as the default start up project for blazor wasm templates

  3. bug fix: blazor wasm templates use hard coded GUID as solution & project GUID in sln file

    now the templates will generate solution GUID & project GUID dynamically

1.0.6, 2023-03-31

  1. add template shaobo_wasm_antd_ut

  2. make README.md cleaner

1.0.7, 2023-04-01

  1. add Test.ps1 helper script for shaobo_wasm_ant_ut: execute UT & generate CC report

1.0.8, 2023-04-01

  1. bug fix: for blazor wasm templates, css isolation doesn't work

  2. make README.md cleaner

1.0.9, 2023-04-03

  1. bug fix: helper scripts doesn't work on non-Windows platform.

    since 1.0.8, all helper scripts should works fine on PowerShell on non-windows platforms.

  2. bug fix: Test.ps1 doesn't restore reportgenerator automatically

    since 1.0.8, Test.ps1 will always run dotnet tool restore first before generate the cc report.

1.0.10, 2023-04-06

  1. rename template shaobo_wasm_antd_ut to shaobo_wasm_full

    since this version, shaobo_wasm_full means my personal "all-in-one" template

    1. add localStorage utilities to shaobo_wasm_full
  2. remove template shaobo_wasm_antd

  3. bugfix: helper scripts doesn't work on old version powershell due to Join-Path doesn't support multiple parameters in older powershell

    replace all Join-Path in powershell script with [IO.Path]::Combine() function

    although powershell is way much better than bash, but still too 🤮🤮🤮 to use.. I hate shell scripts!(include python, bite me!)

  4. bugfix: Test.ps1 would open cc report by test editor if user set text editor as default open app of *.html

    just use microsoft edge exe bin path to launch browser..

1.0.11, 2023-04-06

  1. add state management library Fluxor for shaobo_wasm_full

  2. rearrange file structure of shaobo_wasm_full: put lots of things into Shared project, make Client and Server as 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.

Version Downloads Last Updated
1.0.11 1,406 4/6/2023
1.0.10 699 4/5/2023
1.0.9 710 4/3/2023
1.0.8 725 4/1/2023
1.0.7 709 3/31/2023
1.0.6 713 3/31/2023
1.0.5 681 3/31/2023
1.0.4 717 3/29/2023
1.0.3 1,192 8/18/2022
1.0.2 909 8/16/2022
1.0.1 930 8/15/2022
1.0.0 922 8/11/2022