Last active
February 6, 2017 23:56
-
-
Save keawade/493194fca7e79a22f0f9e82c9d5bdc62 to your computer and use it in GitHub Desktop.
Yarn Test Scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[string]$DestPath = "C:/Tests/", | |
[switch]$Robo | |
) | |
if (!(Test-Path -Path "$DestPath/TestDir")) { | |
New-Item -Path "$DestPath/TestDir" -Type Directory | Out-Null | |
} | |
for ($i = 0; $i -lt 10; $i++) { | |
if (Test-Path -Path "$DestPath/TestDir/keawade.github.io") { | |
Remove-Item -Path "$DestPath/TestDir/keawade.github.io" -Recurse -Force | |
} | |
if ($Robo) { | |
New-Item -Path "$DestPath/TestDir/keawade.github.io" -Type Directory | Out-Null | |
Measure-Command { | |
C:\Windows\System32\Robocopy.exe .\keawade.github.io\ $DestPath\TestDir\keawade.github.io /E | |
} | Select-Object TotalMilliseconds | |
} else { | |
Measure-Command { | |
Copy-Item -Path "./keawade.github.io" -Destination "$DestPath/TestDir" -Recurse | |
} | Select-Object TotalMilliseconds | |
} | |
if (Test-Path -Path "$DestPath/TestDir/keawade.github.io") { | |
Remove-Item -Path "$DestPath/TestDir/keawade.github.io" -Recurse -Force | |
} | |
} | |
if (Test-Path -Path "$DestPath/TestDir") { | |
Remove-Item -Path "$DestPath/TestDir" -Recurse -Force | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[string]$Limit = 10, | |
[switch]$Clean, | |
[switch]$Verbose, | |
[switch]$SingleThread | |
) | |
if ((Get-Command "git" -ErrorAction SilentlyContinue) -eq $null) | |
{ | |
Write-Host "Error: Unable to find git in your PATH" | |
exit 1 | |
} | |
if ((Get-Command "yarn" -ErrorAction SilentlyContinue) -eq $null) | |
{ | |
Write-Host "Error: Unable to find yarn in your PATH" | |
exit 1 | |
} | |
if (Test-Path "./keawade.github.io") { | |
Remove-Item "./keawade.github.io" -Recurse -Force | |
} | |
Write-Host "Cloning repo..." | |
git clone https://github.com/keawade/keawade.github.io.git --quiet | Out-Null | |
Set-Location ./keawade.github.io | |
git checkout vue --quiet | |
for ($i = 0; $i -lt $Limit; $i++) { | |
if ($Clean) { | |
yarn cache clean | Out-Null | |
} | |
if ($Verbose) { | |
node ../yarn-0.21.0-0.js install --verbose | |
} elseif ($SingleThread) { | |
../yarn/bin/yarn.cmd install | Select-String -pattern "Done in " | |
} else { | |
yarn | Select-String -pattern "Done in " | |
} | |
Remove-Item ./node_modules -Force -Recurse | |
} | |
Set-Location .. | |
Write-Host "Cleaning up..." | |
Remove-Item ./keawade.github.io -Force -Recurse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment