Skip to content

Commit a639fe0

Browse files
authored
Merge branch 'v15/dev' into v15/feature/block-type-element-not-found
2 parents b4e59de + 460c0b3 commit a639fe0

File tree

73 files changed

+673
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+673
-286
lines changed

.github/BUILD.md

Lines changed: 70 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,81 +13,117 @@ If the answer is yes, please read on. Otherwise, make sure to head on over [to t
1313

1414
↖️ You can jump to any section by using the "table of contents" button ( ![Table of contents icon](img/tableofcontentsicon.svg) ) above.
1515

16-
## Debugging source locally
16+
## Working with the Umbraco source code
1717

1818
Did you read ["Are you sure"](#are-you-sure)?
1919

2020
[More details about contributing to Umbraco and how to use the GitHub tooling can be found in our guide to contributing.][contribution guidelines]
2121

2222
If you want to run a build without debugging, see [Building from source](#building-from-source) below. This runs the build in the same way it is run on our build servers.
2323

24-
> [!NOTE]
25-
> The caching for the back office has been described as 'aggressive' so we often find it's best when making back office changes to [disable caching in the browser (check "Disable cache" on the "Network" tab of developer tools)][disable browser caching] to help you to see the changes you're making.
24+
If you've got this far and are keen to get stuck in helping us fix a bug or implement a feature, great! Please read on...
2625

27-
#### Debugging with VS Code
26+
### Prerequisites
2827

29-
In order to build the Umbraco source code locally with Visual Studio Code, first make sure you have the following installed.
28+
In order to work with the Umbraco source code locally, first make sure you have the following installed.
3029

31-
- [Visual Studio Code](https://code.visualstudio.com/)
30+
- Your favourite IDE: [Visual Studio 2022 v17+ with .NET 7+](https://visualstudio.microsoft.com/vs/), [Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/)
3231
- [dotnet SDK v9+](https://dotnet.microsoft.com/en-us/download)
3332
- [Node.js v20+](https://nodejs.org/en/download/)
3433
- npm v10+ (installed with Node.js)
3534
- [Git command line](https://git-scm.com/download/)
3635

37-
Open the root folder of the repository in Visual Studio Code.
36+
### Familiarizing yourself with the code
37+
38+
Umbraco is a .NET application using C#. The solution is broken down into multiple projects. There are several class libraries. The `Umbraco.Web.UI` project is the main project that hosts the back office and login screen. This is the project you will want to run to see your changes.
39+
40+
There are two web projects in the solution with client-side assets based on TypeScript, `Umbraco.Web.UI.Client` and `Umbraco.Web.UI.Login`.
3841

39-
To build the front-end you'll need to open the command pallet (<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>) and run `>Tasks: Run Task` followed by `Client Build`.
42+
There are a few different ways to work locally when implementing features or fixing issues with the Umbraco CMS. Depending on whether you are working solely on the front-end, solely on the back-end, or somewhere in between, you may find different workflows work best for you.
4043

41-
You can also run the tasks manually on the command line:
44+
Here are some suggestions based on how we work on developing Umbraco at HQ.
45+
46+
### First checkout
47+
48+
When you first clone the source code, build the whole solution via your IDE. You can then start the `Umbraco.Web.UI` project via the IDE or the command line and should find everything across front and back-end is built and running.
4249

4350
```
44-
cd src\Umbraco.Web.UI.Client
45-
npm i
46-
npm run build:for:cms
51+
cd <solution root>\src\Umbraco.Web.UI
52+
dotnet run --no-build
4753
```
4854

49-
If you want to make changes to the UI, you can choose to run a front-end development server. To learn more please read the Umbraco.Web.UI.Client README.md [Run against a local Umbraco instance](../src/Umbraco.Web.UI.Client/.github/README.md#run-against-a-local-umbraco-instance) for more information.
55+
When the page loads in your web browser, you can follow the installer to set up a database for debugging. When complete, you will have an empty Umbraco installation to begin working with. You may also wish to install a [starter kit][https://marketplace.umbraco.com/category/themes-&-starter-kits] to ease your debugging.
56+
57+
### Back-end only changes
58+
59+
If you are working on back-end only features, when switching branches or pulling down the latest from GitHub, you will find the front-end getting rebuilt periodically when you look to build the back-end changes. This can take a while and slow you down. So if for a period of time you don't care about changes in the front-end, you can disable this build step.
5060

51-
The login screen is a different frontend build, for that one you can run it as follows:
61+
Go to `Umbraco.Cms.StaticAssets.csproj` and comment out the following lines of MsBuild by adding a REM statement in front:
5262

5363
```
54-
cd src\Umbraco.Web.UI.Login
55-
npm i
56-
npm run dev
64+
REM npm ci --no-fund --no-audit --prefer-offline
65+
REM npm run build:for:cms
5766
```
5867

59-
If you just want to build the Login screen to `Umbraco.Web.UI` then instead of running `dev`, you can do: `npm run build`.
68+
Just be careful not to include this change in your PR.
6069

61-
To run the C# portion of the project, either hit <kbd>F5</kbd> to begin debugging, or manually using the command line:
70+
### Front-end only changes
71+
72+
Conversely, if you are working on front-end only, you want to build the back-end once and then run it. Before you do so, update the configuration in `appSettings.json` to add the following under `Umbraco:Cms:Security`:
6273

6374
```
64-
dotnet watch --project .\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj
75+
"BackOfficeHost": "http://localhost:5173",
76+
"AuthorizeCallbackPathName": "/oauth_complete",
77+
"AuthorizeCallbackLogoutPathName": "/logout",
78+
"AuthorizeCallbackErrorPathName": "/error"
6579
```
6680

67-
**The initial C# build might take a _really_ long time (seriously, go and make a cup of coffee!) - but don't worry, this will be faster on subsequent runs.**
81+
Then run Umbraco from the command line.
6882

69-
When the page eventually loads in your web browser, you can follow the installer to set up a database for debugging. You may also wish to install a [starter kit][starter kits] to ease your debugging.
83+
```
84+
cd <solution root>\src\Umbraco.Web.UI
85+
dotnet run --no-build
86+
```
7087

71-
#### Debugging with Visual Studio
88+
In another terminal window, run the following to watch the front-end changes and launch Umbraco using the URL indicated from this task.
7289

73-
In order to build the Umbraco source code locally with Visual Studio, first make sure you have the following installed.
90+
```
91+
cd <solution root>\src\Umbraco.Web.UI.Client
92+
npm run dev:server
93+
```
7494

75-
- [Visual Studio 2022 v17+ with .NET 7+](https://visualstudio.microsoft.com/vs/) ([the community edition is free](https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15) for you to use to contribute to Open Source projects)
76-
- [Node.js v20+](https://nodejs.org/en/download/)
77-
- npm v10+ (installed with Node.js)
78-
- [Git command line](https://git-scm.com/download/)
95+
You'll find as you make changes to the front-end files, the updates will be picked up and your browser refreshed automatically.
96+
97+
> [!NOTE]
98+
> The caching for the back office has been described as 'aggressive' so we often find it's best when making back office changes to [disable caching in the browser (check "Disable cache" on the "Network" tab of developer tools)][disable browser caching] to help you to see the changes you're making.
99+
100+
Whilst most of the backoffice code lives in `Umbraco.Web.UI.Client`, the login screen is in a separate project. If you do any work with that you can build with:
101+
102+
```
103+
cd <solution root>\src\Umbraco.Web.UI.Login
104+
npm run build
105+
```
106+
107+
In both front-end projects, if you've refreshed your branch from the latest on GitHub you may need to update front-end dependencies.
79108

80-
The easiest way to get started is to open `umbraco.sln` in Visual Studio.
109+
To do that, run:
81110

82-
Umbraco is a C# based codebase, which is mostly ASP.NET Core MVC based. You can make changes, build them in Visual Studio, and hit <kbd>F5</kbd> to see the result. There are two web projects in the solution, `Umbraco.Web.UI.Client` and `Umbraco.Web.UI.Login`. They each have their own build process and can be run separately. The `Umbraco.Web.UI` project is the main project that hosts the back office and login screen. This is the project you will want to run to see your changes. It will automatically restore and build the client projects when you run it.
111+
```
112+
npm ci --no-fund --no-audit --prefer-offline
113+
```
83114

84-
If you want to watch the UI Client to `Umbraco.Web.UI` then you can open a terminal in `src/Umbraco.Web.UI.Client` where you can run `npm run dev:mock` manually. This will launch the Vite dev server on http://localhost:5173 and watch for changes with mocked API responses.
115+
### Full-stack changes
85116

86-
You can also run `npm run dev:server` to run the Vite server against a local Umbraco instance. In this case, you need to have the .NET project running and accept connections from the Vite server. Please see the Umbraco.Web.UI.Client README.md [Run against a local Umbraco instance](../src/Umbraco.Web.UI.Client/.github/README.md#run-against-a-local-umbraco-instance) for more information.
117+
If working across both front and back-end, follow both methods and use `dotnet watch`, or re-run `dotnet run` (or `dotnet build` followed by `dotnet run --no-build`) whenever you need to update the back-end code.
87118

88-
**The initial C# build might take a _really_ long time (seriously, go and make a cup of coffee!) - but don't worry, this will be faster on subsequent runs.**
119+
Request and response models used by the management APIs are made available client-side as generated code. If you make changes to the management API, you can re-generate the typed client code with:
120+
121+
```
122+
cd <solution root>\src\Umbraco.Web.UI.Client
123+
npm run generate:server-api-dev
124+
```
89125

90-
When the page eventually loads in your web browser, you can follow the installer to set up a database for debugging. You may also wish to install a [starter kit][starter kits] to ease your debugging.
126+
Please also update the `OpenApi.json` file held in the solution by copying and pasting the output from `/umbraco/swagger/management/swagger.json`.
91127

92128
## Building from source
93129

@@ -148,5 +184,4 @@ The produced artifacts are published in a container that can be downloaded from
148184
Git might have issues dealing with long file paths during build. You may want/need to enable `core.longpaths` support (see [this page](https://github.com/msysgit/msysgit/wiki/Git-cannot-create-a-file-or-directory-with-a-long-path) for details).
149185

150186
[ contribution guidelines]: CONTRIBUTING.md "Read the guide to contributing for more details on contributing to Umbraco"
151-
[ starter kits ]: https://our.umbraco.com/packages/?category=Starter%20Kits&version=9 "Browse starter kits available for v9 on Our "
152187
[ disable browser caching ]: https://techwiser.com/disable-cache-google-chrome-firefox "Instructions on how to disable browser caching in Chrome and Firefox"

.github/CONTRIBUTING.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ The following steps are a quick-start guide:
1212
1. **Fork**
1313

1414
Create a fork of [`Umbraco-CMS` on GitHub](https://github.com/umbraco/Umbraco-CMS)
15-
15+
1616
![Fork the repository](img/forkrepository.png)
17-
17+
1818
2. **Clone**
1919

2020
When GitHub has created your fork, you can clone it in your favorite Git tool or on the command line with `git clone https://github.com/[YourUsername]/Umbraco-CMS`.
21-
22-
![Clone the fork](img/clonefork.png)
23-
21+
22+
![Clone the fork](img/clonefork.png)
23+
2424
3. **Switch to the correct branch**
2525

2626
Switch to the `contrib` branch
@@ -31,7 +31,11 @@ The following steps are a quick-start guide:
3131

3232
5. **Branch**
3333

34-
Create a new branch now and name it after the issue you're fixing, we usually follow the format: `temp/12345`. This means it's a temporary branch for the particular issue you're working on, in this case issue number `12345`. Don't commit to `contrib`, create a new branch first.
34+
Create a new branch now and name it after the issue you're fixing, we usually follow the format: `v{major}/{feature|bugfix|task}/{issue}-{description}`. For example: `v15/bugfix/18132-rte-tinymce-onchange-value-check`.
35+
36+
This means it's a temporary branch for the particular issue you're working on, in this case a bug fix for issue number `18132` that affects Umbraco 15.
37+
38+
Don't commit to `contrib`, create a new branch first.
3539

3640
6. **Change**
3741

src/Umbraco.Cms.Api.Delivery/Querying/QueryOptionBase.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.Extensions.DependencyInjection;
22
using Umbraco.Cms.Core.DeliveryApi;
33
using Umbraco.Cms.Core.DependencyInjection;
4+
using Umbraco.Cms.Core.Models.PublishedContent;
45
using Umbraco.Cms.Core.PublishedCache;
56
using Umbraco.Extensions;
67

@@ -10,8 +11,8 @@ public abstract class QueryOptionBase
1011
{
1112
private readonly IRequestRoutingService _requestRoutingService;
1213
private readonly IRequestPreviewService _requestPreviewService;
13-
private readonly IRequestCultureService _requestCultureService;
1414
private readonly IApiDocumentUrlService _apiDocumentUrlService;
15+
private readonly IVariationContextAccessor _variationContextAccessor;
1516

1617
[Obsolete("Please use the non-obsolete constructor. Will be removed in V17.")]
1718
public QueryOptionBase(
@@ -20,8 +21,8 @@ public QueryOptionBase(
2021
: this(
2122
requestRoutingService,
2223
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
23-
StaticServiceProvider.Instance.GetRequiredService<IRequestCultureService>(),
24-
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>())
24+
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
25+
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>())
2526
{
2627
}
2728

@@ -31,21 +32,22 @@ public QueryOptionBase(
3132
IRequestRoutingService requestRoutingService,
3233
IRequestPreviewService requestPreviewService,
3334
IRequestCultureService requestCultureService,
34-
IApiDocumentUrlService apiDocumentUrlService)
35-
: this(requestRoutingService, requestPreviewService, requestCultureService, apiDocumentUrlService)
35+
IApiDocumentUrlService apiDocumentUrlService,
36+
IVariationContextAccessor variationContextAccessor)
37+
: this(requestRoutingService, requestPreviewService, apiDocumentUrlService, variationContextAccessor)
3638
{
3739
}
3840

3941
public QueryOptionBase(
4042
IRequestRoutingService requestRoutingService,
4143
IRequestPreviewService requestPreviewService,
42-
IRequestCultureService requestCultureService,
43-
IApiDocumentUrlService apiDocumentUrlService)
44+
IApiDocumentUrlService apiDocumentUrlService,
45+
IVariationContextAccessor variationContextAccessor)
4446
{
4547
_requestRoutingService = requestRoutingService;
4648
_requestPreviewService = requestPreviewService;
47-
_requestCultureService = requestCultureService;
4849
_apiDocumentUrlService = apiDocumentUrlService;
50+
_variationContextAccessor = variationContextAccessor;
4951
}
5052

5153
protected Guid? GetGuidFromQuery(string queryStringValue)
@@ -64,7 +66,7 @@ public QueryOptionBase(
6466
var contentRoute = _requestRoutingService.GetContentRoute(queryStringValue);
6567
return _apiDocumentUrlService.GetDocumentKeyByRoute(
6668
contentRoute,
67-
_requestCultureService.GetRequestedCulture(),
69+
_variationContextAccessor.VariationContext?.Culture,
6870
_requestPreviewService.IsPreview());
6971
}
7072
}

src/Umbraco.Cms.Api.Delivery/Querying/Selectors/AncestorsSelector.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Umbraco.Cms.Api.Delivery.Indexing.Selectors;
33
using Umbraco.Cms.Core.DeliveryApi;
44
using Umbraco.Cms.Core.DependencyInjection;
5+
using Umbraco.Cms.Core.Models.PublishedContent;
56
using Umbraco.Cms.Core.PublishedCache;
67
using Umbraco.Cms.Core.Services.Navigation;
78

@@ -20,10 +21,9 @@ public AncestorsSelector(
2021
IRequestPreviewService requestPreviewService)
2122
: this(
2223
requestRoutingService,
23-
StaticServiceProvider.Instance.GetRequiredService<IPublishedContentCache>(),
24-
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
25-
StaticServiceProvider.Instance.GetRequiredService<IRequestCultureService>(),
24+
requestPreviewService,
2625
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
26+
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>(),
2727
navigationQueryService)
2828
{
2929
}
@@ -35,10 +35,9 @@ public AncestorsSelector(
3535
IDocumentNavigationQueryService navigationQueryService)
3636
: this(
3737
requestRoutingService,
38-
StaticServiceProvider.Instance.GetRequiredService<IPublishedContentCache>(),
3938
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
40-
StaticServiceProvider.Instance.GetRequiredService<IRequestCultureService>(),
4139
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
40+
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>(),
4241
navigationQueryService)
4342
{
4443
}
@@ -47,32 +46,31 @@ public AncestorsSelector(
4746
public AncestorsSelector(IPublishedContentCache publishedContentCache, IRequestRoutingService requestRoutingService)
4847
: this(
4948
requestRoutingService,
50-
StaticServiceProvider.Instance.GetRequiredService<IPublishedContentCache>(),
5149
StaticServiceProvider.Instance.GetRequiredService<IRequestPreviewService>(),
52-
StaticServiceProvider.Instance.GetRequiredService<IRequestCultureService>(),
5350
StaticServiceProvider.Instance.GetRequiredService<IApiDocumentUrlService>(),
51+
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>(),
5452
StaticServiceProvider.Instance.GetRequiredService<IDocumentNavigationQueryService>())
5553
{
5654
}
5755

5856
public AncestorsSelector(
5957
IRequestRoutingService requestRoutingService,
6058
IRequestPreviewService requestPreviewService,
61-
IRequestCultureService requestCultureService,
6259
IApiDocumentUrlService apiDocumentUrlService,
60+
IVariationContextAccessor variationContextAccessor,
6361
IDocumentNavigationQueryService navigationQueryService)
64-
: base(requestRoutingService, requestPreviewService, requestCultureService, apiDocumentUrlService)
62+
: base(requestRoutingService, requestPreviewService, apiDocumentUrlService, variationContextAccessor)
6563
=> _navigationQueryService = navigationQueryService;
6664

6765
[Obsolete("Use the constructor that takes all parameters. Scheduled for removal in V17.")]
6866
public AncestorsSelector(
6967
IRequestRoutingService requestRoutingService,
7068
IPublishedContentCache publishedContentCache,
7169
IRequestPreviewService requestPreviewService,
72-
IRequestCultureService requestCultureService,
7370
IApiDocumentUrlService apiDocumentUrlService,
71+
IVariationContextAccessor variationContextAccessor,
7472
IDocumentNavigationQueryService navigationQueryService)
75-
: this(requestRoutingService, requestPreviewService, requestCultureService, apiDocumentUrlService, navigationQueryService)
73+
: this(requestRoutingService, requestPreviewService, apiDocumentUrlService, variationContextAccessor, navigationQueryService)
7674
{
7775
}
7876

0 commit comments

Comments
 (0)