diff --git a/README.md b/README.md index a5dd6bc..c98ec21 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # Wakale.casa -This is the repo for the site at https://wakale.casa/ \ No newline at end of file +This is the repo for the site at https://wakale.casa/ + +To deploy use: + +``` + +./bin/deploy.sh + +``` \ No newline at end of file diff --git a/bin/deploy.sh b/bin/deploy.sh index 3fad4dd..c55bd44 100755 --- a/bin/deploy.sh +++ b/bin/deploy.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#! /bin/bash # Get the full path to the dist directory APP_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # Function to check if a command exists command_exists() { - command -v "$1" >/dev/null 2>&1 + command -v "$1" > /dev/null 2>&1 } # Check and install NVM if not present -if ! command_exists nvm; then +if [ ! -d "$HOME/.nvm/.git" ]; then echo "NVM not found. Installing NVM..." # Check if curl is installed @@ -30,15 +30,20 @@ if ! command_exists nvm; then # Install NVM curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash +fi - # Source NVM to make it available in the current script - export NVM_DIR="$HOME/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" +# Source NVM to make it available in the current script +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" + +if ! command_exists npm; then + echo "NPM not installed, installing." + nvm install node fi # Use Node.js newest version -nvm install node +echo "Using version of node.js" nvm use node # Check and install Wrangler if not present @@ -54,12 +59,17 @@ if ! wrangler whoami &> /dev/null; then fi if [ -f "$APP_PATH/packages.json" ]; then - # Install project dependencies + echo "Install project dependencies" npm install - # Build your project + + echo "Build your project" npm run build fi # Deploy to Cloudflare Pages using the full path to dist -wrangler pages deploy "$APP_PATH/www" \ No newline at end of file +echo "Deploying $APP_PATH/www" + +wrangler pages deploy "$APP_PATH/www" + +echo "DONE."