From c68caa940d7e419ed6ba00ce4c6cd477521f686a Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 4 Feb 2021 16:26:04 +0100 Subject: [PATCH] :art: improve setup script --- setup/setup.bat | 87 ++++++++++++++++++++++++++++++++----------------- setup/setup.sh | 8 +++-- 2 files changed, 62 insertions(+), 33 deletions(-) diff --git a/setup/setup.bat b/setup/setup.bat index b911155..969d948 100644 --- a/setup/setup.bat +++ b/setup/setup.bat @@ -4,37 +4,64 @@ ECHO Discord-Open-Source-Installer ECHO v0.1 ~xnacly ECHO. ECHO str+c/str+d to exit -ECHO 1: /discord-dashboard.git -ECHO 2: /discord-api.git -ECHO 3: /discord-cdn.git -ECHO 4: /discord-client.git -ECHO 5: /discord-react-native.git -ECHO 6: /discord-react.git -ECHO 7: /discord-css.git -ECHO 8: /discord-gateway.git -ECHO A: all of the above ECHO. -CHOICE /c 1234567a /m "decide what repos to install" +ECHO This will clone and setup all repositories, +ECHO if you only want to work on one specific repository +ECHO follow their specific Getting Started Guide and exit this script +ECHO. +CHOICE /C YN /m "Are you sure you want to continue (y/n)?" +IF %ERRORLEVEL% == 2 GOTO :end +where /q git +IF ERRORLEVEL 1 ( + ECHO Error: git is not installed. + ECHO Please Install git from: https://git-scm.com/downloads + ECHO And make sure its in the path + GOTO :end +) -IF %ERRORLEVEL% ==A GOTO ALL -::IF ERRORLEVEL ==1 -::IF ERRORLEVEL ==2 -::IF ERRORLEVEL ==3 -::IF ERRORLEVEL ==4 -::IF ERRORLEVEL ==5 -::IF ERRORLEVEL ==6 -::IF ERRORLEVEL ==7 +where /q node +IF ERRORLEVEL 1 ( + ECHO Error: node is not installed. + ECHO Please Install NodeJS from: https://nodejs.org/en/download/ + ECHO And make sure its in the path + GOTO :end +) -:ALL -cd .. -mkdir discord-open-source-repos -cd discord-open-source-repos -git clone https://github.com/discord-open-source/discord-dashboard.git -git clone https://github.com/discord-open-source/discord-api.git -git clone https://github.com/discord-open-source/discord-gateway.git -git clone https://github.com/discord-open-source/discord-cdn.git -git clone https://github.com/discord-open-source/discord-client.git -git clone https://github.com/discord-open-source/discord-react-native.git -git clone https://github.com/discord-open-source/discord-react.git -git clone https://github.com/discord-open-source/discord-css.git +where /q npm +IF ERRORLEVEL 1 ( + ECHO 'Error: npm is not installed.' >&2 + ECHO Please install npm from: https://nodejs.org/en/download/ + ECHO And make sure its in the path + GOTO :end +) +echo Dependencies are already Installed +ECHO. +echo Creating organization directory +ECHO. +CD ..\..\ +MKDIR discord-open-source-workspace +cd discord-open-source-workspace +ECHO Cloning all repositories +ECHO. +git clone https://github.com/discord-open-source/discord-api api +git clone https://github.com/discord-open-source/discord-gateway gateway +git clone https://github.com/discord-open-source/discord-voice voice +git clone https://github.com/discord-open-source/discord-cdn cdn +git clone https://github.com/discord-open-source/discord-css design +git clone https://github.com/discord-open-source/discord-client client +git clone https://github.com/discord-open-source/discord-react react +git clone https://github.com/discord-open-source/discord-react-native react-native +git clone https://github.com/discord-open-source/discord-dashboard dashboard + +where /q code +IF ERRORLEVEL 0 ( + echo {"folders":[{"path":"cdn"},{"path":"api"},{"path":"gateway"},{"path":"voice"},{"path":"design"},{"path":"react"},{"path":"client"},{"path":"react-native"},{"path":"dashboard"}]}> discord-open-source.code-workspace + + ECHO Opening VSCode Workspace + code discord-open-source.code-workspace +) + +:end +@ECHO on +PAUSE diff --git a/setup/setup.sh b/setup/setup.sh index 2913880..ab0c4b6 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -15,13 +15,13 @@ fi echo --------------------- echo Checking dependencies if ! [ -x "$(command -v git)" ]; then - echo 'Error: git is not installed.' >&2 + echo Error: git is not installed. echo Please Install git from: https://git-scm.com/downloads echo And make sure its in the path exit 1 fi if ! [ -x "$(command -v node)" ]; then - echo 'Error: node is not installed.' >&2 + echo Error: node is not installed. echo Please Install NodeJS from: https://nodejs.org/en/download/ echo And make sure its in the path exit 1 @@ -32,7 +32,7 @@ if ! [ -x "$(command -v npm)" ]; then echo And make sure its in the path exit 1 fi -echo ✓ All Dependencies Installed +echo ✓ Dependencies are already Installed echo ------------------------------- echo Creating organization directory cd ../../ @@ -41,6 +41,7 @@ mkdir discord-open-source mv overview discord-open-source/ cd discord-open-source echo Cloning all repositories + git clone https://github.com/discord-open-source/discord-api api git clone https://github.com/discord-open-source/discord-gateway gateway git clone https://github.com/discord-open-source/discord-voice voice @@ -50,6 +51,7 @@ git clone https://github.com/discord-open-source/discord-client client git clone https://github.com/discord-open-source/discord-react react git clone https://github.com/discord-open-source/discord-react-native react-native git clone https://github.com/discord-open-source/discord-dashboard dashboard + if [ -x "$(command -v code)" ]; then echo '{"folders":[{"path":"overview"},{"path":"cdn"},{"path":"api"},{"path":"gateway"},{"path":"voice"},{"path":"design"},{"path":"react"},{"path":"client"},{"path":"react-native"},{"path":"dashboard"}]}' >> discord-open-source.code-workspace echo Open VSCode Workspace