2020-05-07 16:11:20 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
PLUGIN_SLUG="woocommerce"
|
|
|
|
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..."
|
2021-01-27 15:59:31 +00:00
|
|
|
npm run install:no-e2e
|
2020-05-07 16:11:20 +00:00
|
|
|
composer install || exit "$?"
|
|
|
|
echo "Running JS Build..."
|
2020-08-12 19:51:56 +00:00
|
|
|
npm run build:core || exit "$?"
|
2020-05-07 16:11:20 +00:00
|
|
|
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/"
|
2020-08-12 19:51:56 +00:00
|
|
|
|
|
|
|
cd "$PROJECT_PATH" || exit
|
|
|
|
mv "$BUILD_PATH/${PLUGIN_SLUG}.zip" "$PROJECT_PATH"
|
|
|
|
echo "${PLUGIN_SLUG}.zip file generated!"
|
2020-05-07 16:11:20 +00:00
|
|
|
|
|
|
|
echo "Build done!"
|