-
Notifications
You must be signed in to change notification settings - Fork 0
/
all-update.sh
executable file
·65 lines (48 loc) · 1.3 KB
/
all-update.sh
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
63
64
65
#!/bin/sh
# Copyright 2017-2021 @polkadot/dev authors & contributors
# SPDX-License-Identifier: Apache-2.0
DIRECTORIES=( "dev" "ts" "wasm" "common" "api" "docs" "ui" "phishing" "extension" "tools" "apps" ) # "client" )
for REPO in "${DIRECTORIES[@]}"; do
if [ "$REPO" != "" ] && [ -d "./$REPO/.git" ]; then
echo ""
echo "*** Removing branches in $REPO"
cd $REPO
CURRENT=$(git rev-parse --abbrev-ref HEAD)
BRANCHES=( $(git branch | awk -F ' +' '! /\(no branch\)/ {print $2}') )
if [ "$CURRENT" = "master" ]; then
git fetch
git pull
else
echo "$CURRENT !== master"
fi
for BRANCH in "${BRANCHES[@]}"; do
if [ "$BRANCH" != "$CURRENT" ] && [ "$BRANCH" != "master" ]; then
git branch -d -f $BRANCH
fi
done
git prune
git gc
cd ..
fi
done
echo ""
echo "*** Updating inter-package-deps"
./dev/all-deps.js
echo ""
echo "*** Installing updated packages"
for REPO in "${DIRECTORIES[@]}"; do
if [ "$REPO" != "" ] && [ -d "./$REPO/.git" ]; then
echo ""
cd $REPO
DETACHED=$(git status | grep "HEAD detached")
if [ "$DETACHED" != "" ]; then
echo "*** Resetting $REPO"
git reset --hard
else
echo "*** Installing $REPO"
yarn install | grep -v 'YN0013'
yarn dedupe
fi
cd ..
fi
done