Created
September 4, 2023 19:46
-
-
Save Daniel217D/e3d872d63a84504c65bfc0f9a8bd61c0 to your computer and use it in GitHub Desktop.
Script to build composer + npm project (WordPress plugin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e #Скрипт не будет продолжать работу если возникнет ошибка | |
DIR=$(pwd) | |
BUILD_DIR="$DIR/build/test-plugin" | |
# Установить composer зависимости | |
# --optimize-autoloader для оптимизации автозагрузчика | |
# --no-dev игнорировать dev зависимости | |
# -q без вывода лишней информации | |
composer install --optimize-autoloader --no-dev -q | |
# Установить npm зависимости | |
if [ ! -d "./node_modules" ]; | |
then | |
# npm ci для установки зависимостей по файлу package-lock.json | |
npm ci --ignore-scripts | |
fi | |
# Запустить сборку | |
npm run build | |
FILES=(assets includes templates vendor readme.txt test-plugin.php) | |
for file in ${FILES[@]}; do | |
cp -R $file $BUILD_DIR | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment