[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": { "scripts": {
"build": "pnpm --if-present --workspace-concurrency=Infinity --stream --filter=\"$npm_package_name...\" '/^build:project:.*$/'", "build": "pnpm --if-present --workspace-concurrency=Infinity --stream --filter=\"$npm_package_name...\" '/^build:project:.*$/'",
"build:project": "pnpm --if-present '/^build:project:.*$/'", "build:project": "pnpm --if-present '/^build:project:.*$/'",
"build:project:copy-assets": "wireit", "build:project:copy-assets:legacy": "wireit",
"build:project:actualize-translation-domains": "node ./bin/package-update-textdomain.js", "build:project:copy-assets:admin": "wireit",
"build:project:copy-assets:blocks": "wireit",
"build:project:actualize-translation-domains": "wireit",
"build:zip": "./bin/build-zip.sh", "build:zip": "./bin/build-zip.sh",
"changelog": "XDEBUG_MODE=off composer install --quiet && composer exec -- changelogger", "changelog": "XDEBUG_MODE=off composer install --quiet && composer exec -- changelogger",
"docker:down": "pnpm exec wc-e2e docker:down", "docker:down": "pnpm exec wc-e2e docker:down",
@ -657,12 +659,41 @@
"ignoreRoot": [] "ignoreRoot": []
}, },
"wireit": { "wireit": {
"build:project:copy-assets": { "build:project:copy-assets:legacy": {
"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", "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",
"dependencies": [ "files": [
"dependencyOutputs" "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": { "watch:build:project:copy-assets": {
"command": "nodemon --exec \"pnpm run\" build:project", "command": "nodemon --exec \"pnpm run\" build:project",
"service": true "service": true