Dotnet new templates: Fix placeholders and port in umbraco-extension template
#20956
+11
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
umbraco-extensiontemplate can be called with a-exparameter to include an example dashboard in the extension project. If this parameter is used then the extension project created by the template does not build. And this 'end-to-end' example is very useful for people to see how everything is wired up!These errors result from changes made in #20386
Replicating the issue (with 17 RC4)
In an empty folder open the command prompt and run
As using an RC you need to make some manual changes (downside of how the versioning is configured)
MyExtension/MyExtensions.csproj- lines 17-20, manually set package reference versions (* -> 17.0.0-rc4)MyExtension/Client/package.json- line 13, manually set the version number (^* -> ^17.0.0-rc4)The
npm run buildstep will fail. This is because the template has aWebsiteClientServicenot aUmbracoExtensionServiceclass specified inClient/src/api/sdk.gen.ts. The class needs to be calledUmbracoExtensionServiceso that when the template runs it will get replaced with the name (-n) parameter.You can fix this manually in your created project by changing the class name in
sdk.gen.tstoMyExtensionServiceNow
npm run buildshould work.Now test the example dashboard in the website. The buttons in the dashboard won't work because it's making calls to urls such as
umbraco/websiteclient/apiwhereas the urls should reflect the name (-n) parameter when the template ran.You can fix this manually by finding the occurrences of
websiteclient/apiand changing them to bemyextension/apiRebuild and now the dashboard buttons should work!
BTW the final test is that hey api re-generation works … With the website still running:
Which it did - hey api reported successful re-generation 😅
This PR
This PR resets the incorrect instances of
WebsiteClientandwebsiteclientback toUmbracoExtensionandumbracoextensionIt also resets the port number in the template to be consistently 44339 as that's the port number that the template is configured to replace, if the template is ran with the
--site-domainparameterTesting Done
I have tested these changes locally. Just to clarify I did this by (in the
templatesfolder of my fork):Having installed the templates from my local nuget package, I then re-ran the rest of the testing steps above:
npm run buildworksnpm run generate-clientworkSo this is PR now tested😅