From 08833ab4b04d31c06fdf34652d38618b04b11c29 Mon Sep 17 00:00:00 2001 From: Rockpods <69652659+Rockpods@users.noreply.github.com> Date: Sun, 27 Mar 2022 12:48:39 -0500 Subject: [PATCH] BetterReplit and Readme --- .replit | 3 ++- README.md | 3 ++- main.sh | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.replit b/.replit index c5424b5..303ef50 100644 --- a/.replit +++ b/.replit @@ -1,2 +1,3 @@ language = "nodejs" -run = "bash main.sh" +run = "./main.sh" +onBoot = "chmod u+x main.sh" diff --git a/README.md b/README.md index 0b9b7ea..dc33593 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,8 @@ $ npm start ## Replit Setup Guide -To setup on Replit, first click on the "Run on Replit" button. After loading into your repl, run the following commands: +To setup on Replit, first click on the "Run on Replit" button. After loading into your repl, click on the green "Run" button. Alternatively, run the following commands: + ```sh $ npm install $ chmod +x main.sh diff --git a/main.sh b/main.sh index a40eb69..1a0105e 100644 --- a/main.sh +++ b/main.sh @@ -1,2 +1,13 @@ -git submodule update --init -npm start +#!/bin/bash +# Set this to 1 to automatically attempt a fix when an error occurs while running npm start. +fix=0 + + +# Stuff to do at first run(submodule, npm install). +if [[ -d "static" && -n "$(find static -prune -empty 2>/dev/null)" ]] || [[ ! -d "static" ]]; then + npm install + git submodule update --init --recursive +fi + + +npm start || [[ $fix = 1 ]] && npm install && npm update && git submodule update --init --recursive \ No newline at end of file