Skip to content

Commit

Permalink
Added a utility to pull changes to all themes from sandbox (#7573)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbking authored Jan 9, 2024
1 parent ebd9184 commit 583a399
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 19 additions & 0 deletions theme-utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 583a399

Please sign in to comment.