From bb59a5f1840ed7d5747a2d6cea970780d1c139b9 Mon Sep 17 00:00:00 2001 From: Jason Crist Date: Wed, 20 Dec 2023 18:36:32 -0500 Subject: [PATCH] Added a utility to pull changes to all themes from sandbox --- package.json | 1 + theme-utils.mjs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/package.json b/package.json index ff0c08512f..8bd3d1797f 100644 --- a/package.json +++ b/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", diff --git a/theme-utils.mjs b/theme-utils.mjs index 9a91a53553..cd7a816563 100644 --- a/theme-utils.mjs +++ b/theme-utils.mjs @@ -75,6 +75,10 @@ const commands = { additionalArgs: '', 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 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) {