Skip to content

Commit

Permalink
add leo installation to create aleo app (#757)
Browse files Browse the repository at this point in the history
Co-authored-by: Collin Chin <[email protected]>
  • Loading branch information
frank-aleo and collinc97 authored Oct 4, 2023
1 parent 5d78f43 commit f7753d1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
30 changes: 30 additions & 0 deletions create-aleo-app/template-react-leo/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# script exists immediately if command fails
set -e

# check for dependencies
command -v git >/dev/null 2>&1 || { echo >&2 "git is required but it's not installed. Aborting."; exit 1; }
command -v cargo >/dev/null 2>&1 || { echo >&2 "cargo is required but it's not installed. Aborting."; exit 1; }

INSTALL_DIR="${INSTALL_DIR:-$HOME/.leo}"

# ask for confirmation
read -p "This script will install Leo into $INSTALL_DIR. Do you want to continue? (y/N) " choice
case "$choice" in
y|Y ) echo "Continuing installation...";;
* ) echo "Aborting."; exit;;
esac

# clone or update the repo
if [ -d "$INSTALL_DIR" ]; then
echo "Directory $INSTALL_DIR exists. Updating repository..."
git -C "$INSTALL_DIR" pull
else
echo "Cloning repository into $INSTALL_DIR..."
git clone https://github.com/AleoHQ/leo "$INSTALL_DIR"
fi

# build and install
echo "Building and installing from source..."
cargo install --path "$INSTALL_DIR"
3 changes: 2 additions & 1 deletion create-aleo-app/template-react-leo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"build": "webpack --config webpack.config.js",
"build:vite": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"install-leo": "./install.sh"
},
"dependencies": {
"@aleohq/sdk": "^0.5.10",
Expand Down

0 comments on commit f7753d1

Please sign in to comment.