Skip to content

Yarik/gm world frontend #372

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

Merged
merged 19 commits into from
May 13, 2024
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
3 changes: 3 additions & 0 deletions .vitepress/constants/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const constants = Object.freeze({
golangVersion: "1.22.2",

nodeVersion: "21.7.2",
yarnVersion: "1.22.19",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(comment 1/2) note to remember to update this and also the script when versions change


rollkitLatestTag: "v0.13.3",
rollkitLatestSha: "45b1573",
rollkitCosmosSDKVersion: "v0.50.6-rollkit-v0.13.3-no-fraud-proofs",
Expand Down
Binary file removed public/gm/cca-2.png
Binary file not shown.
Binary file removed public/gm/cca-3.png
Binary file not shown.
Binary file removed public/gm/cca.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/install-gm-frontend-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

echo "Downloading GM Frontend tutorial source code..."
git clone https://github.com/rollkit/gm-frontend.git
cd gm-frontend || { echo "Failed to find the downloaded repository"; exit 1; }
echo "Installing dependencies..."
yarn install
echo "Starting dev server..."
yarn run dev
43 changes: 28 additions & 15 deletions public/install-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
# Multi-platform (Linux and macOS)
# Multi-architecture (amd64, arm64, arm) support

deps=( curl jq )
# if curl is not installed then install it
if ! command -v curl &> /dev/null; then
echo "curl is not installed. Please install curl and try again."
exit 1
fi

for dep in "${deps[@]}"; do
if ! command -v "$dep" &> /dev/null; then
echo "$dep is not installed. Downloading and executing the script..."
curl -sSL https://rollkit.dev/install-jq.sh | bash
exit $?
fi
done
# if jq is not installed then install it using the script
if ! command -v jq &> /dev/null; then
echo "jq is not installed. Downloading and executing the script to install jq..."
curl -sSL https://rollkit.dev/install-jq.sh | bash
fi

version="${1:-$(curl -s 'https://go.dev/dl/?mode=json' | jq -r '.[0].version')}"
current="$(/usr/local/go/bin/go version 2>/dev/null | awk '{print $3}')"
Expand All @@ -25,15 +27,26 @@ update_go() {
local arch="$1"
local os="$2"

local go_url="https://golang.org/dl/${version}.${os}-${arch}.tar.gz"
local go_url="https://golang.org/dl/go${version}.${os}-${arch}.tar.gz"

curl -so "/tmp/${version}.${os}-${arch}.tar.gz" -L "$go_url" && \
rm -rf /usr/local/go && tar -C /usr/local -xzf /tmp/${version}.${os}-${arch}.tar.gz
echo "Downloading Go from ${go_url}"

tar -C /usr/local -xzf "/tmp/${version}.${os}-${arch}.tar.gz" && \
echo "Go updated to version ${version}"
curl -so "/tmp/go${version}.${os}-${arch}.tar.gz" -L "$go_url"
if [ $? -eq 0 ]; then
tar -C /usr/local -xzf "/tmp/go${version}.${os}-${arch}.tar.gz"
if [ $? -ne 0 ]; then
echo "Failed to extract Go. Possibly corrupted download."
rm "/tmp/go${version}.${os}-${arch}.tar.gz"
exit 1
else
echo "Go updated to version ${version}"
fi
else
echo "Failed to download Go from ${go_url}"
exit 1
fi

rm "/tmp/${version}.${os}-${arch}.tar.gz"
rm "/tmp/go${version}.${os}-${arch}.tar.gz"
}

case "$(uname -s)" in
Expand Down Expand Up @@ -117,4 +130,4 @@ else
echo "$GO_BIN_PATH is already in PATH."
fi

/usr/local/go/bin/go version
$(which go) version
61 changes: 37 additions & 24 deletions public/install-jq.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
#!/bin/bash

if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Detected macOS. Installing jq..."
if ! command -v brew &> /dev/null; then
echo "Homebrew is not installed. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew install jq
echo "jq has been installed successfully."

echo "Detected macOS. Installing jq..."
if ! command -v brew &> /dev/null; then
echo "Homebrew is not installed. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# adding /opt/homebrew/bin to the $PATH variable based on the shell
if [[ -f "$HOME/.bash_profile" ]]; then
echo "export PATH=\"/opt/homebrew/bin:\$PATH\"" >> "$HOME/.bash_profile"
source "$HOME/.bash_profile"
elif [[ -f "$HOME/.bashrc" ]]; then
echo "export PATH=\"/opt/homebrew/bin:\$PATH\"" >> "$HOME/.bashrc"
source "$HOME/.bashrc"
elif [[ -f "$HOME/.zshrc" ]]; then
echo "export PATH=\"/opt/homebrew/bin:\$PATH\"" >> "$HOME/.zshrc"
source "$HOME/.zshrc"
else
echo "Unsupported shell. Please add /opt/homebrew/bin to your PATH manually."
exit 1
fi
fi # Closing the brew installation check
brew install jq
echo "jq has been installed successfully."
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "Detected Linux. Installing jq..."
if command -v apt &> /dev/null; then
sudo apt update
sudo apt install -y jq
elif command -v yum &> /dev/null; then
sudo yum install -y epel-release
sudo yum install -y jq
else
echo "Unsupported package manager. Please install jq manually."
exit 1
fi
echo "jq has been installed successfully."

echo "Detected Linux. Installing jq..."
if command -v apt &> /dev/null; then
sudo apt update
sudo apt install -y jq
elif command -v yum &> /dev/null; then
sudo yum install -y epel-release
sudo yum install -y jq
else
echo "Unsupported package manager. Please install jq manually."
exit 1
fi
echo "jq has been installed successfully."
else
echo "Unsupported operating system."
exit 1
fi
echo "Unsupported operating system."
exit 1
fi # Closing the OS type check

66 changes: 66 additions & 0 deletions public/install-yarn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/sh

set -e

INSTALL_NODE_VER=21.7.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(comment 2/2) Q: how should we maintain these along with the variables?

INSTALL_NVM_VER=0.39.7
INSTALL_YARN_VER=1.22.19

# You can pass node and yarn versions as arguments to this script
if [ "$1" != '' ]; then
echo "==> Using specified node version - $1"
INSTALL_NODE_VER=$1
fi
if [ "$2" != '' ]; then
echo "==> Using specified yarn version - $2"
INSTALL_YARN_VER=$2
fi

echo "==> Ensuring .bashrc exists and is writable"
touch ~/.bashrc

echo "==> Installing node version manager (NVM). Version $INSTALL_NVM_VER"
# Removed if already installed
rm -rf ~/.nvm
# Unset exported variable
export NVM_DIR=

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$INSTALL_NVM_VER/install.sh | bash
# Make nvm command available to terminal
source ~/.nvm/nvm.sh

echo "==> Installing node js version $INSTALL_NODE_VER"
nvm install $INSTALL_NODE_VER

echo "==> Make this version system default"
nvm alias default $INSTALL_NODE_VER
nvm use default

echo "==> Installing Yarn package manager"
rm -rf ~/.yarn
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $INSTALL_YARN_VER

echo "==> Adding Yarn and Node to environment path"
# Yarn configurations
mv $HOME/.nvm/versions/node/v$INSTALL_NODE_VER/bin/node $HOME/.yarn/bin

export PATH="$HOME/.yarn/bin:$PATH"
yarn config set prefix ~/.yarn -g

echo "==> Checking for versions"
nvm --version
node --version
npm --version
yarn --version

echo "==> Print binary paths"
which npm
which node
which yarn

echo "==> List installed node versions"
nvm ls

nvm cache clear
echo "==> Now you're all setup and ready for development. If changes are yet to take effect, I suggest you restart your computer"
Loading
Loading