(^▽^ʃƪ)

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