Skip to content

Commit

Permalink
Add App_Data and *.pubxml* to clean bat sh files
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Jul 14, 2024
1 parent 110b550 commit 59208ae
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Clean.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
:: 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

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

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

:: Delete specified files & folders
powershell -Command "Get-ChildItem -Force -Include *.csproj.user,Resources.designer.cs,bin,obj,node_modules,Packages,TestResults,AppPackages,.meteor -Recurse | ForEach-Object { Remove-Item -Recurse -Path $_ -Confirm:$false -Force }"
powershell -Command "Get-ChildItem -Force -Include *.csproj.user,Resources.designer.cs,bin,obj,node_modules,Packages,TestResults,AppPackages,.meteor,App_Data -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
Expand Down
4 changes: 2 additions & 2 deletions src/Clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ for csproj in $(find . -name '*.csproj'); do
done

# Delete specified directories
for dir in $(find . -type d \( -name "bin" -o -name "obj" -o -name "node_modules" -o -name "Packages" -o -name ".vs" -o -name "TestResults" -o -name "AppPackages" -o -name ".meteor" \)); do
for dir in $(find . -type d \( -name "bin" -o -name "obj" -o -name "node_modules" -o -name "Packages" -o -name ".vs" -o -name "TestResults" -o -name "AppPackages" -o -name ".meteor" -o -name "App_Data" \)); do
rm -rf $dir
done

# Delete specified files
for file in $(find . -type f \( -name "*.csproj.user" -o -name "Resources.designer.cs" -o -name "*.css" -o -name "*.min.css" -o -name "*.js" -o -name "*.min.js" -o -name "*.map" \)); do
for file in $(find . -type f \( -name "*.csproj.user" -o -name "Resources.designer.cs" -o -name "*.css" -o -name "*.min.css" -o -name "*.js" -o -name "*.min.js" -o -name "*.map" -o -name "*.pubxml*" \)); do
rm -f $file
done

Expand Down
6 changes: 3 additions & 3 deletions src/Templates/Boilerplate/Bit.Boilerplate/Clean.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
:: 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.

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

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

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

:: Deletes empty directories.
Expand Down
4 changes: 2 additions & 2 deletions src/Templates/Boilerplate/Bit.Boilerplate/Clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ for csproj in $(find . -name '*.csproj'); do
done

# Deletes specified directories
for dir in $(find . -type d \( -name "bin" -o -name "obj" -o -name "node_modules" -o -name "Packages" -o -name ".vs" -o -name "TestResults" -o -name "AppPackages" -o -name ".meteor" \)); do
for dir in $(find . -type d \( -name "bin" -o -name "obj" -o -name "node_modules" -o -name "Packages" -o -name ".vs" -o -name "TestResults" -o -name "AppPackages" -o -name ".meteor" -o -name "App_Data" \)); do
rm -rf $dir
done

# Deletes specified files
for file in $(find . -type f \( -name "*.csproj.user" -o -name "Resources.designer.cs" -o -name "*.css" -o -name "*.min.css" -o -name "*.js" -o -name "*.min.js" -o -name "*.map" \)); do
for file in $(find . -type f \( -name "*.csproj.user" -o -name "Resources.designer.cs" -o -name "*.css" -o -name "*.min.css" -o -name "*.js" -o -name "*.min.js" -o -name "*.map" -o -name "*.pubxml*" \)); do
rm -f $file
done

Expand Down

0 comments on commit 59208ae

Please sign in to comment.