Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5611919
docs: merges typescript-setup.md into development-flow/README.md and …
iOvergaard May 7, 2025
6ef67d4
docs: updates prerequisites from nodejs 20 to 22
iOvergaard May 7, 2025
3af9c32
docs: adds a new article on how to use the umbraco-extension template
iOvergaard May 7, 2025
7850943
docs: adds a link to new article
iOvergaard May 7, 2025
a11f164
Update 16/umbraco-cms/customizing/development-flow/README.md
iOvergaard May 7, 2025
e2854a2
docs: adds link to the menu to the new article and removes deleted ar…
iOvergaard May 7, 2025
ec0c596
docs: adds explanation to what `-ex` does
iOvergaard May 7, 2025
7a773fe
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
iOvergaard May 8, 2025
7a2b958
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
iOvergaard May 8, 2025
0c9326c
Update 16/umbraco-cms/customizing/development-flow/README.md
eshanrnh May 8, 2025
7040027
Update 16/umbraco-cms/customizing/development-flow/README.md
eshanrnh May 8, 2025
421c052
Update 16/umbraco-cms/customizing/development-flow/README.md
eshanrnh May 8, 2025
feca1d5
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
b3f03f3
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
81a4691
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
dac5c05
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
c605851
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
dd60c75
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
42cbbab
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
65df018
Update 16/umbraco-cms/customizing/development-flow/vite-package-setup.md
eshanrnh May 8, 2025
484be50
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
148abd1
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
1dcf50d
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
ccf8e82
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
b912660
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
c77faea
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
4829193
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
c75d14b
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
cbc3daf
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
336ba54
Update 16/umbraco-cms/customizing/development-flow/umbraco-extension-…
eshanrnh May 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 16/umbraco-cms/.gitbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ redirects:
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/styles: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/README.md
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/plugins: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/extensions.md
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/blocks: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/blocks.md
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/change-rich-text-editor-ui: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/README.md
fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/change-rich-text-editor-ui: fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/README.md
customizing/development-flow/typescript-setup: customizing/development-flow/README.md
2 changes: 1 addition & 1 deletion 16/umbraco-cms/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@
* [Extend and customize the editing experience](customizing/overview.md)
* [Project Bellissima](customizing/project-bellissima.md)
* [Setup Your Development Environment](customizing/development-flow/README.md)
* [Umbraco Extension Template](customizing/development-flow/umbraco-extension-template.md)
* [Vite Package Setup](customizing/development-flow/vite-package-setup.md)
* [TypeScript setup](customizing/development-flow/typescript-setup.md)
* [Extension Overview](customizing/extending-overview/README.md)
* [Extension Registry](customizing/extending-overview/extension-registry/README.md)
* [Extension Registration](customizing/extending-overview/extension-registry/extension-registry.md)
Expand Down
28 changes: 25 additions & 3 deletions 16/umbraco-cms/customizing/development-flow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This article will take you through setting up everything you need to start build
## Required Software

Make sure you have followed the [requirements](../../fundamentals/setup/requirements.md) article, especially having installed the following on your machine:
* [Node.js version 20.15.0 (LTS)](https://nodejs.org/en) and higher
* [Node.js version 22.15.0 (Long-Term Support)](https://nodejs.org/en) and higher

{% hint style="info" %}
Use Node Version Manager (NVM) for [Windows](https://github.com/coreybutler/nvm-windows) or [Mac/Linux](https://github.com/nvm-sh/nvm) to manage the Node.js versions.
Expand All @@ -21,6 +21,9 @@ Use Node Version Manager (NVM) for [Windows](https://github.com/coreybutler/nvm-

Extensions such as JavaScript, CSS, and manifests, will go into a folder called `App_Plugins`. If you do not have this folder, you can create it at the root of your Umbraco project.

{% hint style="info" %}
You can include the `App_Plugins` folder in the `wwwroot` folder of a Razor Class Library (RCL) project, but it is not required.
{% endhint %}
### Source Code

The source code for your extensions should ideally be placed in a different project. You can make great use of a [Razor Class Library (RCL) with static assets](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/ui-class?view=aspnetcore-8.0\&tabs=visual-studio#create-an-rcl-with-static-assets) for this purpose. This will make it easier to maintain and test your code. You can create a new project in the root of your Umbraco project, or you can create a new project in a separate folder.
Expand Down Expand Up @@ -63,7 +66,7 @@ npm init -y
Make sure that you do not install any NPM dependencies directly into the `App_Plugins` folder. This can cause issues with Build and Publish processes in MSBuild. Always install dependencies in a separate folder and use a bundler to copy the compiled files over to the `App_Plugins` folder.
{% endhint %}

### Umbraco Backoffice
### TypeScript Setup

Umbraco publishes an NPM package called `@umbraco-cms/backoffice` that holds typings and other niceties to build extensions.

Expand All @@ -75,6 +78,25 @@ npm install -D @umbraco-cms/backoffice

This will add a package to your devDependencies containing the TypeScript definitions for the Umbraco Backoffice.

**TSConfig**

Make sure to configure your TypeScript compiler so it includes the Global Types from the Backoffice. This enables you to utilize the declared Extension Types. If your project is using other Packages that provide their Extension Types, list these as well.

In your `tsconfig.json` file, add the array `types` inside `compilerOptions`, with the entry of `@umbraco-cms/backoffice/extension-types`:

```json
{
"compilerOptions": {
...
"types": [
"@umbraco-cms/backoffice/extension-types"
]
}
}
```

**Take extra care when using Vite**

It is important that this namespace is ignored in your bundler. If you are using Vite, you can add the following to your `vite.config.ts` file:

```ts
Expand Down Expand Up @@ -102,4 +124,4 @@ If you're using Visual Studio Code we recommend the extension called [Lit-Plugin

## What's Next?

Now that you have your development environment set up, you can start building your Umbraco extensions. Read more about [our recommended setup with Vite](vite-package-setup.md) to get started.
Now that you have prepared your development environment, start building your Umbraco extensions. Read the article on [Umbraco Extension Template](./umbraco-extension-template.md) to set all this up.
16 changes: 0 additions & 16 deletions 16/umbraco-cms/customizing/development-flow/typescript-setup.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
description: Use the `umbraco-extension` .NET template to create a new Umbraco extension.

Check warning on line 2 in 16/umbraco-cms/customizing/development-flow/umbraco-extension-template.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [UmbracoDocs.UmbracoTerms] We prefer 'Umbraco' over 'umbraco.' Raw Output: {"message": "[UmbracoDocs.UmbracoTerms] We prefer 'Umbraco' over 'umbraco.'", "location": {"path": "16/umbraco-cms/customizing/development-flow/umbraco-extension-template.md", "range": {"start": {"line": 2, "column": 23}}}, "severity": "WARNING"}
---

# Umbraco Extension Template

Umbraco provides a .NET template to help you get started with building extensions for the Umbraco backoffice. This template sets up a new project with all the necessary files and configurations to build an extension. The template is called `umbraco-extension` and can be used to create a new Umbraco extension project with a single command.

## Prerequisites
- [.NET SDK](https://dotnet.microsoft.com/download) version 9.0 or later

Check failure on line 10 in 16/umbraco-cms/customizing/development-flow/umbraco-extension-template.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [UmbracoDocs.Acronyms] 'SDK' has no definition Raw Output: {"message": "[UmbracoDocs.Acronyms] 'SDK' has no definition", "location": {"path": "16/umbraco-cms/customizing/development-flow/umbraco-extension-template.md", "range": {"start": {"line": 10, "column": 9}}}, "severity": "ERROR"}
- [Node.js](https://nodejs.org/en/download/) version 22 or later

## Install the Umbraco Extension Template
To install the Umbraco extension template, run the following command in your terminal:

```bash
dotnet new install Umbraco.Templates
```

This command installs both the `umbraco` and `umbraco-extension` templates, which you can use to create new Umbraco and Umbraco extension projects. If a new Umbraco project has previously been created using `dotnet new umbraco`, the templates may already be installed.

## Create a New Umbraco Extension
To create a new Umbraco extension project, run the following command in your terminal. It should be executed in a folder where you want to create the new project, for example in the root of your solution:

```bash
dotnet new umbraco-extension -n MyExtension -ex
```

This command creates a new folder called `MyExtension` with the following files and folders:
- `MyExtension.csproj`: The project file for the extension.
- `Constants.cs`: A file containing constants for the extension.
- `Client`: A folder containing the source code for the extension, a `package.json` file, a `tsconfig.json` file, and the `vite.config.ts` configuration file.
- `README.md`: A readme file with instructions on how to build and run the extension.

The `-ex` flag indicates that you want to include examples of how to use the extension. This flag is optional, but it is recommended to include it if you are new to building extensions for Umbraco. It will additionally give you:

- `Composers`: A folder containing an example composer that registers a custom Swagger API.
- `Controllers`: A folder containing an example API controller for a dashboard.
- `Client/src/api`: A folder containing an example API client that calls the API controller.
- `Client/src/dashboards`: A folder containing an example dashboard Web Component that uses the API client.

After setup, the dashboard appears in the main **Content** section of the Backoffice.

### Add the Extension to an Umbraco Project

To include the extension in your Umbraco project, you need to add a reference to the extension project in your Umbraco project.

#### Option 1: Via Visual Studio

1. Right-click the **Dependencies** node in the Umbraco project.
2. Select **Add Reference**.
3. Choose the `MyExtension` project.
4. Click **OK**.

#### Option 2: Via CLI
Run the following command in the root folder of your Umbraco project:

```bash
dotnet add reference ../MyExtension/MyExtension.csproj
```

This command adds a reference to the `MyExtension` project in your Umbraco project. You can then build your Umbraco project and see the extension in action.

## Build and Run the Extension

To build and run the extension, install the dependencies and start the Vite development server. To do this, run the following commands in the `Client` folder of your extension project:

```bash
npm install
npm run build
```

{% hint style="info" %}
The project also builds automatically when running the Umbraco project. To start the Vite development server in watch mode, run the following command:

```bash
npm run watch
```
{% endhint %}

This command compiles the TypeScript files and copies them over to the `wwwroot` output folder. Once complete, run the Umbraco project to view the extension in action.

## Publish the Project

The output files are automatically copied to the `wwwroot` folder of your Umbraco project. They are also included in the publishing process when you publish your Umbraco project. You can publish your Umbraco project using the following command:

```bash
dotnet publish --configuration Release
```

## Publish as a Package

To publish your extension as a package, create a NuGet package. Run the following command in the root folder of your extension project:

```bash
dotnet pack --configuration Release
```

This command creates a NuGet package in the `bin/Release` folder of your extension project. You can then publish this package to a NuGet feed or share it with others.

The `umbraco-extension` template is opinionated until a certain point. It is a starting point for building extensions for the Umbraco backoffice. The template includes a basic structure and configuration for building extensions, but you can customize it to fit your needs. You can add additional files, folders, and configurations as needed.

To publish your extension as an Umbraco Package, you need some additional files. For details, see the [Umbraco Package](../../customizing/umbraco-package.md) article.

### The Opinionated Starter Kit

Another option is to use the [Opinionated Umbraco Package Starter Template](https://github.com/LottePitcher/opinionated-package-starter). This is a template that includes all the files and configurations needed to build an Umbraco package. It builds on top of the `umbraco-extension` template and includes additional files and configurations for building Umbraco packages. This template is a great starting point for building Umbraco packages and includes everything you need to get started.

To install this template, run the following command in your terminal:

```bash
dotnet new install Umbraco.Community.Templates.PackageStarter
```

To create a new package project, run the following command:

```bash
dotnet new umbracopackagestarter -n YourPackageName -an "Your Name" -gu "YourGitHubUsername" -gr "YourGitHubRepoName"
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Get started with a Vite Package, setup with TypeScript and Lit
Umbraco recommends building extensions with a setup using TypeScript and a build tool such as Vite. Umbraco uses the library Lit for building web components which we will use throughout this guide.

{% hint style="info" %}
These are general recommendations for working with and building extensions for the Umbraco backoffice. You can use any framework or library of your choice.
These are general recommendations for working with and building extensions for the Umbraco backoffice. You can use any framework or library of your choice. For Umbraco's recommended approach, see the [Umbraco Extension Template](./umbraco-extension-template.md).
{% endhint %}

## Before You Begin
Expand Down Expand Up @@ -127,7 +127,7 @@ npm run build

## Watch for changes and build

To continuously work on the package and have each change built, add a `watch`script in your `package.json` with `vite build --watch`.
To continuously work on the package and have each change built, add a `watch`script in your `package.json` with `vite build --watch`.

The example below indicates where in the structure this change should be implemented:

Expand Down
Loading