[dev] Monorepo: core build steps tweaks (copying assets) (#51612)

In this PR we aim to reduce filesystem modification when copying assets into the core by splitting copy tasks in three (one per source package) and using rsync over remove/copy combo.
This commit is contained in:
Vladimir Reznichenko 2024-09-25 15:13:14 +02:00 committed by GitHub
parent 49fa0a7b1a
commit 3f4873bf3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 41 additions and 6 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Minor tweaks in core build process when copying assets from other packages.

View File

@ -12,8 +12,10 @@
"scripts": {
"build": "pnpm --if-present --workspace-concurrency=Infinity --stream --filter=\"$npm_package_name...\" '/^build:project:.*$/'",
"build:project": "pnpm --if-present '/^build:project:.*$/'",
"build:project:copy-assets": "wireit",
"build:project:actualize-translation-domains": "node ./bin/package-update-textdomain.js",
"build:project:copy-assets:legacy": "wireit",
"build:project:copy-assets:admin": "wireit",
"build:project:copy-assets:blocks": "wireit",
"build:project:actualize-translation-domains": "wireit",
"build:zip": "./bin/build-zip.sh",
"changelog": "XDEBUG_MODE=off composer install --quiet && composer exec -- changelogger",
"docker:down": "pnpm exec wc-e2e docker:down",
@ -657,12 +659,41 @@
"ignoreRoot": []
},
"wireit": {
"build:project:copy-assets": {
"command": "rm -rf assets/client/blocks assets/client/admin assets/js assets/css && cp -r ../woocommerce-admin/build assets/client/admin && cp -r client/legacy/build/js assets/js && cp -r client/legacy/build/css assets/css && cp -r ../woocommerce-blocks/build assets/client/blocks && cp -r ../woocommerce-blocks/blocks.ini blocks.ini",
"dependencies": [
"dependencyOutputs"
"build:project:copy-assets:legacy": {
"command": "rsync -avhW --checksum --no-compress --delete --quiet client/legacy/build/css/ assets/css && rsync -avhW --checksum --no-compress --delete --quiet client/legacy/build/js/ assets/js",
"files": [
"client/legacy/build/**/*.*"
],
"output": [
"assets/css",
"assets/js"
]
},
"build:project:copy-assets:admin": {
"command": "rsync -avhW --checksum --no-compress --delete --quiet ../woocommerce-admin/build/ assets/client/admin",
"files": [
"../woocommerce-admin/build/**/*.*"
],
"output": [
"assets/client/admin"
]
},
"build:project:copy-assets:blocks": {
"command": "rsync -avhW --checksum --no-compress --delete --quiet ../woocommerce-blocks/build/ assets/client/blocks && rsync -avhW --checksum --no-compress --quiet ../woocommerce-blocks/blocks.ini blocks.ini",
"files": [
"../woocommerce-blocks/build/**/*.*"
],
"output": [
"assets/client/blocks"
]
},
"build:project:actualize-translation-domains": {
"command": "node ./bin/package-update-textdomain.js",
"files": [
"packages/**/*.php"
],
"output": []
},
"watch:build:project:copy-assets": {
"command": "nodemon --exec \"pnpm run\" build:project",
"service": true