(^▽^ʃƪ)

main
pxi 2024-12-03 02:13:07 +01:00
parent f5acbc60e9
commit 9d9703a7c6
2 changed files with 30 additions and 12 deletions

View File

@ -1,3 +1,11 @@
# Wakale.casa
This is the repo for the site at https://wakale.casa/
To deploy use:
```
./bin/deploy.sh
```

View File

@ -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
echo "Deploying $APP_PATH/www"
wrangler pages deploy "$APP_PATH/www"
echo "DONE."