Duotify.Templates.DotNetNew

多奇教育訓練製作的 "dotnet new" 範本套件


Keywords
dotnet-new, duotify, templates
License
MIT
Install
Install-Package Duotify.Templates.DotNetNew -Version 1.7.2

Documentation

Duotify.Templates.DotNetNew

本專案為「多奇教育訓練」製作的 dotnet new 範本專案,用於建立多個不同的專案範本(Project Templates)與項目範本(Item Templates)。

安裝範本

dotnet new -i Duotify.Templates.DotNetNew

更新範本

dotnet new -i Duotify.Templates.DotNetNew

移除範本

dotnet new -u Duotify.Templates.DotNetNew

專案範本 (Project Templates)

  • jconsole

    說明

    提供一個包含 Java 基礎專案的專案範本。

    用法

    dotnet new jconsole -c "YOUR-NAME" -n "your-app-name"

    範例 1

    dotnet new jconsole -c "Will 保哥" -n "CheckClassPath"
    cd CheckClassPath
    java CheckClassPath.java
  • tsnode

    說明

    提供一個包含 Node.js + TypeScript + Nodemon + ts-node + VSCode 完整開發環境的專案範本。

    用法

    dotnet new tsnode -c "YOUR-NAME" -n "your-app-name"

    範例 1

    dotnet new tsnode -c "Will 保哥" -n "myweb"
    cd myweb
    npm install

    範例 2

    mkdir myweb && cd myweb
    dotnet new tsnode -c "Will 保哥"
    npm install
  • tsnode-esm

    說明

    提供一個包含 Node.js + TypeScript 5 (ESM) + Nodemon + ts-node + VSCode + esbuild 完整開發環境的專案範本。

    用法

    dotnet new tsnode-esm -c "YOUR-NAME" -n "your-app-name"

    範例 1

    dotnet new tsnode-esm -c "Will 保哥" -n "myweb"
    cd myweb
    npm install

    範例 2

    mkdir myweb && cd myweb
    dotnet new tsnode-esm -c "Will 保哥"
    npm install
  • antlr

    說明

    提供一個包含 ANTLR 完整範例的 .NET 6 Console 專案範本。

    用法

    dotnet new antlr -c "YOUR-NAME" -n "YOUR-APP-NAME"

    範例

    dotnet new antlr -c "Will 保哥" -n "PowerBuilder"
  • go

    說明

    提供一個最輕量的 Go CLI 專案範本,只有基本的 main.go 並使用到 flag 套件。

    用法

    dotnet new go -c "YOUR-NAME" -g "YOUR-GitHub-ID" -n "YOUR-APP-NAME"

    範例

    dotnet new go -c "Will 保哥" -g "doggy8088" -n myapp
  • gobasic

    說明

    依據 Standard Go Project Layout 提供一個稍微基礎的 Go 專案範本。

    用法

    dotnet new gobasic -c "YOUR-NAME" -g "YOUR-GitHub-ID" -n "YOUR-APP-NAME"

    範例

    dotnet new gobasic -c "Will 保哥" -g "doggy8088" -n myapp
  • gofull

    說明

    依據 Standard Go Project Layout 提供一個相當完整的 Go 專案範本。

    用法

    dotnet new gofull -c "YOUR-NAME" -g "YOUR-GitHub-ID" -n "YOUR-APP-NAME"

    範例

    dotnet new gofull -c "Will 保哥" -g "doggy8088" -n myapp
  • golib

    說明

    依據 Standard Go Project Layout 提供一個可成為共用函式庫的 Go 專案範本。

    用法

    dotnet new golib -c "YOUR-NAME" -g "YOUR-GitHub-ID" -n "YOUR-APP-NAME"

    範例

    dotnet new golib -c "Will 保哥" -g "doggy8088" -n myapp
  • gogin

    說明

    提供一個包含 Gin Web Framework 完整範例的 Go 專案範本。

    用法

    dotnet new gogin -c "YOUR-NAME" -g "YOUR-GitHub-ID" -n "YOUR-APP-NAME"

    範例

    dotnet new gogin -c "Will 保哥" -g "doggy8088" -n myapp

項目範本 (Item Templates)

  • editorconfig

    說明

    提供 C# 專案預設的 .editorconfig 檔案,其內容參考自 .NET code style rule options 官網文件提供的範例。

    若要參考 Roslyn 專案的 .editorconfig 檔案,可以看這裡:https://github.com/dotnet/roslyn/blob/master/.editorconfig

    用法

    dotnet new editorconfig

    範例

    dotnet new editorconfig
  • efr

    說明

    提供 C# 與 Entity Framework Core 專案的 EFRepository 與 Unit of Work 實作範本檔案。

    建立的檔案中會有個 CourseRepository.cs 為範例程式,裡面的程式都是註解掉的。

    用法

    dotnet new efr

    範例

    dotnet new efr

測試範本

  1. 移除與安裝

    dotnet new --uninstall "$PWD\project-templates\jconsole"
    dotnet new -i ./project-templates/jconsole
    dotnet new jconsole -c "Will 保哥" -n "CheckClassPath" -o G:\myapp --force
    code G:\myapp
  2. 列出已安裝範本

    dotnet new --uninstall
  3. 移除現有範本

    dotnet new --uninstall "$PWD\project-templates\jconsole"

建置與發行 NuGet 套件

  1. 封裝套件

    dotnet pack

    此命令會產生一個 bin/Debug/Duotify.Templates.DotNetNew.X.X.X.nupkg 檔案。

  2. NuGet Gallery | Manage My Package 執行 Add new 上傳新版本

    bin/Debug/Duotify.Templates.DotNetNew.X.X.X.nupkg
  3. 按下 Submit 按鈕送審!

    通常 5 分鐘以內就可以變成 Listed 狀態!

    https://www.nuget.org/packages/Duotify.Templates.DotNetNew/

  4. 更新 GitHub 的 Releases 資訊

    Draft a new release

    設定 CHANGELOG.md 的內容

    上傳 bin/Debug/Duotify.Templates.DotNetNew.X.X.X.nupkg 檔案