-
Notifications
You must be signed in to change notification settings - Fork 0
/
push.sh
executable file
·52 lines (45 loc) · 1.14 KB
/
push.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
#!/usr/bin/env bash
echo
echo yalc push packages
echo
function getPackageName() {
packageName=`sed -n 's|"name": ||p' $1/package.json | sed 's|.*"\(.*\)",.*|\1|'`
echo $packageName
}
# yalc push on the root package
echo push root package
yalc push
echo
# get root package
package=`getPackageName $(pwd)`
# get the yalc system directory
yalcDir=`yalc dir`
echo ---------
echo push nested packages
echo ---------
function pushNestedPackages() {
# show the nested childs
childPackages=$(yalc installations show $package)
# needed infos started from the 2nd line
childPackages=$(echo "$childPackages" | sed -r -e "s|Installations of package $package:||g")
# parse to lines
for c in $childPackages; do
echo
# get the top path of nested child
c=`echo "$c" | sed 's|/.yalc.*||; s/\b*$//'`
echo Path: $c
# get the package name of nested child
package=`getPackageName $c`
echo Package Name: ${package}
if [ ! -d ${yalcDir}/packages/${package} ]; then
echo "Not a local package"
else
echo yalc push package
pushd $c
yalc push
popd
pushNestedPackages
fi
done
}
pushNestedPackages