Conversation
Integrate the deploy-ignore filter (from PR #2924) into the Site Sync flow. Files matching .deployignore patterns are now hidden from the sync tree UI and excluded from the push archive. - Add additionalDefaults parameter to createDeployIgnoreFilter for sync-specific Studio-internal exclusions - Update shouldExcludeFromSync to use the ignore filter alongside the existing dotfile check - Thread the deploy-ignore filter through listLocalFileTree recursion - Pass the filter via ExportOptions to DefaultExporter for archive filtering during sync push - Downgrade ignore package from v7 to v5 to match the rest of the dependency tree and avoid TypeScript type conflicts
| "date-fns": "^3.3.1", | ||
| "fast-deep-equal": "^3.1.3", | ||
| "ignore": "^7.0.5", | ||
| "ignore": "^5.3.2", |
There was a problem hiding this comment.
I have made this change because other packages we are already using in Studio rely on the ignore v5. This version provides everything we need.
Using v7 would require several workarounds that would make the code less maintainable and more difficult to read
When specificSelectionPaths is undefined, the exporter reads wp-content from disk directly. Top-level directories like wordpress-seo need to be checked against the deploy-ignore filter before archiving, not just their children in the callback.
The server-side import uses meta.json to install plugins/themes from WordPress.org. Without filtering this list, excluded plugins would be reinstalled by the server even though their files were excluded from the archive.
…ore-to-site-sync
| studioJson.plugins = this.options.deployIgnore | ||
| ? plugins.filter( | ||
| ( p: StudioJsonPluginOrTheme ) => | ||
| ! this.options.deployIgnore!.ignores( `wp-content/plugins/${ p.name }` ) | ||
| ) | ||
| : plugins; | ||
| studioJson.themes = this.options.deployIgnore | ||
| ? themes.filter( | ||
| ( t: StudioJsonPluginOrTheme ) => | ||
| ! this.options.deployIgnore!.ignores( `wp-content/themes/${ t.name }` ) | ||
| ) | ||
| : themes; |
There was a problem hiding this comment.
These changes are required because otherwise the .deployignored plugins/themes would be reinstalled on the target site.
There was a problem hiding this comment.
Pull request overview
Extends existing .deployignore support to Studio’s Site Sync flow (sync tree UI + push/export), ensuring ignored files are consistently hidden/excluded and that meta.json doesn’t re-trigger server-side reinstalls of excluded plugins/themes.
Changes:
- Adds
additionalDefaultssupport to the shared deploy-ignore filter and updates sync defaults to use it. - Updates Sync tree listing/exclusion logic to rely on the deploy-ignore filter (while keeping dotfile hiding UI-only).
- Passes deploy-ignore filtering through the export pipeline and filters
meta.jsonplugin/theme lists accordingly; downgradesignoreto v5 to avoid type conflicts.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/common/package.json | Downgrades ignore dependency to ^5.3.2. |
| tools/common/lib/deploy-ignore.ts | Adds additionalDefaults parameter to createDeployIgnoreFilter. |
| package-lock.json | Updates lockfile entries to reflect ignore@5.3.2 usage. |
| apps/studio/src/modules/sync/lib/tree-utils.ts | Reworks sync exclusion logic to use a deploy-ignore filter + dotfile hiding. |
| apps/studio/src/modules/sync/lib/ipc-handlers.ts | Creates deploy-ignore filter during push export and passes it into ExportOptions. |
| apps/studio/src/modules/sync/constants.ts | Renames/adjusts sync exclusion defaults to Studio-internal items only. |
| apps/studio/src/lib/import-export/export/types.ts | Adds optional deployIgnore?: Ignore to ExportOptions. |
| apps/studio/src/lib/import-export/export/exporters/default-exporter.ts | Applies deploy-ignore filtering during wp-content archive creation and filters meta.json plugins/themes. |
| apps/studio/src/ipc-handlers.ts | Updates listLocalFileTree to build/reuse deploy-ignore filter when listing sync tree. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Noting that #3010 changed a lot of the sync logic on trunk. The CLI now also supports sync, and a lot of the internals moved to |
Related issues
How AI was used in this PR
AI-assisted implementation with human iteration and review of all changes, architecture decisions, and edge cases. I have manually tested the changes as well.
Proposed Changes
Follow-up to #2924, which added
.deployignoresupport for Preview Sites. This PR extends it to Site Sync (push to WordPress.com / Pressable).additionalDefaultsparameter tocreateDeployIgnoreFilterso the sync path can include Studio-internal exclusions (database,db.php,debug.log,sqlite-database-integration,cache) alongside the base defaultslistLocalFileTreeandshouldExcludeFromSyncto use the deploy-ignore filter. Files matching.deployignorepatterns are hidden from the sync dialog. Dotfile hiding is preserved as a separate UI-only checkdeployIgnorefield toExportOptions, used byDefaultExporter.addWpContent()alongside existing hardcoded exclusions (isExactPathExcluded,isPathExcludedByPattern). Local backup export is unaffected (no filter passed)meta.jsonagainst the deploy-ignore filter. Without this, the server-side import would reinstall excluded plugins from WordPress.org even though their files were excluded from the archiveSYNC_EXCLUSIONStoSYNC_ADDITIONAL_DEFAULTS— items already covered by deploy-ignore defaults (.git,node_modules,.DS_Store,Thumbs.db) are removed, keeping only Studio-internal itemsignorepackage from v7 to v5 to match the rest of the dependency tree and avoid TypeScript type conflicts between different major versionsTesting Instructions
Tip
It is probably easier to ask your AI assistant to perform the steps 2 and 3 for you, so you don't have to create the testing files manually.
.deployignorefile at the site root (e.g.,~/Studio/my-site/.deployignore) with the following content:wp-content:wordpress-seoplugin on the sitewordpress-seoplugin is hidden from the treeakismetandmy-pluginare still visibleuploads/2024directory is hiddenuploads/2025is still visiblevendor/some-lib/is excluded from the pushvendor/important-lib/is included (negation pattern)*.logfiles are excludeduploads/2024/is excluded,uploads/2025/is presentwordpress-seoplugin is excluded and not reinstalled by the server.gitandnode_modulesinsidemy-pluginare excluded by built-in defaults.deployignorePre-merge Checklist