Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Leo Installation to Create Aleo App NPM #757

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading