-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added project template #9
Conversation
We can worry about ui tests later too? They're not as common, as I think we can get away a lot with the VisualUITestBase (we should bring that over to the common folder to be able to reference in our unit test projects). I guess when the template is copied/used for setup in the Labs directory, it'd replace 'CounterButton' automatically with whatever the name of the experiment is? |
@michael-hawker you bring up an interesting point. I put the CounterButton in there expecting the dev to strip it out and rename the projects. The process of doing that will show them everywhere they need to update with their own code. I didn't plan on doing any auto renaming. The other approach is to put no examples in the template, leave it bare, and expect the dev to follow the comments. I lean towards option 1 because it gives them something to use as an example, and if we ever detect "CounterButton" we know there is more work to do. |
@shweaver-MSFT yeah, I do like having example code that does something that they can modify. I just know sometimes it can be hard to get every namespace and config thing (especially in some project files) when it comes to renaming things, so it'd be cool if the template setup step could do that bit for them. We could leave the component in the library file still called 'CounterButton'. I think it'd just be all the project names and things. This would also make sure it's less likely they dev doesn't change the library namespace/package name that we'd still want to follow the pattern of CommunityToolkit.Labs.Uwp.ExperimentName (or maybe we want |
Updates namespaces Improved unit tests
@michael-hawker I agree, some auto-replacement of names would be nice. I made a few changes. Let me know what you think. @Arlodotexe @XAML-Knight you guys too! |
Moved common code to shared project
…all-sample" apps, organization and cleanup.
Made projects use assets in common folder Minor tweaks to CounterButton
…owing in VS dropdown
…-projects Enabling x-plat, adding sample page libraries
@XAML-Knight sorry you hit those issues with the template. @michael-hawker brought up a good idea about encapsulating the setup in a |
Updates namespaces Improved unit tests
Made projects use assets in common folder Minor tweaks to CounterButton
…/Toolkit-Labs-Test into shweaver/template
I think the goal here was to just get the infrastructure setup and explore some of the testing bits, then we could coordinate better with everything merged together. Though it looks like Shane may have merged main in at least. I think we do need to test if the template is happy of we reference a props file that wouldn't exist in the template directory until the template is created, though again think we can fix and explore that after we know what our final sample environment looks like. |
Also fixed up Style key creation/default style setup. Renamed assembly name to include ProjectTemplate as well.
…ltiple Labs and use
|
||
# Does an experiment by this name already exist in the Labs folder? | ||
# If so, we'll need to re-prompt for the experiment name and re-validate until the name is determined to be unique. | ||
while (Test-Path "./Labs/$($ExperimentName)" -PathType Container) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want a loop or to just terminate the command and they can just run it again with a different name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote for terminating so it's easier to integrate with other tooling
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentation", "{3D695A5F-0860-46E0-B52F-5C80F692617A}" | ||
ProjectSection(SolutionItems) = preProject | ||
..\..\License.md = ..\..\License.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path goes to a file that may not be available in the generated solution as it isn't in the template and relies on the new solution being created in a specific location.
@@ -0,0 +1,21 @@ | |||
# Windows Community Toolkit Labs - Project Template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this file?
Is it documenting the code that is then packaged into a template?
Or, is it intended to explain the generated solution to the developer who created a new lab from the template?
If the first, why is it in the generated solution?
If the second, it needs actionable content. It would also be good to have this open by default when the solution is opened for the first time.
In either case, it would be useful to have some placeholder content in each section that indicates what will eventually go under each heading.
JFYI, I don't have any intentions of working on this PR anymore. It was a fun hackathon project, but I had a hard time completing it without more clarity around what the requirements are for this template feature. @michael-hawker you can do with this what you like :) @mrlacey would you be interested in taking this on and working with Michael to find the right template pattern? |
Thanks. |
Thanks @shweaver-MSFT! This is going to be super useful for the future. We've just been figuring out where everything is going to land, so want to make sure we create the template bit after we know how everything fits together. Matt just joined our team here, so he's digging into all this stuff as we shore up what our requirements are and move forward. |
Superseded by #76, closing this out now. Thanks @shweaver-MSFT for all this early investigation work! |
Fixes #4
Template folder:
![image](https://user-images.githubusercontent.com/25832310/145290175-3e38aa66-eb8a-48ab-a6e7-a0a1bbde4a3a.png)
Visual Studio Solution Explorer:
![image](https://user-images.githubusercontent.com/25832310/145290120-1a59f28e-79d7-4afb-8341-1ec9b6eacf23.png)
Example output from
![image](https://user-images.githubusercontent.com/25832310/145290276-37fdf171-7199-4006-baa2-4fa9fbd09cf5.png)
dotnet new labsapp -n TemplateTest
I put together a simple project template with most of the parts that should make a good baseline for starting new labs projects.
CounterButton
is a custom button that increments when you click it. I figure this is a nice opportunity to show a few common patterns for creating templated controls.Unit and UI Tests
All the tests work, including UI tests using WinAppDriver.
Documentation
The ProjectTemplate.md represents the documentation for the feature (it will be renamed during the generation process).
I've also included a README.md to cover the various parts of the template and how to use it.
dotnet new
To install the template for use from
dotnet new
, go to the Template directory and run the following command:Once the template is installed, use the
dotnet new
command to generate a new copy of the template with a provided name:Let me know what you think!
TODO:
Enable UI tests to work in CI Docs(Added as separate item to Setup CI Infrastructure #13)dotnet new
Enable generation with VSIX template(Packaging a template with multiple projects and solution items is not supported)