Skip to content

Commit c35e240

Browse files
authored
Merge branch 'contrib' into span-split
2 parents 6dc7f35 + 900938e commit c35e240

File tree

1,731 files changed

+33644
-26411
lines changed

Some content is hidden

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

1,731 files changed

+33644
-26411
lines changed

.github/BUILD.md

Lines changed: 72 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Umbraco CMS Build
22

3+
This guide will explain how you can build the Umbraco CMS from the source code. You will most likely want to do this if your are setting up a local development environment for contributing code updates to the project. You will need this in order to develop and test your fix or feature.
4+
35
## Are you sure?
46

57
In order to use Umbraco as a CMS and build your website with it, you should not build it yourself. If you're reading this then you're trying to contribute to Umbraco or you're debugging a complex issue.
@@ -13,81 +15,117 @@ If the answer is yes, please read on. Otherwise, make sure to head on over [to t
1315

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

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

1820
Did you read ["Are you sure"](#are-you-sure)?
1921

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

2224
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.
2325

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.
26+
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...
2627

27-
#### Debugging with VS Code
28+
### Prerequisites
2829

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

31-
- [Visual Studio Code](https://code.visualstudio.com/)
32+
- 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/)
3233
- [dotnet SDK v9+](https://dotnet.microsoft.com/en-us/download)
3334
- [Node.js v20+](https://nodejs.org/en/download/)
3435
- npm v10+ (installed with Node.js)
3536
- [Git command line](https://git-scm.com/download/)
3637

37-
Open the root folder of the repository in Visual Studio Code.
38+
### Familiarizing yourself with the code
39+
40+
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.
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 two web projects in the solution with client-side assets based on TypeScript, `Umbraco.Web.UI.Client` and `Umbraco.Web.UI.Login`.
4043

41-
You can also run the tasks manually on the command line:
44+
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.
45+
46+
Here are some suggestions based on how we work on developing Umbraco at HQ.
47+
48+
### First checkout
49+
50+
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.
4251

4352
```
44-
cd src\Umbraco.Web.UI.Client
45-
npm i
46-
npm run build:for:cms
53+
cd <solution root>\src\Umbraco.Web.UI
54+
dotnet run --no-build
4755
```
4856

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.
57+
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.
58+
59+
### Back-end only changes
5060

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

5365
```
54-
cd src\Umbraco.Web.UI.Login
55-
npm i
56-
npm run dev
66+
REM npm ci --no-fund --no-audit --prefer-offline
67+
REM npm run build:for:cms
5768
```
5869

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`.
70+
Just be careful not to include this change in your PR.
71+
72+
### Front-end only changes
6073

61-
To run the C# portion of the project, either hit <kbd>F5</kbd> to begin debugging, or manually using the command line:
74+
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`:
6275

6376
```
64-
dotnet watch --project .\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj
77+
"BackOfficeHost": "http://localhost:5173",
78+
"AuthorizeCallbackPathName": "/oauth_complete",
79+
"AuthorizeCallbackLogoutPathName": "/logout",
80+
"AuthorizeCallbackErrorPathName": "/error"
6581
```
6682

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.**
83+
Then run Umbraco from the command line.
6884

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.
85+
```
86+
cd <solution root>\src\Umbraco.Web.UI
87+
dotnet run --no-build
88+
```
7089

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

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

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/)
97+
You'll find as you make changes to the front-end files, the updates will be picked up and your browser refreshed automatically.
98+
99+
> [!NOTE]
100+
> 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.
79101
80-
The easiest way to get started is to open `umbraco.sln` in Visual Studio.
102+
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:
81103

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.
104+
```
105+
cd <solution root>\src\Umbraco.Web.UI.Login
106+
npm run build
107+
```
83108

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.
109+
In both front-end projects, if you've refreshed your branch from the latest on GitHub you may need to update front-end dependencies.
85110

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.
111+
To do that, run:
87112

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.**
113+
```
114+
npm ci --no-fund --no-audit --prefer-offline
115+
```
116+
117+
### Full-stack changes
118+
119+
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.
120+
121+
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:
122+
123+
```
124+
cd <solution root>\src\Umbraco.Web.UI.Client
125+
npm run generate:server-api-dev
126+
```
89127

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.
128+
Please also update the `OpenApi.json` file held in the solution by copying and pasting the output from `/umbraco/swagger/management/swagger.json`.
91129

92130
## Building from source
93131

@@ -148,5 +186,4 @@ The produced artifacts are published in a container that can be downloaded from
148186
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).
149187

150188
[ 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 "
152189
[ 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: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,43 @@
44

55
These contribution guidelines are mostly just that - guidelines, not rules. This is what we've found to work best over the years, but if you choose to ignore them, we still love you! 💖 Use your best judgement, and feel free to propose changes to this document in a pull request.
66

7-
## Getting Started
87
We have a guide on [what to consider before you start](contributing-before-you-start.md) and more detailed guides at the end of this article.
98

10-
The following steps are a quick-start guide:
9+
## Contribution guide
10+
11+
This guide describes each step to make your first contribution:
1112

1213
1. **Fork**
1314

1415
Create a fork of [`Umbraco-CMS` on GitHub](https://github.com/umbraco/Umbraco-CMS)
15-
16+
1617
![Fork the repository](img/forkrepository.png)
17-
18+
1819
2. **Clone**
1920

2021
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-
22+
23+
![Clone the fork](img/clonefork.png)
24+
2425
3. **Switch to the correct branch**
2526

2627
Switch to the `contrib` branch
2728

28-
4. **Build**
29+
4. **Branch out**
30+
31+
Create a new branch based on `contrib` and name it after the issue you're fixing, For example: `v15/bugfix/18132-rte-tinymce-onchange-value-check`.
32+
33+
Please follow this format for branches: `v{major}/{feature|bugfix|task}/{issue}-{description}`.
34+
35+
This is a development branch for the particular issue you're working on, in this case a bug-fix for issue number `18132` that affects Umbraco v.15.
36+
37+
Don't commit to `contrib`, create a new branch first.
2938

30-
Build your fork of Umbraco locally [as described in the build documentation](BUILD.md), you can build with any IDE that supports dotnet or the command line.
39+
5. **Build or run a Development Server**
3140

32-
5. **Branch**
41+
You can build or run a Development Server with any IDE that supports DotNet or the command line.
3342

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.
43+
Read [Build or run a Development Server](BUILD.md) for the right approach to your needs.
3544

3645
6. **Change**
3746

@@ -41,7 +50,7 @@ The following steps are a quick-start guide:
4150

4251
Done? Yay! 🎉
4352

44-
Remember to commit to your new `temp` branch, and don't commit to `contrib`. Then you can push the changes up to your fork on GitHub.
53+
Remember to commit to your branch. When it's ready push the changes to your fork on GitHub.
4554

4655
8. **Create pull request**
4756

.github/workflows/test-backoffice.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
- name: Check for circular dependencies
4444
run: node devops/circular/index.js src
4545
- run: npm run lint:errors
46+
- run: npm run generate:tsconfig
47+
- run: npm run generate:icons
4648
- run: npm run build:for:cms
4749
- run: npm run check:paths
4850
- run: npm run generate:jsonschema:dist

0 commit comments

Comments
 (0)