diff --git a/README.md b/README.md index 261fb52..7788be4 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,52 @@ To get started creating templates, take a look at the following resources. - [Custom templates for dotnet new ](https://docs.microsoft.com/en-us/dotnet/core/tools/custom-templates) +## Template analyzer + +Sayed is working in his free time to create a tool that can be used to analyze .NET Core templates. You can install the analyzer with the command. + +```bash +> dotnet tool install --global sayedha.template.command +``` + +For usage info run `templates -h`. + +After installing the tool you can invoke it by running `templates` in the command line. You can analyze templates that are stored in a local folder +with the `-f` parameter. You can also analyze templates that are contained in a NuGet package (.nupkg) file with the `-p` switch. + +For example to analyze a folder you would run. + +```bash +> templates -f +``` + +When you pass in a path, the tool will search the sub-folders to discover templates. If you are building several templates, you can pass +in a parent folder that contains all the templates, and each template that is discovered will be analyzed. + +### What the tool looks for + +Error if missing a required property +- `$.author`, +- `$.sourceName`, +- `$.classifications`, +- `$.identity`, +- `$.name`, +- `$.shortName`, +- `$.tags`, +- `$.tags.language`, +- `$.tags.type` + +Warnings for missing recommended properties +- `$.defaultName`, +- `$.description`, +- `$.symbols`, +- `$.symbols.Framework`, +- `$.symbols.Framework.choices` + +Error if `$.tags.type` is not set to either project or item +Warning if `$.symbols.Framework.type` is not set to parameter. +Warning if `$.symbols.Framework.datatype` is not set to choice. + ## How to enable cli templates in Visual Studio and Visual Studio for Mac The feature to show templates that are installed using the command-line interface (cli) is a preview feature. This feature is disabled by default. diff --git a/build-nuget.ps1 b/build-nuget.ps1 index 2b26410..80b7748 100644 --- a/build-nuget.ps1 +++ b/build-nuget.ps1 @@ -33,7 +33,7 @@ Clean $outputpath = Join-Path $scriptDir nupkg $pathtonuspec = Join-Path $srcDir SayedHa.Template.NetCoreTool.nuspec if(Test-Path $pathtonuspec){ - nuget pack $pathtonuspec -OutputDirectory $outputpath + nuget.exe pack $pathtonuspec -OutputDirectory $outputpath } else{ 'ERROR: nuspec file not found at {0}' -f $pathtonuspec | Write-Error @@ -46,4 +46,7 @@ if(test-path $pathtonupkg){ Reset-Templates 'installing template with command "dotnet new --install {0}"' -f $pathtonupkg | write-host &dotnet new --install $pathtonupkg +} +else{ + 'Not installing template because it was not found at "{0}"' -f $pathtonupkg | Write-Error } \ No newline at end of file