-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathsubstrate-ui-new
More file actions
executable file
·48 lines (39 loc) · 1.07 KB
/
substrate-ui-new
File metadata and controls
executable file
·48 lines (39 loc) · 1.07 KB
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
#!/usr/bin/env bash
COLOR_WHITE=$(tput setaf 7);
COLOR_MAGENTA=$(tput setaf 5);
FONT_BOLD=$(tput bold);
FONT_NORMAL=$(tput sgr0);
echo
echo -e "$COLOR_WHITE $FONT_BOLD Substrate UI Setup $FONT_NORMAL";
name=$1
if [[ "$name" == "" || "$name" == "-"* ]]
then
echo " Usage: substrate-ui-new <NAME>"
echo
exit 1
fi
if [ -d "$name-ui" ]; then
echo " Subdirectory named $name-ui already exists.";
echo
read -p " $COLOR_MAGENTA $FONT_BOLD Enter (y) to permanently replace the directory contents > $COLOR_WHITE $FONT_NORMAL" choice
echo
case $choice in
[Yy]* )
echo -e " Removing subdirectory $name-ui and its contents...";
rm -rf ./"$name-ui";;
* )
exit 1;;
esac
fi
echo -e " Cloning substrate-ui into subdirectory $name-ui...";
echo
git clone https://github.com/paritytech/substrate-ui --branch substrate-node-template "$name-ui"
pushd .
cd "$name-ui"
command -v yarn >/dev/null 2>&1 || { echo >&2 "Please install yarn. https://yarnpkg.com/en/docs/install"; exit 1; }
yarn
popd
echo
echo "To start the ui, run:"
echo "$ yarn run dev"
echo