From cfd6589dc9f40c54bb59af2d639e2afa591c314f Mon Sep 17 00:00:00 2001 From: nofurtherinformation Date: Mon, 26 Aug 2024 09:31:24 -0500 Subject: [PATCH] set up script updates --- README.md | 11 +++-------- setup-macos.command | 29 +++++++++++------------------ setup-windows.bat | 28 +++++++++++++++++----------- 3 files changed, 31 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 07e82cf..d2f5782 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,18 @@ ## Beginner Quickstart - If you simply want to run the application or use the visual interface to edit content, use the following to get started: -_On windows:_ - +*On windows:* - Double click `setup-windows.bat` in the base folder for the project - Enter the `DATA_ENDPOINT` and `NEXT_PUBLIC_MAPBOX_TOKEN` provided from the project team. For non-affiliated users, see data requirements below. - Open your web browser and navigate to `localhost:3000` to view the website, and `localhost:3000/admin/index.html` for the content editor. -_On macos:_ - +*On macos:* - Open the terminal and navigate to the project. You may want to use Github Desktop, then clicked "Repository" > "Open in Terminal" - Run the following command in the terminal: - ``` chmod a+x setup-macos.command ``` - -- Double click `setup-macos.command`. The first time you run the set up script, you may receive an error that the app/script is from an unknown or unidentified developer. To run it anyways, control-click and choose "Open" from the shortcut menu -- you'll see an additional option to run it and in the future you can simply double click it. +- Double click `setup-macos.command` - Enter the `DATA_ENDPOINT` and `NEXT_PUBLIC_MAPBOX_TOKEN` provided from the project team. For non-affiliated users, see data requirements below. - Open your web browser and navigate to `localhost:3000` to view the website, and `localhost:3000/admin/index.html` for the content editor. diff --git a/setup-macos.command b/setup-macos.command index 21e8728..778091e 100755 --- a/setup-macos.command +++ b/setup-macos.command @@ -8,30 +8,23 @@ read -p "Please enter the NEXT_PUBLIC_MAPBOX_TOKEN: " NEXT_PUBLIC_MAPBOX_TOKEN echo "DATA_ENDPOINT=$DATA_ENDPOINT" > .env echo "NEXT_PUBLIC_MAPBOX_TOKEN=$NEXT_PUBLIC_MAPBOX_TOKEN" >> .env -# Navigate to the application folder -cd "$(dirname "$0")" - -# Check if NVM (Node Version Manager) is installed -if ! command -v nvm &> /dev/null +# Check if Node.js is installed +if ! command -v node &> /dev/null then - echo "NVM not found, installing..." - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash - export NVM_DIR="$HOME/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + echo "Node.js not found, installing..." + curl -o nodejs.pkg https://nodejs.org/dist/v18.17.1/node-v18.17.1.pkg + sudo installer -pkg nodejs.pkg -target / + rm nodejs.pkg fi -# Load NVM into the current shell session -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm - -# Install Node.js locally using NVM -nvm install 18.17.1 -nvm use 18.17.1 +# Navigate to the application folder +cd "$(dirname "$0")" # Install npm dependencies echo "Installing npm dependencies..." -npm i -g pnpm && pnpm install +npm i -g pnpm +pnpm install # Run the Next.js development server echo "Starting Next.js..." -pnpm dev \ No newline at end of file +pnpm run dev \ No newline at end of file diff --git a/setup-windows.bat b/setup-windows.bat index 80fc9cf..7c09691 100644 --- a/setup-windows.bat +++ b/setup-windows.bat @@ -9,21 +9,27 @@ REM Create or update the .env file echo DATA_ENDPOINT=%DATA_ENDPOINT% > .env echo NEXT_PUBLIC_MAPBOX_TOKEN=%NEXT_PUBLIC_MAPBOX_TOKEN% >> .env -REM Check if Node.js is installed -where node >nul 2>&1 -IF %ERRORLEVEL% NEQ 0 ( - echo Installing Node.js... - curl -o nodejs.msi https://nodejs.org/dist/v18.17.1/node-v18.17.1-x64.msi - start /wait msiexec /i nodejs.msi /quiet /norestart - del nodejs.msi -) - REM Navigate to the application folder cd /d "%~dp0" +REM Check if Node.js is locally installed +if not exist ".\node-v18.17.1-win-x64\node.exe" ( + echo Downloading Node.js... + curl -o nodejs.zip https://nodejs.org/dist/v18.17.1/node-v18.17.1-win-x64.zip + tar -xf nodejs.zip + del nodejs.zip +) + +REM Add the local Node.js to the PATH +set PATH=%CD%\node-v18.17.1-win-x64;%PATH% + REM Install npm dependencies -echo Installing npm dependencies and running the application... -npm i -g pnpm --silent && pnpm install --silent && pnpm run dev +echo Installing npm dependencies... +.\node-v18.17.1-win-x64\npm install + +REM Run the Next.js development server +echo Starting Next.js... +.\node-v18.17.1-win-x64\npx next dev ENDLOCAL pause \ No newline at end of file