clean-project.ps1 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. function Load {
  2. param([scriptblock]$function,
  3. [string]$Label)
  4. $job = Start-Job -ScriptBlock $function
  5. $symbols = @("[-]", "[\]", "[|]", "[/]")
  6. $i = 0;
  7. while ($job.State -eq "Running") {
  8. $symbol = $symbols[$i]
  9. Write-Host -NoNewLine "`r$symbol $Label " -ForegroundColor Blue
  10. Start-Sleep -Milliseconds 100
  11. $i++
  12. if ($i -eq $symbols.Count){
  13. $i = 0;
  14. }
  15. }
  16. Write-Host "`r$Label finished" -ForegroundColor Green
  17. }
  18. function Delete {
  19. param([string] $dir)
  20. Write-Host "clean $dir" -ForegroundColor Blue;
  21. if (test-path $dir) {rm -r -force $dir};
  22. Write-Host "`r";
  23. Write-Host "`rfinished cleaning $dir" -ForegroundColor Green;
  24. }
  25. Delete -dir "node_modules"
  26. Remove-Item -Path "package-lock.json" -Force
  27. Remove-Item -Path "**/package-lock.json" -Force
  28. Delete -dir "src/dependencies/angularlib/node_modules";
  29. Delete -dir "src/dependencies/dp-ui/node_modules";
  30. Delete -dir "src/dependencies/fis/node_modules";
  31. Load -function {npm cache clean --force} -label "clean npm cache";
  32. Load -function {ng cache clean} -label "clean ng cache";
  33. npm i --legacy-peer-deps