Skip to content

Commit

Permalink
Add empty (no sample content) option (#23615)
Browse files Browse the repository at this point in the history
Also removed unneeded favicon.

Fixes #9126, #16542
  • Loading branch information
Eilon authored Jul 17, 2024
1 parent eb9b551 commit 82ac810
Show file tree
Hide file tree
Showing 23 changed files with 128 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"id": "Framework",
"persistenceScope": "shared",
"persistenceScopeName": "maui"
},
{
"id": "IncludeSampleContent",
"isVisible": true,
"persistenceScope": "shared",
"persistenceScopeName": "Microsoft"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Otevře soubor Components/Pages/Home.razor v editoru.",
"symbols/applicationId/description": "Přepíše v projektu $(ApplicationId).",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Öffnet Components/Pages/Home.razor im Editor.",
"symbols/applicationId/description": "Überschreibt $(ApplicationId) im Projekt",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Opens Components/Pages/Home.razor in the editor.",
"symbols/applicationId/description": "Overrides the $(ApplicationId) in the project",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Abre Components/Pages/Home.razor en el editor.",
"symbols/applicationId/description": "Reemplaza $(ApplicationId) en el proyecto",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Ouvre Components/Pages/Home.razor dans l’éditeur.",
"symbols/applicationId/description": "Remplace $(ApplicationId) dans le projet",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Apre Components/Pages/Home.razor nell'editor.",
"symbols/applicationId/description": "Esegue l'override di $(ApplicationId) nel progetto",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "エディターで Components/Pages/Home.razor を開きます。",
"symbols/applicationId/description": "プロジェクト内の $(ApplicationId) をオーバーライドします",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Opens Components/Pages/Home.razor in the editor.",
"symbols/applicationId/description": "Overrides the $(ApplicationId) in the project",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "편집기에서 Components/Pages/Home.razor를 엽니다.",
"symbols/applicationId/description": "프로젝트에서 $(ApplicationId) 재정의",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Otwiera plik Components/Pages/Home.razor w edytorze.",
"symbols/applicationId/description": "Zastępuje $(ApplicationId) w projekcie",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Abre Components/Pages/Home.razor no editor.",
"symbols/applicationId/description": "Substitui $(ApplicationId) no projeto",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Открывает Components/Pages/Home.razor в редакторе.",
"symbols/applicationId/description": "Переопределяет $(ApplicationId) в проекте",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "Düzenleyicide Components/Pages/Home.razor dosyasını açar.",
"symbols/applicationId/description": "Projedeki $(ApplicationId) uygulamasın geçersiz kılar",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "在编辑器中打开 Components/Pages/Home.razor。",
"symbols/applicationId/description": "替代项目中的 $(ApplicationId)",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"postActions/openInEditor/description": "在編輯器中開啟 Components/Pages/Home.razor。",
"symbols/applicationId/description": "覆寫專案中的 $(ApplicationId)",
"symbols/Framework/description": "The target framework for the project.",
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE"
"symbols/Framework/choices/DOTNET_TFM_VALUE/description": "Target DOTNET_TFM_VALUE",
"symbols/IncludeSampleContent/displayName": "_Include sample pages",
"symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.",
"symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,20 @@
{
"source": "./",
"target": "./",
"copyOnly": [ "**/wwwroot/css/**", "**/*.svg", "**/*.ttf" ]
}
"copyOnly": [ "**/wwwroot/css/**", "**/*.svg", "**/*.ttf" ],
"modifiers": [
{
"condition": "(!SampleContent)",
"exclude": [
"Components/Layout/NavMenu.*",
"Components/Pages/Counter.*",
"Components/Pages/Weather.*",
"wwwroot/css/bootstrap/**",
"wwwroot/favicon.*"
]
}
]
}
],
"preferNameDirectory": true,
"guids": [
Expand Down Expand Up @@ -132,6 +144,23 @@
"fallbackVariableName": "defaultAppId"
},
"replaces": "com.companyname.mauiapp"
},
"IncludeSampleContent": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"displayName": "_Include sample pages",
"description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns."
},
"Empty": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns."
},
"SampleContent": {
"type": "computed",
"value": "(((IncludeSampleContent && (HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\"))) || ((!Empty && (HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\"))))"
}
},
"forms": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@inherits LayoutComponentBase
@*#if (SampleContent) -->
<div class="page">
<div class="sidebar">
Expand All @@ -15,3 +16,7 @@
</article>
</main>
</div>
##else
@Body
##endif*@
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*#if (SampleContent)*/
.page {
position: relative;
display: flex;
Expand Down Expand Up @@ -75,3 +76,4 @@ main {
padding-right: 1.5rem !important;
}
}
/*#endif*/
4 changes: 3 additions & 1 deletion src/Templates/src/templates/maui-blazor/wwwroot/css/app.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
html, body {
/*#if (SampleContent)*/
html, body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

Expand All @@ -20,6 +21,7 @@ a, .btn-link {
padding-top: 1.1rem;
}

/*#endif*/
h1:focus {
outline: none;
}
Expand Down
Binary file not shown.
4 changes: 3 additions & 1 deletion src/Templates/src/templates/maui-blazor/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
<title>MauiApp.1</title>
<base href="/" />
<!--#if (SampleContent) -->
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<!--#endif -->
<link rel="stylesheet" href="css/app.css" />
<link rel="stylesheet" href="MauiApp.1.styles.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="icon" href="data:,">
</head>

<body>
Expand Down
36 changes: 18 additions & 18 deletions src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,27 @@ public void TemplateTestsSetUp()
}

[Test]
// Parameters: short name, target framework, build config, use pack target
//[TestCase("maui", DotNetPrevious, "Debug", false)]
//[TestCase("maui", DotNetPrevious, "Release", false)]
[TestCase("maui", DotNetCurrent, "Debug", false)]
[TestCase("maui", DotNetCurrent, "Release", false)]
//[TestCase("maui-blazor", DotNetPrevious, "Debug", false)]
//[TestCase("maui-blazor", DotNetPrevious, "Release", false)]
[TestCase("maui-blazor", DotNetCurrent, "Debug", false)]
[TestCase("maui-blazor", DotNetCurrent, "Release", false)]
[TestCase("mauilib", DotNetPrevious, "Debug", true)]
[TestCase("mauilib", DotNetPrevious, "Release", true)]
[TestCase("mauilib", DotNetCurrent, "Debug", true)]
[TestCase("mauilib", DotNetCurrent, "Release", true)]
public void Build(string id, string framework, string config, bool shouldPack)
// Parameters: short name, target framework, build config, use pack target, additionalDotNetNewParams
//[TestCase("maui", DotNetPrevious, "Debug", false, "")]
//[TestCase("maui", DotNetPrevious, "Release", false, "")]
[TestCase("maui", DotNetCurrent, "Debug", false, "")]
[TestCase("maui", DotNetCurrent, "Release", false, "")]
//[TestCase("maui-blazor", DotNetPrevious, "Debug", false, "")]
//[TestCase("maui-blazor", DotNetPrevious, "Release", false, "")]
[TestCase("maui-blazor", DotNetCurrent, "Debug", false, "")]
[TestCase("maui-blazor", DotNetCurrent, "Release", false, "")]
[TestCase("maui-blazor", DotNetCurrent, "Debug", false, "--Empty")]
[TestCase("maui-blazor", DotNetCurrent, "Release", false, "--Empty")]
[TestCase("mauilib", DotNetPrevious, "Debug", true, "")]
[TestCase("mauilib", DotNetPrevious, "Release", true, "")]
[TestCase("mauilib", DotNetCurrent, "Debug", true, "")]
[TestCase("mauilib", DotNetCurrent, "Release", true, "")]
public void Build(string id, string framework, string config, bool shouldPack, string additionalDotNetNewParams)
{
var projectDir = TestDirectory;
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj");

Assert.IsTrue(DotnetInternal.New(id, projectDir, framework),
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework, additionalDotNetNewParams),
$"Unable to create template {id}. Check test output for errors.");

EnableTizen(projectFile);
Expand All @@ -51,9 +53,7 @@ public void Build(string id, string framework, string config, bool shouldPack)
[Test]
// Parameters: target framework, build config, dotnet new additional parameters

// First, 4 default scenarios
[TestCase(DotNetCurrent, "Debug", "", false)]
[TestCase(DotNetCurrent, "Release", "", false)]
// First, default scenarios
[TestCase(DotNetCurrent, "Debug", "", false)]
[TestCase(DotNetCurrent, "Release", "", false)]

Expand Down

0 comments on commit 82ac810

Please sign in to comment.