Dotnet new templates: Fix placeholders and port in umbraco-extension template (#20956)

* reset placeholders and port number in umbraco-extension template

* add readme instructions on how to test templates locally
This commit is contained in:
Lotte Pitcher
2025-12-04 14:34:57 +00:00
committed by GitHub
parent e6c7ef8904
commit 61a69852e3
4 changed files with 32 additions and 11 deletions

View File

@@ -14,5 +14,5 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
export const client = createClient(createConfig<ClientOptions2>({ export const client = createClient(createConfig<ClientOptions2>({
baseUrl: 'https://localhost:44394' baseUrl: 'https://localhost:44339'
})); }));

View File

@@ -18,7 +18,7 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
meta?: Record<string, unknown>; meta?: Record<string, unknown>;
}; };
export class WebsiteClientService { export class UmbracoExtensionService {
public static ping<ThrowOnError extends boolean = false>(options?: Options<PingData, ThrowOnError>) { public static ping<ThrowOnError extends boolean = false>(options?: Options<PingData, ThrowOnError>) {
return (options?.client ?? client).get<PingResponses, PingErrors, ThrowOnError>({ return (options?.client ?? client).get<PingResponses, PingErrors, ThrowOnError>({
security: [ security: [
@@ -27,7 +27,7 @@ export class WebsiteClientService {
type: 'http' type: 'http'
} }
], ],
url: '/umbraco/websiteclient/api/v1/ping', url: '/umbraco/umbracoextension/api/v1/ping',
...options ...options
}); });
} }
@@ -40,7 +40,7 @@ export class WebsiteClientService {
type: 'http' type: 'http'
} }
], ],
url: '/umbraco/websiteclient/api/v1/whatsMyName', url: '/umbraco/umbracoextension/api/v1/whatsMyName',
...options ...options
}); });
} }
@@ -53,7 +53,7 @@ export class WebsiteClientService {
type: 'http' type: 'http'
} }
], ],
url: '/umbraco/websiteclient/api/v1/whatsTheTimeMrWolf', url: '/umbraco/umbracoextension/api/v1/whatsTheTimeMrWolf',
...options ...options
}); });
} }
@@ -66,7 +66,7 @@ export class WebsiteClientService {
type: 'http' type: 'http'
} }
], ],
url: '/umbraco/websiteclient/api/v1/whoAmI', url: '/umbraco/umbracoextension/api/v1/whoAmI',
...options ...options
}); });
} }

View File

@@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts // This file is auto-generated by @hey-api/openapi-ts
export type ClientOptions = { export type ClientOptions = {
baseUrl: 'https://localhost:44394' | (string & {}); baseUrl: 'https://localhost:44339' | (string & {});
}; };
export type DocumentGranularPermissionModel = { export type DocumentGranularPermissionModel = {
@@ -159,7 +159,7 @@ export type PingData = {
body?: never; body?: never;
path?: never; path?: never;
query?: never; query?: never;
url: '/umbraco/websiteclient/api/v1/ping'; url: '/umbraco/umbracoextension/api/v1/ping';
}; };
export type PingErrors = { export type PingErrors = {
@@ -182,7 +182,7 @@ export type WhatsMyNameData = {
body?: never; body?: never;
path?: never; path?: never;
query?: never; query?: never;
url: '/umbraco/websiteclient/api/v1/whatsMyName'; url: '/umbraco/umbracoextension/api/v1/whatsMyName';
}; };
export type WhatsMyNameErrors = { export type WhatsMyNameErrors = {
@@ -205,7 +205,7 @@ export type WhatsTheTimeMrWolfData = {
body?: never; body?: never;
path?: never; path?: never;
query?: never; query?: never;
url: '/umbraco/websiteclient/api/v1/whatsTheTimeMrWolf'; url: '/umbraco/umbracoextension/api/v1/whatsTheTimeMrWolf';
}; };
export type WhatsTheTimeMrWolfErrors = { export type WhatsTheTimeMrWolfErrors = {
@@ -228,7 +228,7 @@ export type WhoAmIData = {
body?: never; body?: never;
path?: never; path?: never;
query?: never; query?: never;
url: '/umbraco/websiteclient/api/v1/whoAmI'; url: '/umbraco/umbracoextension/api/v1/whoAmI';
}; };
export type WhoAmIErrors = { export type WhoAmIErrors = {

21
templates/readme.md Normal file
View File

@@ -0,0 +1,21 @@
# Contributing to the Umbraco Templates
If you're making changes to any of the templates in this folder, please note that installing them directly from this location to test will not work. You need to 'pack' the source into a nuget package (.nupkg) in a local folder, and install from there.
For example, using a folder location of `c:\nuget.local`:
```
# Pack the templates to a local folder
dotnet pack -o "c:\nuget.local"
# Add this folder as a local nuget source
dotnet nuget add source "c:\nuget.local" --name "local nuget"
# Make sure you don't have the global templates installed
dotnet new uninstall Umbraco.Templates
# Install your version of the templates, having checked/updated the name of the generated .nupkg file
dotnet new install "c:\nuget.local\Umbraco.Templates.XXXX.nupkg"
```
You can now test your template changes using the appropriate `dotnet new` command.