TemplateStudio
TemplateStudio copied to clipboard
Refactor TemplateJsonVerifier to make platform specific values configurable
Opening this issue to study the possibility to refactor the TemplateJsonVerifier in a way that plaform specific values are configurable.
While adapting the TemplateJsonVerifier for WPF I added a number of symbols and export parameters that are used in WPF templates. Making theese (and other values like allowed framework and project types) values configurable will help when adding new platforms (like WinUI3) or using the TemplateJsonVerifier for Web Template Studio.
Not a priority right now, but we will need this for https://github.com/microsoft/WebTemplateStudio/issues/1491 in mid-term future to validate WebTS templates.
Our idea is to move the TemplateValidator Tool to CoreTS to be able to reuse it from Web Template Studio. Most of the validations are valid for WebTS and WInTS, but there are a few tests that are specific to WinTS and should be factored out to stay in WinTS. Other tests rely on values specific to the template platform (UWP, WPF, WinUI, Web, RN). Those values should be configurable and stay in WinTS/WebTS,
The following table gives an overview of functionality that can be moved to CoreTS without changes, should be configurable or should stay in WinTS.
TemplateFolderVerifier:
Step | Move to CoreTS | Comments |
---|---|---|
Check for duplicate identities | yes | |
Check that localized files have the same identity | yes | |
Check primary output | yes | This is not used in WebTS, primary output path is optional and should be configurable |
Check for duplicated files (based on file hash) | yes | |
Check dependencies exist | yes | |
Check requirements exist | yes | |
Check exclusions exist | yes | |
Check composition filters | yes | |
Check Xaml icons | yes | Not used by WebTS but is supported by CoreTS and might (hypothetically) be used outside of WinTS |
VerifyTemplatePathAsync:
Step | Move to CoreTS | Comments |
---|---|---|
AnalyzeJson | yes | ValidationTemplateInfo contains some WinTS specific values on the Author tag. We could either split ValidationTemplateInfo in two (WinTS and WebTS) or just say this tag is required and verify the authors using configuration (as done with tag usage) |
Check Description | yes | |
Check VB Templates Naming | no | This is very specific to VB Templates, think this should stay in WinTS as a separate test |
Check Classification | yes | Needs to be configurable |
Tag usage | Yes | Needs to be configurable |
ValidPrimaryOutputs | yes | |
CheckDefinedGuids | yes | |
Symbols | yes | Needs to be configurable |
Licences | yes | Need to include code to validate npm packages |
PostactionPath | yes |
As WebTS is cross-platform we should migrate the TemplateValidator tool to .NET Core too. We'll have to update the CommandParser Version as the current version does not support .NET Core.
The branch https://github.com/sibille/CoreTemplateStudio/tree/poc_templateValidator contains a POC of what the TemplateValidator Tool could look like in CoreTS. https://github.com/sibille/CoreTemplateStudio/blob/poc_templateValidator/code/tools/TemplateValidator/UwpConfiguration.json shows a sample configuration file for platform specific values. This file is only a sample, we'll need to review the values. The different platform configuration files should "live" in WinTS/WebTS, not in CoreTS.