-
Notifications
You must be signed in to change notification settings - Fork 13
/
upgrade.ps1
62 lines (46 loc) · 1.11 KB
/
upgrade.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Write-Host ""
Write-Host "Pulling the latest:" -ForegroundColor Green
git pull
if(git status --porcelain | Where-Object {$_ -match '^\?\?'}){
throw "Untracked files exist"
exit
}
elseif(git status --porcelain | Where-Object {$_ -notmatch '^\?\?'}) {
throw "Uncommitted changes"
}
Push-Location packages
$dir = dir .
$c = $dir.count
$c += 1
foreach ($d in $dir){
$i = $dir.IndexOf($d)
$i += 1
Push-Location $d
Write-Host ""
Write-Host "($i/$c) Upgrading ste-events:" -ForegroundColor Yellow
npx npm-check-updates -u
npm install
npm audit fix
Pop-Location
}
Pop-Location
Write-Host ""
Write-Host "($c/$c) Upgrading root" -ForegroundColor Yellow
npx npm-check-updates -u
npm install
npm audit fix
Write-Host ""
Write-Host "Building & testing:" -ForegroundColor Green
npm install
npm run build
npm test
Write-Host ""
Write-Host "Commit to Git" -ForegroundColor Yellow
git add .
git commit -m "Packages upgrade"
git push
Write-Host "" -ForegroundColor Yellow
Write-Host "Publish" -ForegroundColor Yellow
npm run make
Write-Host ""
Write-Host "Ready!" -ForegroundColor Green