From 7690fe4b64a20c050e9568ac0f452a8c1a50e3cd Mon Sep 17 00:00:00 2001 From: Frankly George <54015-franklygeorge@users.noreply.gitgud.io> Date: Tue, 22 Oct 2024 05:02:35 +0000 Subject: [PATCH] Tooling update --- devTools/scripts/dependencyCheck.bat | 10 +++---- devTools/scripts/dependencyCheck.sh | 10 +++---- serve.bat | 39 ++++++++++++++-------------- serve.sh | 2 +- setup.bat | 2 +- setup.sh | 2 +- 6 files changed, 33 insertions(+), 32 deletions(-) diff --git a/devTools/scripts/dependencyCheck.bat b/devTools/scripts/dependencyCheck.bat index 7c8743c6b00..20ee7b66bf1 100644 --- a/devTools/scripts/dependencyCheck.bat +++ b/devTools/scripts/dependencyCheck.bat @@ -28,11 +28,10 @@ IF DEFINED git ( ) :: Otherwise prompt the user -ECHO This project has some optional dependencies that enable features that we believe will make the development process easier and more fruitful. -ECHO You are seeing this because some or all of these dependencies are missing. -ECHO If you wish to no longer see this, please use the simple compiler. 'simple-compiler.bat' +ECHO This project has some optional dependencies that enable extra features that we believe will be helpful to our users and developers. +ECHO You are seeing this because the feature you are trying to use requires dependencies that are missing. ECHO. -ECHO Here is a list of the packages that are missing: +ECHO Here is a list of the dependencies that are missing: IF NOT DEFINED git CALL :gitMessage @@ -74,6 +73,7 @@ GOTO :eof :nodeMessage ECHO Node.js, https://nodejs.org/, enables all of the new sanity checks and the advanced compiler. ECHO Allows for things like: +ECHO Serving FC using 'serve.bat' ECHO Source maps for easier debugging: https://dzone.com/articles/what-are-source-maps-and-how-to-properly-use-them ECHO JavaScript linting to catch bugs early using ESLint: https://eslint.org/ ECHO JavaScript type checking to catch bugs early using the Typescript compiler: https://www.typescriptlang.org/ @@ -90,7 +90,7 @@ GOTO :eof :: if node_modules doesn't exist IF NOT EXIST node_modules ( ECHO. - ECHO All optional dependencies for the advance compiler are installed, but the Node modules are not installed. + ECHO All optional dependencies are installed, but the Node modules are not installed. ECHO. ECHO These packages should take up less than 500MB of disk space. ~150 MB at time of writing. ECHO They will be stored in the 'node_modules' directory inside of the project directory. diff --git a/devTools/scripts/dependencyCheck.sh b/devTools/scripts/dependencyCheck.sh index aa5f5ee0afd..beee2e91e08 100755 --- a/devTools/scripts/dependencyCheck.sh +++ b/devTools/scripts/dependencyCheck.sh @@ -17,7 +17,7 @@ function modulesCheck() { if [[ ! -d node_modules ]]; then # ask user if we can install modules echo "" - echo "All optional dependencies for the advance compiler are installed, but the Node modules are not installed." + echo "All optional dependencies are installed, but the Node modules are not installed." echo "" echo "These packages should take up less than 500MB of disk space. (~150 MB at time of writing)." echo "They will be stored in the 'node_modules' directory inside of the project directory." @@ -141,11 +141,10 @@ if [[ "$git" && "$node" ]]; then fi # Otherwise prompt the user -echo "This project has some optional dependencies that enable features that we believe will make the development process easier and more fruitful." -echo "You are seeing this because some or all of these dependencies are missing." -echo "If you wish to no longer see this, please use the simple compiler. 'simple-compiler.sh'" +echo "This project has some optional dependencies that enable extra features that we believe will be helpful to our users and developers." +echo "You are seeing this because the feature you are trying to use requires dependencies that are missing." echo "" -echo "Here is a list of the packages that are missing:" +echo "Here is a list of the dependencies that are missing:" if [[ ! "$git" ]]; then echo " git, https://git-scm.com/, needed to interact with the .git folder in this project." @@ -157,6 +156,7 @@ fi if [[ ! "$node" ]]; then echo " Node.js, https://nodejs.org/, enables all of the new sanity checks and the advanced compiler." echo " Allows for things like:" + echo " Serving FC using 'serve.sh'" echo " Source maps for easier debugging: https://dzone.com/articles/what-are-source-maps-and-how-to-properly-use-them" echo " JavaScript linting to catch bugs early using ESLint: https://eslint.org/" echo " JavaScript type checking to catch bugs early using the Typescript compiler: https://www.typescriptlang.org/" diff --git a/serve.bat b/serve.bat index 986de8a1fe9..55e5128ce41 100644 --- a/serve.bat +++ b/serve.bat @@ -5,24 +5,25 @@ pushd %~dp0 SET BASEDIR=%~dp0 -:: check for node -where /q node -IF ERRORLEVEL 1 ( - ECHO Node is required to run this http server. - exit /b 0 -) +:: run dependencyCheck.bat +CALL .\devTools\scripts\dependencyCheck.bat +SET CODE=%ERRORLEVEL% -:: if the node_modules directory doesn't exist -IF NOT EXIST .\node_modules\ ( - ECHO Node available, but the required Node modules are not installed. - CHOICE /C YN /N /M "Would you like us to run 'npm install' to install Node modules, using ~120 MB of disk space [Y/N]?" - IF !errorlevel!==1 ( - ECHO Installing Node modules... - CALL npm install - ) ELSE ( - ECHO Requirements not met, exiting... - exit /b 0 - ) +IF %CODE% EQU 69 ( + :: if exit code is 69, then we don't have all the dependencies we need + ECHO. + ECHO Dependencies not met. + ECHO. + EXIT /b 0 +) ELSE IF %CODE% EQU 0 ( + :: if exit code is 0, run web server + CALL npx http-server --port 6969 -c-1 + EXIT /b 0 +) ELSE ( + :: if exit code is not 0, print error message + ECHO. + ECHO dependencyCheck.bat exited with code: %CODE% + ECHO Dependency check failed. + ECHO. + EXIT /b 0 ) - -CALL npx http-server --port 6969 -c-1 diff --git a/serve.sh b/serve.sh index bf0b76429b9..df006ed8602 100755 --- a/serve.sh +++ b/serve.sh @@ -15,7 +15,7 @@ if [[ $exitCode -eq 69 ]]; then # if exit code is not 0, print error message elif [[ $exitCode -ne 0 ]]; then echo "dependencyCheck.sh exited with code: $exitCode" - echo "Dependency check failed unexpectedly." + echo "Dependency check failed." echo "" exit 0 # if exit code is 0, run web server diff --git a/setup.bat b/setup.bat index 62601e44451..e5954b4561b 100644 --- a/setup.bat +++ b/setup.bat @@ -20,7 +20,7 @@ IF %CODE% EQU 69 ( :: if exit code is not 0, print error message ECHO. ECHO dependencyCheck.bat exited with code: %CODE% - ECHO Dependency check failed unexpectedly. + ECHO Dependency check failed. ECHO If the only thing you need is to simply compile FC, then you can use 'simple-compiler.bat' instead. ECHO. EXIT /b 0 diff --git a/setup.sh b/setup.sh index 8910112836e..cc7fc64cfeb 100755 --- a/setup.sh +++ b/setup.sh @@ -16,7 +16,7 @@ if [[ $exitCode -eq 69 ]]; then # if exit code is not 0, print error message elif [[ $exitCode -ne 0 ]]; then echo "dependencyCheck.sh exited with code: $exitCode" - echo "Dependency check failed unexpectedly." + echo "Dependency check failed." echo "If the only thing you need is to simply compile FC, then you can use 'simple-compiler.bat' instead." echo "" exit 0 -- GitLab