Skip to content

Commit

Permalink
set up script updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nofurtherinformation committed Aug 26, 2024
1 parent 34c0b59 commit cfd6589
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 37 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
29 changes: 11 additions & 18 deletions setup-macos.command
Original file line number Diff line number Diff line change
Expand Up @@ -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
pnpm run dev
28 changes: 17 additions & 11 deletions setup-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cfd6589

Please sign in to comment.