From 87a944bd76bf58b2745ef9dbc52b6410d1e298d2 Mon Sep 17 00:00:00 2001 From: nofurtherinformation Date: Mon, 26 Aug 2024 08:46:22 -0500 Subject: [PATCH] update mac script --- setup-macos.command | 29 ----------------------------- setup-macos.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 29 deletions(-) delete mode 100644 setup-macos.command create mode 100755 setup-macos.sh diff --git a/setup-macos.command b/setup-macos.command deleted file mode 100644 index 1bcd255..0000000 --- a/setup-macos.command +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Prompt for environment variables -read -p "Please enter the DATA_ENDPOINT: " DATA_ENDPOINT -read -p "Please enter the NEXT_PUBLIC_MAPBOX_TOKEN: " NEXT_PUBLIC_MAPBOX_TOKEN - -# Create or update the .env file -echo "DATA_ENDPOINT=$DATA_ENDPOINT" > .env -echo "NEXT_PUBLIC_MAPBOX_TOKEN=$NEXT_PUBLIC_MAPBOX_TOKEN" >> .env - -# Check if Node.js is installed -if ! command -v node &> /dev/null -then - 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 - -# Navigate to the application folder -cd "$(dirname "$0")" - -# Install npm dependencies -echo "Installing npm dependencies..." -npm install - -# Run the Next.js development server -echo "Starting Next.js..." -npm run dev \ No newline at end of file diff --git a/setup-macos.sh b/setup-macos.sh new file mode 100755 index 0000000..21e8728 --- /dev/null +++ b/setup-macos.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Prompt for environment variables +read -p "Please enter the DATA_ENDPOINT: " DATA_ENDPOINT +read -p "Please enter the NEXT_PUBLIC_MAPBOX_TOKEN: " NEXT_PUBLIC_MAPBOX_TOKEN + +# Create or update the .env file +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 +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 +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 + +# Install npm dependencies +echo "Installing npm dependencies..." +npm i -g pnpm && pnpm install + +# Run the Next.js development server +echo "Starting Next.js..." +pnpm dev \ No newline at end of file