function Load { param([scriptblock]$function, [string]$Label) $job = Start-Job -ScriptBlock $function $symbols = @("[-]", "[\]", "[|]", "[/]") $i = 0; while ($job.State -eq "Running") { $symbol = $symbols[$i] Write-Host -NoNewLine "`r$symbol $Label " -ForegroundColor Blue Start-Sleep -Milliseconds 100 $i++ if ($i -eq $symbols.Count){ $i = 0; } } Write-Host "`r$Label finished" -ForegroundColor Green } function Delete { param([string] $dir) Write-Host "clean $dir" -ForegroundColor Blue; if (test-path $dir) {rm -r -force $dir}; Write-Host "`r"; Write-Host "`rfinished cleaning $dir" -ForegroundColor Green; } Delete -dir "node_modules" Remove-Item -Path "package-lock.json" -Force Remove-Item -Path "**/package-lock.json" -Force Delete -dir "src/dependencies/angularlib/node_modules"; Delete -dir "src/dependencies/dp-ui/node_modules"; Delete -dir "src/dependencies/fis/node_modules"; Load -function {npm cache clean --force} -label "clean npm cache"; Load -function {ng cache clean} -label "clean ng cache"; npm i --legacy-peer-deps