gui-cs / Terminal.Gui.templates

Template for dotnet new that creates a new Terminal.Gui project
MIT License
28 stars 1 forks source link

Make part of Terminal.Gui and/or put in the gui-cs org? #4

Closed tig closed 2 years ago

tig commented 2 years ago

@tznind this is awesome!

Is there a way to make this part of the Terminal.Gui lib so this would work:

dotnet new --install Terminal.Gui.templates

?

Or, did you name it gui.cs because you think it should sit above the namespace hierarchy of github.com/gui-cs?

tznind commented 2 years ago

We should be able to make the PackageId anything we want. It is defined here:

https://github.com/tznind/gui.cs.template/blob/main/gui.cs.templates.csproj#L6

So we should be able to call it Terminal.Gui.templates. I think for consistency I would rename the repo and the .csproj to match.

It gets pushed as a standalone nuget package that contains the template files only (i.e. not the Terminal.Gui dll) and that has already been pushed under the title gui.cs.templates here https://www.nuget.org/packages/gui.cs.templates/ . NuGet might not like changing the PackageId but even if that is the case we can just unlist the existing package and relist with the new title.

Do you want me to transfer the repo to gui.cs (and rename to Terminal.Gui.templates ?

So the steps are:

tig commented 2 years ago

I like the idea of putting as much "TUI in .NET" stuff as possible in the gui-cs org, so, yes, that would be my preference. But it's your code and up to you in the end!

tznind commented 2 years ago

Happy to move it!

Ok that's it moved. Although I seem to now have lost the Settings tab now that it is part of org and not a personal repo. Can you please rename it Terminal.Gui.templates then I will do the other steps and see how NuGet responds to the new package name.

tig commented 2 years ago

You are now an Admin. I renamed it.

tznind commented 2 years ago

Do we want to rename the template too?

The way the system works is that you have 1 nuget package (i.e. Terminal.Gui.templates) and then 1 or more templates within that package.

Currently there is only 1 template within the package and it is called guics

i.e.

dotnet new guics -n myproj

Each template name is defined in its corresponding template.json file. The one we have so far is this:

https://github.com/gui-cs/Terminal.Gui.templates/blob/ad352ede8554e5539836f8cc2960684007e594a3/templates/basic/.template.config/template.json#L1-L14

These are the docs on template.json: https://learn.microsoft.com/en-us/dotnet/core/tools/custom-templates#templatejson

For reference these are the ones that ship with dotnet or I've installed. You can see this list with dotnet new --list

So the convention for shortname seems to be no dots and reasonably short.

Template Name                Short Name           Language    Tags
---------------------------  -------------------  ----------  ---------------------------------------------------------
.NET MAUI App                maui                 [C#]        MAUI/Android/iOS/macOS/Mac Catalyst/Windows/Tizen
.NET MAUI Blazor App         maui-blazor          [C#]        MAUI/Android/iOS/macOS/Mac Catalyst/Windows/Tizen/Blazor
.NET MAUI Class Library      mauilib              [C#]        MAUI/Android/iOS/macOS/Mac Catalyst/Windows/Tizen
.NET MAUI ContentPage (C#)   maui-page-csharp     [C#]        MAUI/Android/iOS/macOS/Mac Catalyst/WinUI/Tizen/Xaml/Code
.NET MAUI ContentPage (X...  maui-page-xaml       [C#]        MAUI/Android/iOS/macOS/Mac Catalyst/WinUI/Tizen/Xaml/Code
.NET MAUI ContentView (C#)   maui-view-csharp     [C#]        MAUI/Android/iOS/macOS/Mac Catalyst/WinUI/Tizen/Xaml/Code
.NET MAUI ContentView (X...  maui-view-xaml       [C#]        MAUI/Android/iOS/macOS/Mac Catalyst/WinUI/Tizen/Xaml/Code
.NET MAUI ResourceDictio...  maui-dict-xaml       [C#]        MAUI/Android/iOS/macOS/Mac Catalyst/WinUI/Xaml/Code
Android Activity template    android-activity     [C#]        Android/Mobile
Android Application          android              [C#]        Android/Mobile
Android Class Library        androidlib           [C#]        Android/Mobile
Android Java Library Bin...  android-bindinglib   [C#]        Android/Mobile
Android Layout template      android-layout       [C#]        Android/Mobile
Android Wear Application     androidwear          [C#]        Android/Mobile
ASP.NET Core Empty           web                  [C#],F#     Web/Empty
ASP.NET Core gRPC Service    grpc                 [C#]        Web/gRPC
ASP.NET Core Web API         webapi               [C#],F#     Web/WebAPI
ASP.NET Core Web App         webapp,razor         [C#]        Web/MVC/Razor Pages
ASP.NET Core Web App (Mo...  mvc                  [C#],F#     Web/MVC
ASP.NET Core with Angular    angular              [C#]        Web/MVC/SPA
ASP.NET Core with React.js   react                [C#]        Web/MVC/SPA
ASP.NET Core with React....  reactredux           [C#]        Web/MVC/SPA
Blazor Server App            blazorserver         [C#]        Web/Blazor
Blazor WebAssembly App       blazorwasm           [C#]        Web/Blazor/WebAssembly/PWA
Class Library                classlib             [C#],F#,VB  Common/Library
Console App                  console              [C#],F#,VB  Common/Console
dotnet gitignore file        gitignore                        Config
Dotnet local tool manife...  tool-manifest                    Config
EditorConfig file            editorconfig                     Config
global.json file             globaljson                       Config
iOS Application              ios                  [C#]        iOS/Mobile
iOS Binding Library          iosbinding           [C#]        iOS/Mobile
iOS Class Library            ioslib               [C#]        iOS/Mobile
iOS Controller template      ios-controller       [C#]        iOS/Mobile
iOS Tabbed Application       ios-tabbed           [C#]        iOS/Mobile
MacCatalyst Application      maccatalyst          [C#]        macOS/Mac Catalyst
MacCatalyst Binding Library  maccatalystbinding   [C#]        macOS/Mac Catalyst
MSTest Test Project          mstest               [C#],F#,VB  Test/MSTest
MVC ViewImports              viewimports          [C#]        Web/ASP.NET
MVC ViewStart                viewstart            [C#]        Web/ASP.NET
NuGet Config                 nugetconfig                      Config
NUnit 3 Test Item            nunit-test           [C#],F#,VB  Test/NUnit
NUnit 3 Test Project         nunit                [C#],F#,VB  Test/NUnit
Protocol Buffer File         proto                            Web/gRPC
Razor Class Library          razorclasslib        [C#]        Web/Razor/Library/Razor Class Library
Razor Component              razorcomponent       [C#]        Web/ASP.NET
Razor Page                   page                 [C#]        Web/ASP.NET
React.NET Starter Template   reactnet-vanilla     [C#]        Web
React.NET Webpack Starte...  reactnet-webpack     [C#]        Web
Solution File                sln                              Solution
Terminal Gui Basic Template  guics                [C#]        Console/TUI
Web Config                   webconfig                        Config
Windows Forms App            winforms             [C#],VB     Common/WinForms
Windows Forms Class Library  winformslib          [C#],VB     Common/WinForms
Windows Forms Control Li...  winformscontrollib   [C#],VB     Common/WinForms
Worker Service               worker               [C#],F#     Common/Worker/Web
WPF Application              wpf                  [C#],VB     Common/WPF
WPF Class library            wpflib               [C#],VB     Common/WPF
WPF Custom Control Library   wpfcustomcontrollib  [C#],VB     Common/WPF
WPF User Control Library     wpfusercontrollib    [C#],VB     Common/WPF
xUnit Test Project           xunit                [C#],F#,VB  Test/xUnit
tig commented 2 years ago

Seems like the template name should be a noun that best describes the app the template creates.

Over time, I could imagine templates for:

Is this what you're asking?

tig commented 2 years ago

Actually... What if we just 'owned' "TUI":

(Can you use templates for partials, or just full projects?)

tznind commented 2 years ago

Actually... What if we just 'owned' "TUI":

Yes! I think that is perfect actually. I will rename the shortcode to tui and we can add the others later.

I think having a template that is just tui alone (not tui-generic) is consistent with the wpf ones where there is:

(Can you use templates for partials, or just full projects?)

I'm not sure. I've only seen it used for dotnet new so far.

tznind commented 2 years ago

Ok I have marked the previous packages as Deprecated. New package is at https://www.nuget.org/packages/Terminal.gui.templates

image

Old package name now appears deprecated and forwards to the new package name/shortcode

Its annoying that the capitalization is Terminal.gui.templates not Terminal.Gui.Templates but I don't want to get into a pickle trying to fix that now that it is pushed. I did rename the csproj and the workflow to use the correct capitalization but it seems to have pushed with lower case 'g' anyway.

But the install command doesn't seem to care either way:

PS D:\> dotnet new --install Terminal.Gui.templates
The following template packages will be installed:
   Terminal.Gui.templates
tznind commented 2 years ago

@tig I've invited you as a joint owner on the nuget package incase theres ever any issue pushing new versions or expired keys etc. Always best to have a backup.