dotnet new template - Support unattended (#10107)
* Remove trailing comma * Remove duplicate property * Logo is now transparent & not on a solid a white BG * Adds in auto Nuget Restore with an option to skip auto restore if you wish to https://github.com/dotnet/dotnet-template-samples/tree/master/08-restore-on-create * Fix typo * Rename from UmbracoSolution to UmbracoProject Bit misleading as it only ever creates a CSProj & not a SLN * Couple extra places that needed a rename * Adds support for HTTP & HTTPS port that will autogenerate an available free port number https://github.com/dotnet/templating/wiki/Available-Symbols-Generators#port * Update build/templates/UmbracoProject/.template.config/template.json Co-authored-by: Bjarke Berg <mail@bergmania.dk> * Update build/templates/UmbracoProject/.template.config/template.json Co-authored-by: Bjarke Berg <mail@bergmania.dk> * Rather than COPY appsettings from Umbraco.Web.UI.NetCore we use these specific ones so we can add logic to them * Support for unattended install with new CLI args * Change order so all the long textboxes that are optional are together * Apply suggestions from code review from Elitsa Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Elitsa Marinovska <elm@umbraco.dk> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
This commit is contained in:
@@ -349,7 +349,7 @@ stages:
|
||||
#Update the version in templates also
|
||||
|
||||
$templatePath =
|
||||
'build/templates/UmbracoSolution/.template.config/template.json'
|
||||
'build/templates/UmbracoProject/.template.config/template.json'
|
||||
|
||||
$a = Get-Content $templatePath -raw | ConvertFrom-Json
|
||||
|
||||
|
||||
@@ -344,13 +344,11 @@
|
||||
$this.CopyFiles("$templates", "*", "$tmp\Templates")
|
||||
|
||||
Write-Host "Copy files for dotnet templates"
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI.NetCore", "Program.cs", "$tmp\Templates\UmbracoSolution")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI.NetCore", "Startup.cs", "$tmp\Templates\UmbracoSolution")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI.NetCore", "appsettings.json", "$tmp\Templates\UmbracoSolution")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI.NetCore", "appsettings.Development.json", "$tmp\Templates\UmbracoSolution")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI.NetCore\Views", "*", "$tmp\Templates\UmbracoSolution\Views")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI.NetCore", "Program.cs", "$tmp\Templates\UmbracoProject")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI.NetCore", "Startup.cs", "$tmp\Templates\UmbracoProject")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI.NetCore\Views", "*", "$tmp\Templates\UmbracoProject\Views")
|
||||
|
||||
$this.RemoveDirectory("$tmp\Templates\UmbracoSolution\bin")
|
||||
$this.RemoveDirectory("$tmp\Templates\UmbracoProject\bin")
|
||||
})
|
||||
|
||||
$ubuild.DefineMethod("PackageZip",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/dotnetcli.host",
|
||||
"symbolInfo": {
|
||||
"PackageTestSiteName": {
|
||||
"longName": "PackageTestSiteName",
|
||||
"shortName": "p"
|
||||
},
|
||||
"UseSqlCe": {
|
||||
"longName": "SqlCe",
|
||||
"shortName": "ce"
|
||||
},
|
||||
"SkipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"FriendlyName": {
|
||||
"longName": "friendly-name",
|
||||
"shortName": ""
|
||||
},
|
||||
"Email": {
|
||||
"longName": "email",
|
||||
"shortName": ""
|
||||
},
|
||||
"Password": {
|
||||
"longName": "password",
|
||||
"shortName": ""
|
||||
},
|
||||
"ConnectionString":{
|
||||
"longName": "connection-string",
|
||||
"shortName": ""
|
||||
}
|
||||
},
|
||||
"usageExamples": [
|
||||
"dotnet new umbraco -n MyNewProject",
|
||||
"dotnet new umbraco -n MyNewProjectWithCE -ce",
|
||||
"dotnet new umbraco -n MyNewProject --no-restore",
|
||||
"dotnet new umbraco -n MyNewProject --friendly-name "Friendly User" --email user@email.com --password password1234 --connection-string "Server=ConnectionStringHere""
|
||||
]
|
||||
}
|
||||
BIN
build/templates/UmbracoProject/.template.config/icon.png
Normal file
BIN
build/templates/UmbracoProject/.template.config/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/vs-2017.3.host",
|
||||
"order" : 0,
|
||||
"icon": "icon.png",
|
||||
"description": {
|
||||
"id": "UmbracoProject",
|
||||
"text": "Umbraco Web Application - An empty Umbraco CMS web application"
|
||||
},
|
||||
"symbolInfo": [
|
||||
{
|
||||
"id": "UseSqlCe",
|
||||
"name": {
|
||||
"text": "Use Sql Compact Edition (SqlCE)"
|
||||
},
|
||||
"isVisible": "true"
|
||||
},
|
||||
{
|
||||
"id": "SkipRestore",
|
||||
"name": {
|
||||
"text": "Skips the automatic NuGet restore of the project on create"
|
||||
},
|
||||
"isVisible": "true"
|
||||
},
|
||||
{
|
||||
"id": "PackageTestSiteName",
|
||||
"name": {
|
||||
"text": "Optional: Specify the name of a package that this should be a test site for"
|
||||
},
|
||||
"isVisible": "true"
|
||||
},
|
||||
{
|
||||
"id": "FriendlyName",
|
||||
"name": {
|
||||
"text": "Optional: The friendly name of the user for Umbraco login when using Unattended install"
|
||||
},
|
||||
"isVisible": "true"
|
||||
},
|
||||
{
|
||||
"id": "Email",
|
||||
"name": {
|
||||
"text": "Optional: Email to use for Umbraco login when using Unattended install"
|
||||
},
|
||||
"isVisible": "true"
|
||||
},
|
||||
{
|
||||
"id": "Password",
|
||||
"name": {
|
||||
"text": "Optional: Password to use for Umbraco login when using Unattended install"
|
||||
},
|
||||
"isVisible": "true"
|
||||
},
|
||||
{
|
||||
"id": "ConnectionString",
|
||||
"name": {
|
||||
"text": "Optional: Database connection string when using Unattended install"
|
||||
},
|
||||
"isVisible": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
140
build/templates/UmbracoProject/.template.config/template.json
Normal file
140
build/templates/UmbracoProject/.template.config/template.json
Normal file
@@ -0,0 +1,140 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "Umbraco HQ",
|
||||
"description": "An empty Umbraco Project ready to get started",
|
||||
"classifications": [ "Web", "CMS", "Umbraco"],
|
||||
"groupIdentity": "Umbraco.Templates.UmbracoProject",
|
||||
"identity": "Umbraco.Templates.UmbracoProject.CSharp",
|
||||
"name": "Umbraco Project",
|
||||
"shortName": "umbraco",
|
||||
"defaultName": "UmbracoProject1",
|
||||
"preferNameDirectory": true,
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "project"
|
||||
},
|
||||
"primaryOutputs": [
|
||||
{
|
||||
"path": "UmbracoProject.csproj"
|
||||
}
|
||||
],
|
||||
"postActions": [
|
||||
{
|
||||
"condition": "(!SkipRestore)",
|
||||
"description": "Restore NuGet packages required by this project",
|
||||
"manualInstructions": [{
|
||||
"text": "Run 'dotnet restore'"
|
||||
}],
|
||||
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
|
||||
"continueOnError": true
|
||||
}
|
||||
],
|
||||
"sourceName": "UmbracoProject",
|
||||
"symbols": {
|
||||
"version": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"defaultValue": "9.0.0-beta001",
|
||||
"description": "The version of Umbraco to load using NuGet",
|
||||
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
|
||||
},
|
||||
"namespaceReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "name",
|
||||
"defaultValue": "UmbracoProject",
|
||||
"fallbackVariableName": "name"
|
||||
},
|
||||
"replaces":"Umbraco.Web.UI.NetCore"
|
||||
},
|
||||
"PackageTestSiteName": {
|
||||
"type": "parameter",
|
||||
"datatype":"text",
|
||||
"defaultValue": "",
|
||||
"replaces":"PackageTestSiteName",
|
||||
"description": "The name of the package this should be a test site for (Default: '')"
|
||||
},
|
||||
"UseSqlCe":{
|
||||
"type": "parameter",
|
||||
"datatype":"bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Adds the required dependencies to use SqlCE (Windows only) (Default: false)"
|
||||
},
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "net5.0",
|
||||
"description": "Target net5.0"
|
||||
},
|
||||
{
|
||||
"choice": "net6.0",
|
||||
"description": "Target net6.0"
|
||||
}
|
||||
],
|
||||
"replaces": "net5.0",
|
||||
"defaultValue": "net5.0"
|
||||
},
|
||||
"SkipRestore": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create",
|
||||
"defaultValue": "false"
|
||||
},
|
||||
"HttpPort": {
|
||||
"type": "generated",
|
||||
"generator": "port",
|
||||
"replaces": "HTTP_PORT_FROM_TEMPLATE",
|
||||
"parameters": {
|
||||
"high": 65535,
|
||||
"low": 1024,
|
||||
"fallback": 5000
|
||||
}
|
||||
},
|
||||
"HttpsPort": {
|
||||
"type": "generated",
|
||||
"generator": "port",
|
||||
"replaces": "HTTPS_PORT_FROM_TEMPLATE",
|
||||
"parameters": {
|
||||
"high": 65535,
|
||||
"low": 1024,
|
||||
"fallback": 5001
|
||||
}
|
||||
},
|
||||
"FriendlyName":{
|
||||
"type": "parameter",
|
||||
"datatype":"text",
|
||||
"description": "The friendly name of the user for Umbraco login when using Unattended install (Without installer wizard UI)",
|
||||
"replaces": "FRIENDLY_NAME_FROM_TEMPLATE",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"Email":{
|
||||
"type": "parameter",
|
||||
"datatype":"text",
|
||||
"description": "Email to use for Umbraco login when using Unattended install (Without installer wizard UI)",
|
||||
"replaces": "EMAIL_FROM_TEMPLATE",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"Password":{
|
||||
"type": "parameter",
|
||||
"datatype":"text",
|
||||
"description": "Password to use for Umbraco login when using Unattended install (Without installer wizard UI)",
|
||||
"replaces": "PASSWORD_FROM_TEMPLATE",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"ConnectionString":{
|
||||
"type": "parameter",
|
||||
"datatype":"text",
|
||||
"description": "Database connection string when using Unattended install (Without installer wizard UI)",
|
||||
"replaces": "CONNECTION_FROM_TEMPLATE",
|
||||
"defaultValue": ""
|
||||
},
|
||||
"UsingUnattenedInstall":{
|
||||
"type": "computed",
|
||||
"value": "(FriendlyName != \"\" && Email != \"\" && Password != \"\" && ConnectionString != \"\")"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
"sslPort": 5001
|
||||
"applicationUrl": "http://localhost:HTTP_PORT_FROM_TEMPLATE",
|
||||
"sslPort": HTTPS_PORT_FROM_TEMPLATE
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
@@ -20,7 +20,7 @@
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||
"applicationUrl": "https://localhost:HTTPS_PORT_FROM_TEMPLATE;http://localhost:HTTP_PORT_FROM_TEMPLATE"
|
||||
}
|
||||
}
|
||||
}
|
||||
50
build/templates/UmbracoProject/appsettings.Development.json
Normal file
50
build/templates/UmbracoProject/appsettings.Development.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information"
|
||||
},
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Async",
|
||||
"Args": {
|
||||
"configure": [
|
||||
{
|
||||
"Name": "Console"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
//#if (UsingUnattenedInstall)
|
||||
"ConnectionStrings": {
|
||||
"umbracoDbDSN": "CONNECTION_FROM_TEMPLATE"
|
||||
},
|
||||
//#endif
|
||||
"Umbraco": {
|
||||
"CMS": {
|
||||
//#if (UsingUnattenedInstall)
|
||||
"Unattended": {
|
||||
"InstallUnattended": true,
|
||||
"UnattendedUserName": "FRIENDLY_NAME_FROM_TEMPLATE",
|
||||
"UnattendedUserEmail": "EMAIL_FROM_TEMPLATE",
|
||||
"UnattendedUserPassword": "PASSWORD_FROM_TEMPLATE"
|
||||
},
|
||||
//#endif
|
||||
"Global": {
|
||||
"Smtp": {
|
||||
"From": "your@email.here",
|
||||
"Host": "localhost",
|
||||
"Port": 25
|
||||
}
|
||||
},
|
||||
"Hosting": {
|
||||
"Debug": true
|
||||
},
|
||||
"RuntimeMinification": {
|
||||
"useInMemoryCache": true,
|
||||
"cacheBuster": "Timestamp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
build/templates/UmbracoProject/appsettings.json
Normal file
22
build/templates/UmbracoProject/appsettings.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information",
|
||||
"System": "Warning"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"umbracoDbDSN": ""
|
||||
},
|
||||
"Umbraco": {
|
||||
"CMS": {
|
||||
"Hosting": {
|
||||
"Debug": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/dotnetcli.host",
|
||||
"symbolInfo": {
|
||||
"PackageTestSiteName": {
|
||||
"longName": "PackageTestSiteName",
|
||||
"shortName": "p"
|
||||
},
|
||||
"UseSqlCe": {
|
||||
"longName": "SqlCe",
|
||||
"shortName": "ce"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB |
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/vs-2017.3.host",
|
||||
"order" : 0,
|
||||
"icon": "icon.png",
|
||||
"description": {
|
||||
"id": "UmbracoSolution",
|
||||
"text": "Umbraco Web Application - An empty Umbraco CMS web application"
|
||||
},
|
||||
"symbolInfo": [
|
||||
{
|
||||
"id": "PackageTestSiteName",
|
||||
"name": {
|
||||
"text": "Optional: Specific the name of a package that this should be a test site for.",
|
||||
},
|
||||
"isVisible": "true"
|
||||
},
|
||||
{
|
||||
"id": "UseSqlCe",
|
||||
"name": {
|
||||
"text": "Use Sql Compact Edition (SqlCE)"
|
||||
},
|
||||
"isVisible": "true"
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/template",
|
||||
"author": "Umbraco HQ",
|
||||
"description": "An empty Umbraco Solution ready to get started",
|
||||
"classifications": [ "Web", "CMS", "Umbraco"],
|
||||
"groupIdentity": "Umbraco.Templates.UmbracoSolution",
|
||||
"identity": "Umbraco.Templates.UmbracoSolution.CSharp",
|
||||
"name": "Umbraco Solution",
|
||||
"shortName": "umbraco",
|
||||
"defaultName": "UmbracoSolution1",
|
||||
"preferNameDirectory": true,
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "project"
|
||||
},
|
||||
"primaryOutputs": [
|
||||
{
|
||||
"path": "UmbracoSolution.csproj"
|
||||
}
|
||||
],
|
||||
"sourceName": "UmbracoSolution",
|
||||
"preferNameDirectory": true,
|
||||
"symbols": {
|
||||
"version": {
|
||||
"type": "parameter",
|
||||
"datatype": "string",
|
||||
"defaultValue": "9.0.0-beta001",
|
||||
"description": "The version of Umbraco to load using NuGet",
|
||||
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
|
||||
},
|
||||
"namespaceReplacer": {
|
||||
"type": "generated",
|
||||
"generator": "coalesce",
|
||||
"parameters": {
|
||||
"sourceVariableName": "name",
|
||||
"defaultValue": "UmbracoSolution",
|
||||
"fallbackVariableName": "name"
|
||||
},
|
||||
"replaces":"Umbraco.Web.UI.NetCore"
|
||||
},
|
||||
"PackageTestSiteName": {
|
||||
"type": "parameter",
|
||||
"datatype":"text",
|
||||
"defaultValue": "",
|
||||
"replaces":"PackageTestSiteName",
|
||||
"description": "The name of the package this should be a test site for (Default: '')"
|
||||
},
|
||||
"UseSqlCe":{
|
||||
"type": "parameter",
|
||||
"datatype":"bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Adds the required dependencies to use SqlCE (Windows only) (Default: false)"
|
||||
},
|
||||
"Framework": {
|
||||
"type": "parameter",
|
||||
"description": "The target framework for the project.",
|
||||
"datatype": "choice",
|
||||
"choices": [
|
||||
{
|
||||
"choice": "net5.0",
|
||||
"description": "Target net5.0"
|
||||
},
|
||||
{
|
||||
"choice": "net6.0",
|
||||
"description": "Target net6.0"
|
||||
}
|
||||
],
|
||||
"replaces": "net5.0",
|
||||
"defaultValue": "net5.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user