Skip to content

Commit

Permalink
Add pre build script to delete assets (woocommerce#35627)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
roykho authored Nov 21, 2022
1 parent ee64675 commit 4770123
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions plugins/woocommerce/changelog/add-pre-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Significance: patch
Type: dev
Comment: Adds pre build script to first delete asset items.
1 change: 1 addition & 0 deletions plugins/woocommerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 12 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand All @@ -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/**"
Expand Down

0 comments on commit 4770123

Please sign in to comment.