-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat(core): update prompt for installed template to present available options #436
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit f5a294f. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 9 targets
Sent with 💌 from NxCloud. |
7f99264
to
fafa234
Compare
const available = client.listInstalledTemplates({ search, language }); | ||
|
||
if (available.length === 1) { | ||
return available[0].shortNames[0]; |
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 will be unexpected behavior for most users. A user who supplies no template option, but only has one installed template, will expect a list of templates to choose from (even though only one choice is available). A user who supplies a template option, but only has one installed template, will expect their specified template to be the one chosen, even though it's not installed. It's incredibly unlikely that a user only has one template (since many ship with .NET itself), but this is still unusual behavior.
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 had removed this at one point, I do see the point behind it being unexpected behavior in the case where the user only has 1 template installed.
The trade off is that something like nx g lib --language C# --template class
would present a dialog w/ 1 option (classlib) rather than just moving forward w/ classlib. I think that's acceptable, and its easy to remove the condition.
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 missed that this check occurs after filtering the list, so I hadn't considered the user doing a search and having only one result. In that scenario, using the only search result without further prompting seems fine to me.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
# [1.10.0](v1.9.12...v1.10.0) (2022-05-18) ### Features * **core:** update prompt for installed template to present available options ([#436](#436)) ([5a941ae](5a941ae)) May 18, 2022, 2:13 PM
🎉 This PR is included in version 1.10.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Previously, we prompted with a link to MSDN and a free-text field. Now, we run
dotnet new --list
to generate the list of possible templates, filtering by the value provided by--template {v}
. This results in a select instead of freetext, that is filtered by language and search term.