diff --git a/Prism.Avalonia.Templates.csproj b/Prism.Avalonia.Templates.csproj index d27b4ca..e98b6a2 100644 --- a/Prism.Avalonia.Templates.csproj +++ b/Prism.Avalonia.Templates.csproj @@ -22,7 +22,7 @@ - + diff --git a/readme.md b/readme.md index d762a63..b6b99a8 100644 --- a/readme.md +++ b/readme.md @@ -17,15 +17,25 @@ dotnet new install Templates.Prism.Avalonia The templates are now be available in `dotnet new list`: +### Project Templates + +```txt +Template Name Short Name Language Tags +------------------------------------ -------------------------- -------- ----------------------------------------------------- +Prism.Avalonia .NET - Empty App prism.avalonia.app [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS +Prism.Avalonia .NET - Sample Dialog App prism.avalonia.app.dialog [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS +Prism.Avalonia .NET - Sample Full SideBar App prism.avalonia.app.full [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS +``` + +### Item Templates + ```txt Template Name Short Name Language Tags ------------------------------------ -------------------------- -------- ----------------------------------------------------- -Prism.Avalonia .NET MVVM App prism.avalonia.app [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS -Prism.Avalonia .NET MVVM App Sample prism.avalonia.app.sample [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS -Prism.Avalonia .NET MVVM Dialog App prism.avalonia.app.dialog [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS -Prism Avalonia Event prism.avalonia.event [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS -Prism Avalonia UserControl prism.avalonia.usercontrol [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS -Prism Avalonia Window prism.avalonia.window [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS +Prism Avalonia Event prism.avalonia.event [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS +Prism Avalonia UserControl prism.avalonia.usercontrol [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS +Prism Avalonia ViewModel prism.avalonia.viewmodel [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS +Prism Avalonia Window prism.avalonia.window [C#] Desktop/Xaml/Axaml/Avalonia/Prism/Windows/Linux/macOS ``` ## Contributing diff --git a/templates/csharp/viewmodel/.template.config/template.json b/templates/csharp/viewmodel/.template.config/template.json new file mode 100644 index 0000000..54601f1 --- /dev/null +++ b/templates/csharp/viewmodel/.template.config/template.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "Damian Suess", + "classifications": [ "Desktop", "Xaml", "Axaml", "Avalonia", "Prism", "Windows", "Linux", "macOS" ], + "defaultName": "ViewModel", + "description": "A Prism ViewModel", + "groupidentity": "Prism.Avalonia.ViewModel", + "identity": "Prism.Avalonia.ViewModel", + "name": "Prism Avalonia ViewModel", + "primaryOutputs": [ + { "path": "ViewModel.cs" } + ], + "shortName": "prism.avalonia.viewmodel", + "sourceName": "ViewModel", + "symbols": { + "namespace": { + "description": "Namespace for the generated code", + "replaces": "SampleApp.ViewModels", + "type": "parameter" + } + }, + "tags": { + "language": "C#", + "type": "item" + } +} \ No newline at end of file diff --git a/templates/csharp/viewmodel/NewViewModel.cs b/templates/csharp/viewmodel/NewViewModel.cs new file mode 100644 index 0000000..ef8e0d5 --- /dev/null +++ b/templates/csharp/viewmodel/NewViewModel.cs @@ -0,0 +1,8 @@ +using Prism.Mvvm; + +namespace PrismAvaloniaTemplate.ViewModels; + +public class NewViewModel : BindableBase +{ + +} \ No newline at end of file diff --git a/tests/build-test.ps1 b/tests/build-test.ps1 index f272e31..05aacc1 100644 --- a/tests/build-test.ps1 +++ b/tests/build-test.ps1 @@ -19,12 +19,10 @@ Template options: -A, --AvaloniaVersion <11.0.7|11.1.3> The target version of Avalonia NuGet packages. Type: choice 11.1.3 Target 11.1.3 (default) - 11.0.7 Target 11.0.7 Default: 11.1.3 -P, --PrismVersion <9.0.537.11130> The target version of Prism.Avalonia NuGet packages. Type: choice 9.0.537.11130 Target 9.0.537.11130 (Latest stable). - 8.1.97.11073 Target 8.1.97.11073. Default: 8.1.97.11073 #> @@ -91,7 +89,8 @@ function Test-Template { # Instantiate each item template in the project Exec { dotnet new prism.avalonia.event -o $outDir/$lang/$folderName -n NewEvent -lang $lang } - Exec { dotnet new prism.avalonia.usercontrol -o $outDir/$lang/$folderName -n NewUserControl } + Exec { dotnet new prism.avalonia.usercontrol -o $outDir/$lang/$folderName/Views -n NewUserControl } + Exec { dotnet new prism.avalonia.viewmodel -o $outDir/$lang/$folderName/ViewModels -n NewViewModel } Exec { dotnet new prism.avalonia.window -o $outDir/$lang/$folderName -n NewWindow } # Build @@ -146,21 +145,22 @@ if (Test-Path $binLogDir -ErrorAction SilentlyContinue) { $binlog = [IO.Path]::GetFullPath([IO.Path]::Combine($pwd, "output", "binlog", "test.binlog")) # Build the project only once with all item templates using .net8.0 tfm for C# -Test-Template "prism.avalonia.app.full" "TestAvaloniaItems" "C#" "A" "$latestAvalonia" $binlog +Test-Template "prism.avalonia.app" "TestAvaloniaItems" "C#" "A" "$latestAvalonia" $binlog +##Test-Template "prism.avalonia.app.full" "TestAvaloniaItems" "C#" "A" "$latestAvalonia" $binlog # Bare-bones app Create-And-Build "prism.avalonia.app" "TestAvaloniaBase" "C#" "A" "$latestAvalonia" $binlog # Create-And-Build "prism.avalonia.app" "TestAvaloniaBase6" "C#" "F" "net6.0" $binlog -# Base MVVM App Template Tests -# Create-And-Build "prism.avalonia.app.full" "TestAvaloniaMvvm" "C#" "A" "$latestAvalonia" $binlog -# Create-And-Build "prism.avalonia.app.full" "TestAvaloniaMvvm" "C#" "A" "$olderAvalonia" $binlog -# Create-And-Build "prism.avalonia.app.full" "TestAvaloniaMvvm" "C#" "F" "net6.0" $binlog - # Dialog App Template Tests Create-And-Build "prism.avalonia.app.dialog" "TestAvaloniaDialog" "C#" "A" "$latestAvalonia" $binlog #Create-And-Build "prism.avalonia.app.dialog" "TestAvaloniaDialog" "C#" "A" "$olderAvalonia" $binlog +# Full (most-features) MVVM App Template Tests +Create-And-Build "prism.avalonia.app.full" "TestAvaloniaMvvm" "C#" "A" "$latestAvalonia" $binlog +# Create-And-Build "prism.avalonia.app.full" "TestAvaloniaMvvm" "C#" "A" "$olderAvalonia" $binlog +# Create-And-Build "prism.avalonia.app.full" "TestAvaloniaMvvm" "C#" "F" "net6.0" $binlog + # desktop/android/ios/browser (not implemented) # Create-And-Build "prism.avalonia.xplat" "PrismAvaloniaXplat" "C#" "f" "net8.0" $binlog # Create-And-Build "prism.avalonia.xplat" "PrismAvaloniaXplat" "C#" "av" "$latestAvalonia" $binlog