Browse Source

Added a utility to pull changes to all themes from sandbox (#7573)

Jason Crist 1 year ago
parent
commit
583a39960f
2 changed files with 20 additions and 0 deletions
  1. 1 0
      package.json
  2. 19 0
      theme-utils.mjs

+ 1 - 0
package.json

@@ -22,6 +22,7 @@
 		"deploy:theme": "node ./theme-utils.mjs deploy-theme",
 		"deploy:zip": "node ./theme-utils.mjs build-com-zip",
 		"deploy:land": "node ./theme-utils.mjs land-diff",
+		"pull:all": "node ./theme-utils.mjs pull-all-themes", 
 		"core:pull": "node ./theme-utils.mjs pull-core-themes",
 		"core:push": "node ./theme-utils.mjs push-core-themes",
 		"core:sync": "node ./theme-utils.mjs sync-core-theme",

+ 19 - 0
theme-utils.mjs

@@ -75,6 +75,10 @@ const commands = {
 		additionalArgs: '<theme-slug>',
 		run: (args) => checkoutCoreTheme(args?.[1])
 	},
+	"pull-all-themes": {
+		helpText: 'Use rsync to copy all public theme files from your sandbox to your local machine.',
+		run: pullAllThemes
+	},
 	"pull-core-themes": {
 		helpText: 'Use rsync to copy all public CORE theme files from your sandbox to your local machine. CORE themes are any of the Twenty<whatever> themes.',
 		run: pullCoreThemes
@@ -910,6 +914,21 @@ async function checkoutCoreTheme(theme) {
 	`);
 }
 
+async function pullAllThemes() {
+	console.log("Pulling ALL themes from sandbox.");
+	let allThemes = await getActionableThemes();
+	for (let theme of allThemes) {
+		try {
+		await executeCommand(`
+			rsync -avr --no-p --no-times --delete -m --exclude-from='.sandbox-ignore' wpcom-sandbox:${sandboxPublicThemesFolder}/${theme}/ ./${theme}/ 
+		`, true);
+		}
+		catch (err) {
+			console.log('Error pulling:', err);
+		}
+	}
+}
+
 async function pullCoreThemes() {
 	console.log("Pulling CORE themes from sandbox.");
 	for (let theme of coreThemes) {