diff --git a/scripts/setup/README.md b/scripts/setup/README.md index 0c51c56..0eff3f7 100644 --- a/scripts/setup/README.md +++ b/scripts/setup/README.md @@ -1,17 +1,19 @@ -## Getting Started - +# Getting Started +## Without automated scripts ### Windows +1. Open up a Terminal. +2. Type this command: `curl https://raw.githubusercontent.com/fosscord/fosscord/main/scripts/setup/setup.bat --output setup.bat && setup.bat`. -to setup all repositories open cmd and enter this to command +### Posix systems (MacOS, Linux...) +1. Open up a Terminal. +2. Type this command: `curl https://raw.githubusercontent.com/fosscord/fosscord/main/scripts/setup/setup.sh --output setup.sh && sh setup.sh`. -``` -curl https://raw.githubusercontent.com/fosscord/fosscord/main/scripts/setup/setup.bat --output setup.bat && setup.bat -``` +## With automated scripts +This method need to have [Git](https://git-scm.com) installed. +### Windows +1. Open up a Terminal. +2. Type this command: `git clone https://github.com/fosscord/fosscord && .\scripts\setup\setup.bat`. -### Linux/MacOS - -to setup all repositories open the terminal and enter this to command - -``` -curl https://raw.githubusercontent.com/fosscord/fosscord/main/scripts/setup/setup.sh --output setup.sh && bash setup.sh -``` +### Posix systems (MacOS, Linux...) +1. Open up a Terminal. +2. Type this command: `git clone https://github.com/fosscord/fosscord && sh ./scripts/setup/setup.sh`. diff --git a/scripts/setup/setup.bat b/scripts/setup/setup.bat index 0426bd7..dbd1a96 100755 --- a/scripts/setup/setup.bat +++ b/scripts/setup/setup.bat @@ -27,7 +27,7 @@ IF ERRORLEVEL 1 ( where /q node IF ERRORLEVEL 1 ( ECHO Error: node is not installed. - ECHO Please Install NodeJS from: https://nodejs.org/en/download/ + ECHO Please Install NodeJS from: https://nodejs.org/en/download ECHO And make sure its in the path GOTO :end ) @@ -35,11 +35,11 @@ IF ERRORLEVEL 1 ( where /q npm IF ERRORLEVEL 1 ( ECHO 'Error: npm is not installed.' >&2 - ECHO Please install npm from: https://nodejs.org/en/download/ + 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 Dependencies are already installed ECHO. echo Creating organization directory ECHO. @@ -66,20 +66,19 @@ git clone https://github.com/fosscord/react-native-withcss react-native-withcss echo {"folders":[{"path":"overview"},{"path":"cdn"},{"path":"api"},{"path":"gateway"},{"path":"media"},{"path":"server-util"},{"path":"ui"},{"path":"client"},{"path":"plugins"},{"path":"themes"},{"path":"landingpage"},{"path":"dashboard"},{"path":"support"},{"path":"css-mediaquery"},{"path":"react-native-withcss"}]}> fosscord.code-workspace -where /q code IF ERRORLEVEL 0 ( - - ECHO Opening VSCode Workspace + CHOICE /c yn /m "Do you want to launch the VS Code workspace?" + IF %ERRORLEVEL% == 2 GOTO :rpc + ECHO Opening VS Code Workspace code fosscord.code-workspace ) - +:rpc CHOICE /c yn /m "Do you want to install the Discord Rich Presence?" IF %ERRORLEVEL% == 2 GOTO :end cd .. cd rpc - npm install npm i pm2 -g diff --git a/scripts/setup/setup.sh b/scripts/setup/setup.sh index d314a44..72b0884 100755 --- a/scripts/setup/setup.sh +++ b/scripts/setup/setup.sh @@ -1,7 +1,7 @@ #!/bin/sh cat << EOF -------------------------------------- -Discord Open Source Contribution Setup +Fosscord Open Source Contribution Setup strg+c/strg+d to exit ------------------------------------------- This will clone and setup all repositories, @@ -9,7 +9,7 @@ if you only want to work on one specific repository follow their specific Getting Started Guide and exit this script ---------------------------------------------------------------- EOF -printf "Are you sure you want to continue (y/N)? " +printf "Are you sure you want to continue (y/N)?" read -p "" CONT if [ "$CONT" != "y" ]; then echo Aborting setup @@ -25,17 +25,17 @@ if ! [ -x "$(command -v git)" ]; then fi if ! [ -x "$(command -v node)" ]; then echo Error: node is not installed. - echo Please Install NodeJS from: https://nodejs.org/en/download/ + echo Please Install NodeJS from: https://nodejs.org/en/download echo And make sure its in the path exit 1 fi if ! [ -x "$(command -v npm)" ]; then echo 'Error: npm is not installed.' >&2 - echo Please install npm from: https://nodejs.org/en/download/ + echo Please install npm from: https://nodejs.org/en/download echo And make sure its in the path exit 1 fi -echo ✓ Dependencies are already Installed +echo ✓ Dependencies are already installed echo ------------------------------- echo Creating organization directory mkdir fosscord @@ -61,7 +61,12 @@ git clone https://github.com/fosscord/react-native-withcss react-native-withcss echo '{"folders":[{"path":"overview"},{"path":"cdn"},{"path":"api"},{"path":"gateway"},{"path":"media"},{"path":"server-util"},{"path":"ui"},{"path":"client"},{"path":"plugins"},{"path":"themes"},{"path":"landingpage"},{"path":"dashboard"},{"path":"support"},{"path":"css-mediaquery"},{"path":"react-native-withcss"}]}' >> fosscord.code-workspace -if [ -x "$(command -v code)" ]; then - echo Open VSCode Workspace - code fosscord.code-workspace -fi +echo "Do you want to launch VS Code workspace?" +select yn in "y" "n"; do + case $yn in + Yes ) echo Opening VS Code Workspace ; code fosscord.code-workspace ; break;; + No ) break;; + esac +done + +echo Installation finished diff --git a/scripts/update/update-all.bat b/scripts/update/update-all.bat new file mode 100644 index 0000000..31ef87b --- /dev/null +++ b/scripts/update/update-all.bat @@ -0,0 +1,3 @@ +@ECHO off +.\update-git.bat +.\update-npm.bat diff --git a/scripts/update/update-all.sh b/scripts/update/update-all.sh new file mode 100644 index 0000000..c022fa4 --- /dev/null +++ b/scripts/update/update-all.sh @@ -0,0 +1,2 @@ +sh update-git.sh +sh update-npm.sh diff --git a/scripts/update/update-git.bat b/scripts/update/update-git.bat new file mode 100644 index 0000000..3e5bc70 --- /dev/null +++ b/scripts/update/update-git.bat @@ -0,0 +1,5 @@ +@ECHO off +ECHO Update for Git... +cd ..\.. +FOR /D %%a IN (%CD%\fosscord\*) do echo -------------- && echo %%~fa && cd %%~fa && git sync +@ECHO on diff --git a/scripts/update/update-git.sh b/scripts/update/update-git.sh new file mode 100644 index 0000000..eb21b64 --- /dev/null +++ b/scripts/update/update-git.sh @@ -0,0 +1,9 @@ +echo Update files... +cd ../.. +for D in */; do + echo -------------- + echo "$D"; + cd $D + git sync + cd .. +done diff --git a/scripts/update/update-npm.bat b/scripts/update/update-npm.bat new file mode 100644 index 0000000..e55da47 --- /dev/null +++ b/scripts/update/update-npm.bat @@ -0,0 +1,9 @@ +@ECHO off +ECHO Update all dependencies... +where /q pnpm +IF ERRORLEVEL 1 ( + FOR /D %%a IN (%CD%\fosscord\*) do echo -------------- && echo %%~fa && cd %%~fa && npm i +) ELSE ( + FOR /D %%a IN (%CD%\fosscord\*) do echo -------------- && echo %%~fa && cd %%~fa && pnpm i +) +@ECHO on diff --git a/scripts/update/update-npm.sh b/scripts/update/update-npm.sh new file mode 100644 index 0000000..11fa66a --- /dev/null +++ b/scripts/update/update-npm.sh @@ -0,0 +1,13 @@ +echo Update all dependancies... +cd ../.. +for D in */; do + echo -------------- + echo "$D"; + cd $D + if [ $pnpm = true ] + if ! [ -x "$(command -v pnpm)" ]; then + npm i + else + pnpm i + fi +done diff --git a/scripts/update/update.bat b/scripts/update/update.bat deleted file mode 100644 index 2e1a2c0..0000000 --- a/scripts/update/update.bat +++ /dev/null @@ -1,5 +0,0 @@ -@ECHO off -ECHO Update... -cd ..\..\..\ -FOR /D %%a IN (%CD%\fosscord-workspace\*) do git -C %%~fa pull && npm i -PAUSE \ No newline at end of file diff --git a/scripts/update/update.sh b/scripts/update/update.sh deleted file mode 100755 index 9f2f770..0000000 --- a/scripts/update/update.sh +++ /dev/null @@ -1,11 +0,0 @@ -echo Update all repositories ... -cd ../../../ -for D in */; do - echo -------------- - echo "$D"; - cd $D - git pull - npm i - cd .. -done -echo Done \ No newline at end of file