Add pre build script to delete assets (#35627)

* Add pre build script to delete assets

* Chain the script instead

* Add the cleanup dependency to turbo config

* Add assets cleanup for build zip command
This commit is contained in:
Roy Ho 2022-11-21 12:05:26 -08:00 committed by GitHub
parent ee64675fa5
commit 4770123fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,3 @@
Significance: patch
Type: dev
Comment: Adds pre build script to first delete asset items.

View File

@ -19,6 +19,7 @@
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"build:assets-cleanup": "find ./assets/css/. ! -name '.gitkeep' -type f -exec rm -f {} + && find ./assets/client/. ! -name '.gitkeep' -type f -exec rm -f {} + && find ./assets/js/. ! -name '.gitkeep' -type f -exec rm -f {} +",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "pnpm lint:php",
"build:feature-config": "php bin/generate-feature-config.php",

View File

@ -4,8 +4,11 @@
"build:feature-config": {
"cache": false
},
"build:assets-cleanup": {
"cache": false
},
"turbo:build": {
"dependsOn": [ "build:feature-config", "^turbo:build", "$WC_ADMIN_PHASE" ],
"dependsOn": [ "build:feature-config", "build:assets-cleanup", "^turbo:build", "$WC_ADMIN_PHASE" ],
"inputs": [
"src/**/*.js",
"src/**/*.jsx",
@ -27,6 +30,7 @@
"woocommerce#turbo:build": {
"dependsOn": [
"build:feature-config",
"build:assets-cleanup",
"^turbo:build",
"woocommerce/client/admin#turbo:build",
"woocommerce/client/legacy#turbo:build"
@ -39,8 +43,14 @@
"outputMode": "new-only"
},
"woocommerce#build:zip": {
"dependsOn": [
"^build:assets-cleanup"
]
},
"woocommerce/client/legacy#turbo:build": {
"dependsOn": [ "^turbo:build" ],
"dependsOn": [ "build:assets-cleanup", "^turbo:build" ],
"outputs": [
"../../assets/js/**",
"../../assets/css/**"