HEX
Server: Apache
System: Linux linplesk41.pumo.com.tw 3.10.0-962.3.2.lve1.5.27.el7.x86_64 #1 SMP Sat Nov 30 02:18:52 EST 2019 x86_64
User: rajlaw (10192)
PHP: 7.4.24
Disabled: phpinfo,passthru,exec,shell_exec,system,popen,proc_open,proc_close,show_source,pcntl_exec,escapeshellcmd,proc_get_status,proc_nice,proc_terminate,escapeshellarg
Upload Files
File: /home/httpd/vhosts/rajlaw.com.tw/httpdocs/wp-content/plugins/everest-forms/bin/build-zip.sh
#!/bin/sh

PLUGIN_SLUG="everest-forms"
PROJECT_PATH=$(pwd)
BUILD_PATH="${PROJECT_PATH}/build"
DEST_PATH="$BUILD_PATH/$PLUGIN_SLUG"

echo "Generating build directory..."
rm -rf "$BUILD_PATH"
mkdir -p "$DEST_PATH"

echo "Installing PHP and JS dependencies..."
npm install
composer install || exit "$?"
echo "Running JS Build..."
npm run build:core || exit "$?"
echo "Cleaning up PHP dependencies..."
composer install --no-dev || exit "$?"

echo "Syncing files..."
rsync -rc --exclude-from="$PROJECT_PATH/.distignore" "$PROJECT_PATH/" "$DEST_PATH/" --delete --delete-excluded

echo "Generating zip file..."
cd "$BUILD_PATH" || exit
zip -q -r "${PLUGIN_SLUG}.zip" "$PLUGIN_SLUG/"

cd "$PROJECT_PATH" || exit
mv "$BUILD_PATH/${PLUGIN_SLUG}.zip" "$PROJECT_PATH"
echo "${PLUGIN_SLUG}.zip file generated!"

echo "Build done!"