diff --git a/plugins/woocommerce/bin/package-update.sh b/plugins/woocommerce/bin/package-update.sh deleted file mode 100755 index 802d40ba32c..00000000000 --- a/plugins/woocommerce/bin/package-update.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# Output colorized strings -# -# Color codes: -# 0 - black -# 1 - red -# 2 - green -# 3 - yellow -# 4 - blue -# 5 - magenta -# 6 - cian -# 7 - white -output() { - echo "$(tput setaf "$1")$2$(tput sgr0)" -} - -# Autoloader optimization is forced to prevent OOM fatal errors in JetPack Autoloader. -# We running the optimization in background to speedup build process, with dev-environments in mind. -# Building zips enforcing the optimization during the install process, so we are good around building releases as well. -output 3 "Generating optimized autoloaders" -composer dump-autoload --optimize --quiet & - -# find ./packages -name "*.bak" -type f -delete & - -output 2 "Done!" diff --git a/plugins/woocommerce/bin/post-install.sh b/plugins/woocommerce/bin/post-install.sh new file mode 100644 index 00000000000..e07b3395941 --- /dev/null +++ b/plugins/woocommerce/bin/post-install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Required for dev and build environments: generate optimized autoloaders, safe to run in background. +composer dump-autoload --optimize --quiet & +# Required for dev environments: install tooling dependencies, if it failing we'll notice it in CI/locally. +composer bin all install --ansi & diff --git a/plugins/woocommerce/bin/post-update.sh b/plugins/woocommerce/bin/post-update.sh new file mode 100644 index 00000000000..c6ffaf9259f --- /dev/null +++ b/plugins/woocommerce/bin/post-update.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Required for dev and build environments: generate optimized autoloaders, safe to run in background. +composer dump-autoload --optimize --quiet & +# Required for dev environments: update tooling dependencies, not suitable to run in background. +composer bin all update --ansi diff --git a/plugins/woocommerce/composer.json b/plugins/woocommerce/composer.json index a42b16a87a7..548528411b3 100644 --- a/plugins/woocommerce/composer.json +++ b/plugins/woocommerce/composer.json @@ -96,12 +96,10 @@ }, "scripts": { "post-install-cmd": [ - "@composer bin all install --ansi", - "sh ./bin/package-update.sh" + "sh ./bin/post-install.sh" ], "post-update-cmd": [ - "@composer bin all update --ansi", - "sh ./bin/package-update.sh" + "sh ./bin/post-update.sh" ], "test": [ "phpunit" diff --git a/plugins/woocommerce/packages/README.md b/plugins/woocommerce/packages/README.md index aebb5f65d25..807302aa9f2 100644 --- a/plugins/woocommerce/packages/README.md +++ b/plugins/woocommerce/packages/README.md @@ -39,12 +39,6 @@ Edit `composer.json` in the root directory and add the package and package versi ... ``` -Next, if your package contains user translatable strings you'll need to edit `bin/package-update.sh` and instruct it to change your package textdomain to the `woocommerce` textdomain. For example: - -```shell -find ./packages/woocommerce-example-package -iname '*.php' -exec sed -i.bak -e "s/, 'woocommerce-example-package'/, 'woocommerce'/g" {} \; -``` - Finally, you will need to tell core to load your package. Edit `src/Packages.php` and add your package to the list of packages there: ```php