Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V15] Updated dotnet template for Umbraco Packages with Bellisima #17108

Open
wants to merge 55 commits into
base: v15/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
605e611
[WIP] Create Umbraco/Bellissima Package
leekelleher Sep 22, 2023
5ab1338
Removes existing 'UmbracoPackage'
warrenbuckley Sep 21, 2024
02fb723
Rename existing UmbracoPackageRCL to UmbracoPackage
warrenbuckley Sep 21, 2024
50d8bb1
Drop the mentions of RCL in the identifiers
warrenbuckley Sep 21, 2024
55b0bf9
CodeQL GitHub Action is complaining due to V15 wanting v9 .NET
warrenbuckley Sep 21, 2024
9a649d0
Merge remote-tracking branch 'origin/contrib' into v15/dotnet-package…
warrenbuckley Oct 3, 2024
87c968a
Rename UmbracoPackage template to UmbracoExtension
warrenbuckley Oct 3, 2024
b65b77c
Remove package lock as npm install by the OS should generate this and…
warrenbuckley Oct 3, 2024
c1c695a
Move JS clientside stuff into a folder called Client
warrenbuckley Oct 3, 2024
daa820d
Add in .VSCode recommened extensions file to get the useful Lit Exten…
warrenbuckley Oct 3, 2024
e724482
For now remove the example dashboard & prop editor
warrenbuckley Oct 3, 2024
58ccd12
Add a simple entrypoint
warrenbuckley Oct 3, 2024
b143174
Fix path for primary output after rename
warrenbuckley Oct 3, 2024
7319c86
Use link suggested from Lotte
warrenbuckley Oct 3, 2024
5cb7c28
Use backofficeEntryPoint as entryPoint is deprecated
warrenbuckley Oct 3, 2024
cc51289
Update the umbraco-package.json to opt into telemetry as per PR sugge…
warrenbuckley Oct 4, 2024
7851e4f
Improve commented code to include a link to docs
warrenbuckley Oct 4, 2024
48281a4
Improve readme from suggestions
warrenbuckley Oct 4, 2024
f03d7b8
Updates package.json to use latest Vite & TS
warrenbuckley Oct 4, 2024
76052c0
Adds the base property suggestion from Jacob & puts in a comment as t…
warrenbuckley Oct 4, 2024
7758208
Work in progress from hackathon day/afternoon
warrenbuckley Oct 11, 2024
ab6383e
Merge branch 'v15/dev' into v15/dotnet-package-bellisima
warrenbuckley Oct 16, 2024
8649dd5
Merge branch 'v15/dev' into v15/dotnet-package-bellisima
warrenbuckley Oct 17, 2024
6f8c53b
Adds in new property/flag/switch for dotnet new template
warrenbuckley Oct 17, 2024
de4c4e2
Warren cant spell Whether 🙈
warrenbuckley Oct 17, 2024
327fdeb
Update template.json to exclude the sample files if flag is not set/f…
warrenbuckley Oct 17, 2024
681e9c2
Make SLN happy/build
warrenbuckley Oct 17, 2024
4bde1f8
Conditional content in files for IncludeExample flag/switch
warrenbuckley Oct 17, 2024
d149b30
Need to include the content otherwise it doesnt get packed by nuget
warrenbuckley Oct 17, 2024
7478db7
Fix the path for the openapi-ts-config.ts file to be included/excluded
warrenbuckley Oct 17, 2024
de7f8ed
Use the project name from the dotnet new to help name manifests
warrenbuckley Oct 17, 2024
a9a3466
Update namespaces so they get updated when dotnet new templatge is ru…
warrenbuckley Oct 17, 2024
369c397
Updated example
warrenbuckley Oct 17, 2024
3bf5618
Fix up VS Code recommended extension for Lit VSCode
warrenbuckley Oct 18, 2024
c96fa4e
Fix up build - as we dont use the imported UmbCurrentUserContext
warrenbuckley Oct 18, 2024
3bf96cd
Remove the relative path to the JSON schema as unable to know path to…
warrenbuckley Oct 18, 2024
30b86d8
Merge branch 'v15/dev' into v15/dotnet-package-bellisima
warrenbuckley Oct 24, 2024
f076ab3
Merge branch 'v15/dev' into v15/dotnet-package-bellisima
warrenbuckley Oct 28, 2024
882a2a1
Merge branch 'v15/dev' into v15/dotnet-package-bellisima
warrenbuckley Oct 30, 2024
c5a0efd
Typo fix as spooted by Rich
warrenbuckley Oct 31, 2024
1c550a3
Update templates/UmbracoExtension/.template.config/template.json
warrenbuckley Oct 31, 2024
6bbdd9b
Adds a --site-domain flag/switch to use for setting the domain prefix
warrenbuckley Oct 31, 2024
93327b8
Rename stuff so its not 'example' & only have ping if include-example…
warrenbuckley Oct 31, 2024
ebef2c1
As agreed with Lotte makes sense we always generate OpenAPI & TS client
warrenbuckley Oct 31, 2024
271e6a6
Update umbraco-extension description
LottePitcher Oct 31, 2024
ddcb094
Generic node script to generate the TS client
warrenbuckley Nov 1, 2024
66f925a
Merge branch 'v15/dotnet-package-bellisima' of https://github.com/war…
warrenbuckley Nov 1, 2024
68ad0cd
Generated API has conditional stuff in now to have just Ping or the m…
warrenbuckley Nov 1, 2024
424ff2b
Adds symbols safeNamespace and safeName
warrenbuckley Nov 1, 2024
9ca3121
Merge branch 'v15/dev' into v15/dotnet-package-bellisima
warrenbuckley Nov 5, 2024
bf85f5a
Merge branch 'v15/dev' into v15/dotnet-package-bellisima
warrenbuckley Nov 5, 2024
4d8e0fe
change to use Umbraco.Extension as sourcename - check \.template.conf…
LottePitcher Nov 6, 2024
95ae476
use '-sd' as shortname for site-domain as otherwise shows up as '-p:d'
LottePitcher Nov 6, 2024
a12fb66
fix typescript build error when not including examples
LottePitcher Nov 6, 2024
c0a4d6f
use provided name for API description as always being added
LottePitcher Nov 6, 2024
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
9 changes: 8 additions & 1 deletion templates/Umbraco.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Content Include="UmbracoPackage\**" Exclude="bin;obj" />
<Content Include="UmbracoPackageRcl\**" Exclude="bin;obj" />
<Content Include="UmbracoProject\**" Exclude="bin;obj" />
<Content Include="UmbracoDockerCompose\**" Exclude="bin;obj"/>
<Content Include="UmbracoDockerCompose\**" Exclude="bin;obj" />
<Content Include="..\src\Umbraco.Web.UI\Views\Partials\blocklist\**">
<Link>UmbracoProject\Views\Partials\blocklist\%(RecursiveDir)%(Filename)%(Extension)</Link>
<PackagePath>UmbracoProject\Views\Partials\blocklist</PackagePath>
Expand All @@ -32,6 +32,13 @@
<Link>UmbracoProject\Views\_ViewImports.cshtml</Link>
<PackagePath>UmbracoProject\Views</PackagePath>
</Content>
<Content Include="UmbracoExtension\.template.config\dotnetcli.host.json" />
<Content Include="UmbracoExtension\.template.config\ide.host.json" />
<Content Include="UmbracoExtension\.template.config\template.json" />
</ItemGroup>
<ItemGroup>
<None Include="UmbracoExtension\Client\.vscode\extensions.ts" />
<None Include="UmbracoExtension\UmbracoExtension.csproj" />
</ItemGroup>
<!-- Update template.json files with the default UmbracoVersion value set to the current build version -->
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"order": 0,
"icon": "../../icon.png",
"description": {
"id": "UmbracoPackageRcl",
"text": "Umbraco Package RCL - An empty Umbraco package/plugin (Razor Class Library)."
"id": "UmbracoExtension",
"text": "Umbraco Extension - An empty Umbraco extension/plugin (Razor Class Library)."
},
"symbolInfo": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
"Web",
"CMS",
"Umbraco",
"Package",
"Extension",
"Plugin",
"Razor Class Library"
],
"name": "Umbraco Package RCL",
"description": "An empty Umbraco package/plugin (Razor Class Library).",
"groupIdentity": "Umbraco.Templates.UmbracoPackageRcl",
"identity": "Umbraco.Templates.UmbracoPackageRcl.CSharp",
"shortName": "umbracopackage-rcl",
"name": "Umbraco Extension",
"description": "An empty Umbraco extension (Razor Class Library).",
"groupIdentity": "Umbraco.Templates.UmbracoExtension",
"identity": "Umbraco.Templates.UmbracoExtension",
"shortName": "umbraco-extension",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "UmbracoPackage",
"defaultName": "UmbracoPackage1",
"sourceName": "UmbracoExtension",
"defaultName": "UmbracoExtension1",
"preferNameDirectory": true,
"symbols": {
"Framework": {
Expand All @@ -39,7 +39,7 @@
},
"UmbracoVersion": {
"displayName": "Umbraco version",
"description": "The version of Umbraco.Cms to add as PackageReference.",
"description": "The version of Umbraco.Cms to add as PackageReference. By default it installs the latest non pre-release version",
"type": "parameter",
"datatype": "string",
"defaultValue": "*",
Expand All @@ -58,11 +58,17 @@
"defaultValue": "false",
"displayName": "Support pages and views",
"description": "Whether to support adding traditional Razor pages and Views to this library."
},
"kebabCasedName": {
"type": "derived",
"valueSource": "name",
"replaces": "PROJECT_NAME_KEBABCASE_FOR_NPM",
"valueTransform": "kebabCase"
}
},
"primaryOutputs": [
{
"path": "UmbracoPackage.csproj"
"path": "UmbracoExtension.csproj"
}
],
"postActions": [
Expand Down
5 changes: 5 additions & 0 deletions templates/UmbracoExtension/Client/.vscode/extensions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"runem.lit-plugin"
]
}
15 changes: 15 additions & 0 deletions templates/UmbracoExtension/Client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "PROJECT_NAME_KEBABCASE_FOR_NPM",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "tsc && vite build --watch",
"build": "tsc && vite build"
},
"devDependencies": {
"@umbraco-cms/backoffice": "^UMBRACO_VERSION_FROM_TEMPLATE",
"typescript": "^5.2.2",
"vite": "^4.4.9"
}
}
15 changes: 15 additions & 0 deletions templates/UmbracoExtension/Client/public/umbraco-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "../../umbraco-package-schema.json",
"id": "UmbracoExtension",
"name": "UmbracoExtension",
"version": "0.0.0",
"allowPackageTelemetry": false,
warrenbuckley marked this conversation as resolved.
Show resolved Hide resolved
"extensions": [
{
"name": "UmbracoExtension EntryPoint",
"alias": "PROJECT_NAME_KEBABCASE_FOR_NPM.entrypoint",
"type": "backofficeEntryPoint",
warrenbuckley marked this conversation as resolved.
Show resolved Hide resolved
"js": "/App_Plugins/UmbracoExtension/PROJECT_NAME_KEBABCASE_FOR_NPM.js"
}
]
}
12 changes: 12 additions & 0 deletions templates/UmbracoExtension/Client/src/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { UmbEntryPointOnInit } from '@umbraco-cms/backoffice/extension-api';

// load up the manifests here
export const onInit: UmbEntryPointOnInit = (_host, _extensionRegistry) => {

console.log('Hello from my extension');

//// We can register many manifests at once via code
//// as opposed to a long umbraco-package.json file
//extensionRegistry.registerMany([
warrenbuckley marked this conversation as resolved.
Show resolved Hide resolved
//]);
};
24 changes: 24 additions & 0 deletions templates/UmbracoExtension/Client/tsconfig.json
warrenbuckley marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES2020",
"experimentalDecorators": true,
"useDefineForClassFields": false,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
17 changes: 17 additions & 0 deletions templates/UmbracoExtension/Client/vite.config.ts
warrenbuckley marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from "vite";

export default defineConfig({
build: {
lib: {
entry: "src/entrypoint.ts", // Entrypoint file (registers other manifests)
formats: ["es"],
fileName: "PROJECT_NAME_KEBABCASE_FOR_NPM",
},
outDir: "../wwwroot/App_Plugins/UmbracoExtension", // your web component will be saved in this location
emptyOutDir: true,
sourcemap: true,
rollupOptions: {
external: [/^@umbraco/],
},
},
});
30 changes: 30 additions & 0 deletions templates/UmbracoExtension/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
_ _ _
| | | | | |
__| | ___ | |_ _ __ ___| |_ _ __ _____ __
/ _` |/ _ \| __| '_ \ / _ \ __| | '_ \ / _ \ \ /\ / /
| (_| | (_) | |_| | | | __/ |_ | | | | __/\ V V /
\__,_|\___/ \__|_| |_|\___|\__| |_| |_|\___| \_/\_/ _ _
| | | | (_)
_ _ _ __ ___ | |__ _ __ __ _ ___ ___ _____ _| |_ ___ _ __ ___ _ ___ _ __
| | | | '_ ` _ \| '_ \| '__/ _` |/ __/ _ \ / _ \ \/ / __/ _ \ '_ \/ __| |/ _ \| '_ \
| |_| | | | | | | |_) | | | (_| | (_| (_) | | __/> <| || __/ | | \__ \ | (_) | | | |
\__,_|_| |_| |_|_.__/|_| \__,_|\___\___/ \___/_/\_\\__\___|_| |_|___/_|\___/|_| |_|


== Requirements ==
* Node LTS Version 20.17.0+

== Steps ==
* Open `\Client` folder in Visual Studio Code
warrenbuckley marked this conversation as resolved.
Show resolved Hide resolved
* Open a terminal inside the `\Client` folder
* Run `npm install` to install all the dependencies
* Run `npm run build` to build the project
* The build output is copied to `wwwroot\App_Plugins\UmbracoExtension\PROJECT_NAME_KEBABCASE_FOR_NPM.js`

== File Watching ==
* Add this Razor Class Library Project as a project reference to an Umbraco Website project
* From the `\Client` folder run the command `npm run watch` this will monitor the changes to the *.ts files and rebuild the project
* With the Umbraco website project running the Razor Class Library Project will refresh the browser when the build is complete

== Other Resources ==
* Umbraco Docs - https://docs.umbraco.com/umbraco-cms/customizing/extend-and-customize-editing-experience
warrenbuckley marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AddRazorSupportForMvc Condition="'$(SupportPagesAndViews)' == 'True'">true</AddRazorSupportForMvc>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">UmbracoPackage</RootNamespace>
<StaticWebAssetBasePath>App_Plugins/UmbracoPackage</StaticWebAssetBasePath>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">UmbracoExtension</RootNamespace>
<StaticWebAssetBasePath>/</StaticWebAssetBasePath>
</PropertyGroup>

<PropertyGroup>
<PackageId>UmbracoPackage</PackageId>
<Product>UmbracoPackage</Product>
<Title>UmbracoPackage</Title>
<Description>...</Description>
<PackageTags>umbraco plugin package</PackageTags>
<PackageId>UmbracoExtension</PackageId>
<Product>UmbracoExtension</Product>
<Title>UmbracoExtension</Title>
</PropertyGroup>

<ItemGroup Condition="'$(SupportPagesAndViews)' == 'True'">
Expand All @@ -24,4 +22,13 @@
<PackageReference Include="Umbraco.Cms.Web.Website" Version="UMBRACO_VERSION_FROM_TEMPLATE" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="UMBRACO_VERSION_FROM_TEMPLATE" />
</ItemGroup>

<ItemGroup>
<!-- Dont include the client folder as part of packaging nuget build -->
<Content Remove="Client\**" />

<!-- However make the Umbraco-package.json not part of the nuget package but visible to the solution -->
<None Include="Client\public\umbraco-package.json" Pack="false" />
</ItemGroup>

</Project>
18 changes: 0 additions & 18 deletions templates/UmbracoPackage/.template.config/dotnetcli.host.json

This file was deleted.

15 changes: 0 additions & 15 deletions templates/UmbracoPackage/.template.config/ide.host.json

This file was deleted.

108 changes: 0 additions & 108 deletions templates/UmbracoPackage/.template.config/template.json

This file was deleted.

Loading
Loading