You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/BUILD.md
+72-35Lines changed: 72 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Umbraco CMS Build
2
2
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
+
3
5
## Are you sure?
4
6
5
7
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
13
15
14
16
↖️ You can jump to any section by using the "table of contents" button (  ) above.
15
17
16
-
## Debugging source locally
18
+
## Working with the Umbraco source code
17
19
18
20
Did you read ["Are you sure"](#are-you-sure)?
19
21
20
22
[More details about contributing to Umbraco and how to use the GitHub tooling can be found in our guide to contributing.][contribution guidelines]
21
23
22
24
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.
23
25
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...
26
27
27
-
#### Debugging with VS Code
28
+
###Prerequisites
28
29
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.
30
31
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/)
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.
38
41
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`.
40
43
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.
42
51
43
52
```
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
47
55
```
48
56
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
50
60
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:
52
64
53
65
```
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
57
68
```
58
69
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
60
73
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`:
**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.
68
84
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
+
```
70
89
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.
72
91
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
+
```
74
96
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)
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.
79
101
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:
81
103
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
+
```
83
108
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.
85
110
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:
87
112
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
+
```
89
127
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`.
91
129
92
130
## Building from source
93
131
@@ -148,5 +186,4 @@ The produced artifacts are published in a container that can be downloaded from
148
186
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).
149
187
150
188
[ 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 "
152
189
[ disable browser caching ]: https://techwiser.com/disable-cache-google-chrome-firefox"Instructions on how to disable browser caching in Chrome and Firefox"
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+21-12Lines changed: 21 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,34 +4,43 @@
4
4
5
5
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.
6
6
7
-
## Getting Started
8
7
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.
9
8
10
-
The following steps are a quick-start guide:
9
+
## Contribution guide
10
+
11
+
This guide describes each step to make your first contribution:
11
12
12
13
1.**Fork**
13
14
14
15
Create a fork of [`Umbraco-CMS` on GitHub](https://github.com/umbraco/Umbraco-CMS)
15
-
16
+
16
17

17
-
18
+
18
19
2.**Clone**
19
20
20
21
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
-

23
-
22
+
23
+

24
+
24
25
3.**Switch to the correct branch**
25
26
26
27
Switch to the `contrib` branch
27
28
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.
29
38
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**
31
40
32
-
5.**Branch**
41
+
You can build or run a Development Server with any IDE that supports DotNet or the command line.
33
42
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.
35
44
36
45
6.**Change**
37
46
@@ -41,7 +50,7 @@ The following steps are a quick-start guide:
41
50
42
51
Done? Yay! 🎉
43
52
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.
0 commit comments