Skip to content

Commit

Permalink
feat(websites): Improve websites performance #6062 (#6063)
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi authored Nov 15, 2023
1 parent 0f2ea1f commit a780a4c
Show file tree
Hide file tree
Showing 499 changed files with 2,884 additions and 5,974 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"hostRequirements": {
"cpus": 4
},
"onCreateCommand": "wget https://download.visualstudio.microsoft.com/download/pr/5226a5fa-8c0b-474f-b79a-8984ad7c5beb/3113ccbf789c9fd29972835f0f334b7a/dotnet-sdk-8.0.100-linux-x64.tar.gz -O $HOME/dotnet.tar.gz && export DOTNET_ROOT=$HOME/.dotnet && mkdir -p \"$DOTNET_ROOT\" && tar zxf $HOME/dotnet.tar.gz -C \"$DOTNET_ROOT\" && export PATH=$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH && dotnet dev-certs https --trust && dotnet build src/BlazorUI/Demo/Client/Web/Bit.BlazorUI.Demo.Client.Web.csproj && dotnet build src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj -t:BeforeBuildTasks --no-restore && dotnet build src/Websites/Sales/src/Bit.Websites.Sales.Web/Bit.Websites.Sales.Web.csproj -t:BeforeBuildTasks --no-restore && dotnet build src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Core/Boilerplate.Client.Core.csproj -t:BeforeBuildTasks --no-restore",
"onCreateCommand": "wget https://download.visualstudio.microsoft.com/download/pr/5226a5fa-8c0b-474f-b79a-8984ad7c5beb/3113ccbf789c9fd29972835f0f334b7a/dotnet-sdk-8.0.100-linux-x64.tar.gz -O $HOME/dotnet.tar.gz && export DOTNET_ROOT=$HOME/.dotnet && mkdir -p \"$DOTNET_ROOT\" && tar zxf $HOME/dotnet.tar.gz -C \"$DOTNET_ROOT\" && export PATH=$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH && dotnet dev-certs https --trust && dotnet build src/BlazorUI/Demo/Client/Web/Bit.BlazorUI.Demo.Client.Web.csproj && dotnet build src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj -t:BeforeBuildTasks --no-restore && dotnet build src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj -t:BeforeBuildTasks --no-restore && dotnet build src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Core/Boilerplate.Client.Core.csproj -t:BeforeBuildTasks --no-restore",
"waitFor": "onCreateCommand",
"customizations": {
"codespaces": {
Expand Down
27 changes: 8 additions & 19 deletions .github/workflows/sales.website.cd.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Sales Website CD

env:
WEB_APP_DEPLOYMENT_TYPE: 'SSR'
APP_SERVICE_NAME: 'bitservices'

on:
Expand All @@ -14,8 +13,8 @@ permissions:

jobs:

build_blazor_api_wasm:
name: build blazor api + web assembly
build_api_blazor:
name: build api + blazor
runs-on: ubuntu-22.04

steps:
Expand All @@ -27,35 +26,25 @@ jobs:
uses: actions/setup-dotnet@v3
with:
global-json-file: src/global.json

- name: Switch to blazor web assembly
run: sed -i 's/Microsoft.NET.Sdk.Web/Microsoft.NET.Sdk.BlazorWebAssembly/g' src/Websites/Sales/src/Bit.Websites.Sales.Web/Bit.Websites.Sales.Web.csproj


- name: Install wasm
run: cd src && dotnet workload install wasm-tools wasm-experimental

- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'src/Websites/Sales/src/Bit.Websites.Sales.Web/appsettings.json'
env:
ApiServerAddress: 'api/'

- name: Generate CSS/JS files
run: dotnet build src/Websites/Sales/src/Bit.Websites.Sales.Web/Bit.Websites.Sales.Web.csproj -t:BeforeBuildTasks --no-restore
run: dotnet build src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj -t:BeforeBuildTasks --no-restore

- name: Publish
run: dotnet publish src/Websites/Sales/src/Bit.Websites.Sales.Api/Bit.Websites.Sales.Api.csproj -p:BlazorMode=BlazorWebAssembly -p:WebAppDeploymentType="${{ env.WEB_APP_DEPLOYMENT_TYPE }}" -p:Configuration=Release --self-contained -r linux-x64 -o api-web
run: dotnet publish src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj -p:Configuration=Release --self-contained -r linux-x64 -o api-web

- name: Upload api-web artifact
uses: actions/upload-artifact@v3
with:
name: api-web-bundle
path: api-web

deploy_blazor_api_wasm:
name: deploy blazor api + web assembly
needs: build_blazor_api_wasm
deploy_api_blazor:
name: deploy api + blazor
needs: build_api_blazor
runs-on: ubuntu-22.04
environment:
name: 'production'
Expand Down
4 changes: 2 additions & 2 deletions src/Bit-CI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.BlazorUI.Assets", "Blaz
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.BlazorUI.Icons", "BlazorUI\Bit.BlazorUI.Icons\Bit.BlazorUI.Icons.csproj", "{6B5C3E91-47F9-4DEE-B74B-20ED2D24585A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Sales.Api", "Websites\Sales\src\Bit.Websites.Sales.Api\Bit.Websites.Sales.Api.csproj", "{090DDD5F-6BB9-46C2-B81E-E9DF384721A5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Sales.Server", "Websites\Sales\src\Bit.Websites.Sales.Server\Bit.Websites.Sales.Server.csproj", "{090DDD5F-6BB9-46C2-B81E-E9DF384721A5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Sales.Shared", "Websites\Sales\src\Bit.Websites.Sales.Shared\Bit.Websites.Sales.Shared.csproj", "{01078AA6-DE42-46A4-B541-E019DDAE54AD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Sales.Web", "Websites\Sales\src\Bit.Websites.Sales.Web\Bit.Websites.Sales.Web.csproj", "{756CB468-1026-43D6-B58C-4234A77EAD7A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Sales.Client", "Websites\Sales\src\Bit.Websites.Sales.Client\Bit.Websites.Sales.Client.csproj", "{756CB468-1026-43D6-B58C-4234A77EAD7A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Platform.Shared", "Websites\Platform\src\Bit.Websites.Platform.Shared\Bit.Websites.Platform.Shared.csproj", "{32C64C9A-2A6A-4C87-9307-DC370BCD695C}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@*+:cnd:noEmit*@
@using BlazorWeb.Client.Services
@attribute [StreamRendering(true)]

<!DOCTYPE html>
<html bit-theme="dark">
Expand Down Expand Up @@ -29,12 +28,15 @@

<Routes @rendermode=RenderModeProvider.Current />

<script src="_framework/blazor.web.js"></script>
<script src="scripts/app.js"></script>
<script src="_content/Bit.BlazorUI/scripts/bit.blazorui.js"></script>
@*#if (sample == "AdminPanel")*@
<script src="_content/Bit.BlazorUI.Extras/scripts/bit.blazorui.extras.js"></script>
@*#endif*@
@if (HttpContext.Request.IsCrawlerClient() is false)
{
<script src="_framework/blazor.web.js"></script>
<script src="scripts/app.js"></script>
<script src="_content/Bit.BlazorUI/scripts/bit.blazorui.js"></script>
@*#if (sample == "AdminPanel")*@
<script src="_content/Bit.BlazorUI.Extras/scripts/bit.blazorui.extras.js"></script>
@*#endif*@
}
</body>

</html>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Microsoft.AspNetCore.Components;

namespace BlazorWeb.Server.Components;

[StreamRendering(enabled: true)]
public partial class App
{
[CascadingParameter] HttpContext HttpContext { get; set; } = default!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static string GetBaseUrl(this HttpRequest req)
return uriBuilder.Uri.AbsoluteUri;
}

public static bool ShouldRenderStaticMode(this HttpRequest request)
public static bool IsCrawlerClient(this HttpRequest request)
{
var agent = GetLoweredUserAgent(request);

Expand Down
124 changes: 124 additions & 0 deletions src/Websites/Careers/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
###############################
# Core EditorConfig Options #
###############################
# All files
[*]
indent_style = space
indent_size = 4
# Code files
[*.{cs,csx,vb,vbx}]
insert_final_newline = true
charset = utf-8-bom
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
###############################
# VB Coding Conventions #
###############################
[*.vb]
# Modifier preferences
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
12 changes: 10 additions & 2 deletions src/Websites/Careers/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ ModelManifest.xml
# VS Code
.vscode

# .NET Meteor
.meteor

# Rider
.idea

Expand All @@ -222,6 +225,11 @@ profile.arm.json
*.map
*Resource.designer.cs
/**/*.css
custom.aprof

/src/Server/Api/Attachments/**/*.*

/src/Bit.Websites.Careers.Client/Scripts/app*.js
/src/Bit.Websites.Careers.Client/wwwroot/scripts/app*.js

/src/Bit.Websites.Careers.Web/Scripts/app*.js
/src/Bit.Websites.Careers.Web/wwwroot/scripts/app*.js
/src/Bit.Websites.Careers.Server/Bit.Websites.CareersDb.db*
40 changes: 21 additions & 19 deletions src/Websites/Careers/Bit.Websites.Careers.sln
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
VisualStudioVersion = 17.8.34302.71
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".SolutionItems", ".SolutionItems", "{5CF43F76-BB71-4B5B-B4DF-1C753E042A8F}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".SolutionItems", ".SolutionItems", "{07D3DE94-9EB8-41FE-8888-0A483D30EBFD}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
Clean.bat = Clean.bat
src\Directory.Build.props = src\Directory.Build.props
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Careers.Api", "src\Bit.Websites.Careers.Api\Bit.Websites.Careers.Api.csproj", "{87A052C0-DF5B-4560-960C-3B1D31EC2792}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Careers.Shared", "src\Bit.Websites.Careers.Shared\Bit.Websites.Careers.Shared.csproj", "{7B577D88-492D-4B13-8B79-55BA13B51EE4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Careers.Shared", "src\Bit.Websites.Careers.Shared\Bit.Websites.Careers.Shared.csproj", "{C7234277-F4B8-4B2B-9C75-BDE54A59B1A1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Careers.Server", "src\Bit.Websites.Careers.Server\Bit.Websites.Careers.Server.csproj", "{03920E8A-DB33-4239-BCD1-7EE3ECC6E19B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Careers.Web", "src\Bit.Websites.Careers.Web\Bit.Websites.Careers.Web.csproj", "{91ABA16B-4583-43F0-94DF-6239586352CD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bit.Websites.Careers.Client", "src\Bit.Websites.Careers.Client\Bit.Websites.Careers.Client.csproj", "{2B84944A-F323-4F0D-9D70-7FF99B0F7EA7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87A052C0-DF5B-4560-960C-3B1D31EC2792}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87A052C0-DF5B-4560-960C-3B1D31EC2792}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87A052C0-DF5B-4560-960C-3B1D31EC2792}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87A052C0-DF5B-4560-960C-3B1D31EC2792}.Release|Any CPU.Build.0 = Release|Any CPU
{C7234277-F4B8-4B2B-9C75-BDE54A59B1A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7234277-F4B8-4B2B-9C75-BDE54A59B1A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7234277-F4B8-4B2B-9C75-BDE54A59B1A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7234277-F4B8-4B2B-9C75-BDE54A59B1A1}.Release|Any CPU.Build.0 = Release|Any CPU
{91ABA16B-4583-43F0-94DF-6239586352CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91ABA16B-4583-43F0-94DF-6239586352CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91ABA16B-4583-43F0-94DF-6239586352CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91ABA16B-4583-43F0-94DF-6239586352CD}.Release|Any CPU.Build.0 = Release|Any CPU
{7B577D88-492D-4B13-8B79-55BA13B51EE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B577D88-492D-4B13-8B79-55BA13B51EE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B577D88-492D-4B13-8B79-55BA13B51EE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B577D88-492D-4B13-8B79-55BA13B51EE4}.Release|Any CPU.Build.0 = Release|Any CPU
{03920E8A-DB33-4239-BCD1-7EE3ECC6E19B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03920E8A-DB33-4239-BCD1-7EE3ECC6E19B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03920E8A-DB33-4239-BCD1-7EE3ECC6E19B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03920E8A-DB33-4239-BCD1-7EE3ECC6E19B}.Release|Any CPU.Build.0 = Release|Any CPU
{2B84944A-F323-4F0D-9D70-7FF99B0F7EA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B84944A-F323-4F0D-9D70-7FF99B0F7EA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B84944A-F323-4F0D-9D70-7FF99B0F7EA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B84944A-F323-4F0D-9D70-7FF99B0F7EA7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
SolutionGuid = {62EABCA9-B5C9-489A-B101-38E38ACEDC1E}
EndGlobalSection
EndGlobal
14 changes: 7 additions & 7 deletions src/Websites/Careers/Clean.bat
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
:: This batch script is designed for comprehensive cleaning of your project by deleting unnecessary files.
:: It's crucial to close any Integrated Development Environment (IDE), such as Visual Studio, etc., before executing this script to prevent any conflicts or loss of unsaved data.
:: Please note that the commands included in this script are specifically tailored for the Windows
:: This batch script cleans your project by deleting unnecessary files.
:: It is important to close any IDEs, such as Visual Studio, before running this script to prevent conflicts or data loss.
:: The commands in this script are specifically designed for Windows.

:: Delete css,js and source maps files if not tracked in git
:: Deletes CSS, JS, and source map files that are not tracked in Git.
powershell -Command "[string]$trackedFiles = git ls-files; Get-ChildItem -Include *.css,*.min.css,*.js,*.min.js,*.map -Recurse | ForEach-Object { if ($trackedFiles -NotMatch $_.Name) { Remove-Item -Recurse -Path $_ -Confirm:$false -Force }}"

:: Runs dotnet clean for each csproj file
:: Runs the dotnet clean command for each .csproj file.
powershell -Command "Get-ChildItem -Include *.csproj -Recurse | ForEach-Object { dotnet clean $_.FullName }"

:: Delete specified files & folders
:: Deletes the specified files and folders.
powershell -Command "Get-ChildItem -Include *.csproj.user,Resources.designer.cs,bin,obj,node_modules,Packages,TestResults,AppPackages,.meteor -Recurse | ForEach-Object { Remove-Item -Recurse -Path $_ -Confirm:$false -Force }"
FOR /d /r . %%d IN (.vs) DO @IF EXIST "%%d" rd /s /q "%%d"

:: Delete empty directories
:: Deletes empty directories.
powershell -Command "Get-ChildItem -Recurse | Where-Object { $_.PSIsContainer -and @(Get-ChildItem -Lit $_.FullName).Count -eq 0 } | Remove-Item -Confirm:$false -Force"
Loading

0 comments on commit a780a4c

Please sign in to comment.