Monorepo: cleanup.

This commit is contained in:
Vladimir Reznichenko 2024-09-20 09:56:45 +02:00
parent 14687acccc
commit 300aae11da
5 changed files with 14 additions and 36 deletions

View File

@ -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!"

View File

@ -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 &

View File

@ -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

View File

@ -96,12 +96,10 @@
}, },
"scripts": { "scripts": {
"post-install-cmd": [ "post-install-cmd": [
"@composer bin all install --ansi", "sh ./bin/post-install.sh"
"sh ./bin/package-update.sh"
], ],
"post-update-cmd": [ "post-update-cmd": [
"@composer bin all update --ansi", "sh ./bin/post-update.sh"
"sh ./bin/package-update.sh"
], ],
"test": [ "test": [
"phpunit" "phpunit"

View File

@ -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: 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 ```php