Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading