Skip to content

Unify selective push and export logic - #2006

Merged
sejas merged 10 commits into
trunkfrom
update/push-folder-structure-unique-exporter
Nov 5, 2025
Merged

Unify selective push and export logic#2006
sejas merged 10 commits into
trunkfrom
update/push-folder-structure-unique-exporter

Conversation

@sejas

@sejas sejas commented Nov 5, 2025

Copy link
Copy Markdown
Member

Related issues

Proposed Changes

  • Simplifies the push and export logic to produce same wp-content data. sqlite-database-integration is excluded and all the wp-content data is included.
  • Improve tests respecting the fake files and directories

Testing Instructions

Test selective push

  • Apply this diff
diff --git a/src/ipc-handlers.ts b/src/ipc-handlers.ts
index c44c6256..037cb80f 100644
--- a/src/ipc-handlers.ts
+++ b/src/ipc-handlers.ts
@@ -794,6 +794,9 @@ export async function exportSiteForPush(
 		const stats = fs.statSync( archivePath );
 		return { archivePath, archiveSizeInBytes: stats.size };
 	} finally {
+		const tempralDestination = `${ TEMP_DIR }manual-test.${ extension }`;
+		fs.copyFileSync( archivePath, tempralDestination );
+		shell.showItemInFolder( tempralDestination );
 		SYNC_ABORT_CONTROLLERS.delete( operationId );
 	}
 }
@@ -826,6 +829,8 @@ export async function pushArchive(
 		formData.push( [ 'options', optionsToSync.join( ',' ) ] );
 	}
 
+	return { success: true };
+
 	try {
 		await wpcom.req.post( {
 			path: `/sites/${ remoteSiteId }/studio-app/sync/import`,
  • Run npm start
  • Go to the Sync tab
  • Connect a site and click on push
  • Select only database
  • Observe that the zip file created contains only the SQL files and other meta files
  • Click again on push
  • Select all options (database and files)
  • Observe the zip created contains also extra-folders and files inside wp-content
  • Click again on push
  • Select only mu-plugins
  • Observe that the sqlite-database-integration is not included in the zip file.
test-push.mp4

Test export database and full export

  • Run npm start
  • Go to the Sync tab
  • Export the database
  • Observe the database is correctly exported
  • Export the full site
  • Observe that the zip file created contains only the SQL files and other meta files
test-exports.mp4

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@sejas sejas mentioned this pull request Nov 5, 2025
1 task
@github-actions

github-actions Bot commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

📊 Performance Test Results

Comparing 8a701ae vs trunk

site-editor

Metric trunk 8a701ae Diff Change
load 11252.00 ms 10492.00 ms -760.00 ms 🟢 -6.8%

site-startup

Metric trunk 8a701ae Diff Change
siteCreation 21151.00 ms 20228.00 ms -923.00 ms 🟢 -4.4%
siteStartup 5992.00 ms 6970.00 ms +978.00 ms 🔴 16.3%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@sejas
sejas marked this pull request as ready for review November 5, 2025 11:02
@sejas sejas self-assigned this Nov 5, 2025
@sejas
sejas requested review from a team and katinthehatsite November 5, 2025 11:02
@sejas sejas mentioned this pull request Nov 5, 2025
1 task
const stat = fs.statSync( fullPath );
const stat = await fsPromises.stat( fullPath );
if ( stat.isDirectory() ) {
this.archiveBuilder.directory( fullPath, archivePath );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simplification 👍

@katinthehatsite katinthehatsite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, different test cases worked well 👍

@sejas
sejas merged commit aa26e3f into trunk Nov 5, 2025
12 checks passed
@sejas
sejas deleted the update/push-folder-structure-unique-exporter branch November 5, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants