Skip to content

Allow theme pull command to be called with multiple environments - #6390

Merged
dejmedus merged 1 commit into
mainfrom
jb-multi-env-pull
Sep 23, 2025
Merged

dejmedus merged 1 commit into
mainfrom
jb-multi-env-pull

Conversation

@dejmedus

@dejmedus dejmedus commented Sep 12, 2025 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Previously theme pull could only be run with a single --environment flag. This PR allows pull to be run with multiple environments in a single command

WHAT is this pull request doing?

  • Removes flag parsing from pull commands in favour of ThemeCommand's run logic
  • During multi env commands, the Ink progress bar is not displayed
  • Since pull is exported publicly through @shopify/cli to be used by packages like shopkeeper, an auth session is created if one is not passed in from ThemeCommand (as one wouldn't be when pull is used programatically)
pull
pull-demo.mov

How to test your changes?

  • Pull down the branch gh pr checkout 6390 or install the snapit version
npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/[email protected]
  • Add a shopify.theme.toml file
Example toml
[environments.store1]
theme = "<theme>"
store = "<store>"
password  = "<shptka_password>"
path = "path/to/theme"

[environments.store2]
theme = "<theme>"
store = "<store>"
password  = "<shptka_password>"
path = "path/to/theme"
shopify theme pull -e store1 -e store2
  • pull should work as expected with no, single, and multiple --environment flags
  • The environment name should be displayed on output

Measuring impact

  • Existing analytics will cater for this addition

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@github-actions

github-actions Bot commented Sep 12, 2025 •

Copy link
Copy Markdown
Contributor

Coverage report

St.❔
Category Percentage Covered / Total
🟡 Statements
78.71% (+0.01% 🔼)
13639/17329
🟡 Branches
72.67% (+0% 🔼)
6649/9150
🟡 Functions
78.82% (+0% 🔼)
3524/4471
🟡 Lines
79.04% (+0.01% 🔼)
12888/16306
Show files with reduced coverage 🔻
St.❔
File Statements Branches Functions Lines
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
92% (-4% 🔻)
100%
98.33% (-1.67% 🔻)
🟢
... / theme-downloader.ts
97.3%
75% (-12.5% 🔻)
100% 100%

Test suite run success

3324 tests passing in 1384 suites.

Report generated by 🧪jest coverage report action from f8df96b

@dejmedus

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

Copy link
Copy Markdown
Contributor

🫰✨ Thanks @dejmedus! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/[email protected]

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

const downloadTasks = buildDownloadTasks(remoteChecksums, theme, themeFileSystem, session)

const tasks = [...deleteTasks, ...downloadTasks]
const tasks = [...deleteTasks, ...downloadTasks, {title: `Theme download complete`, task: async () => {}}]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since multi env progress messages don't disappear I've added a completion message so super quick pulls don't go from 0% progress to displaying results without a message in between

@dejmedus
dejmedus marked this pull request as ready for review September 12, 2025 17:41
@dejmedus
dejmedus requested review from a team as code owners September 12, 2025 17:41
@dejmedus
dejmedus force-pushed the jb-multi-env-push-share branch from e986528 to d44bc9e Compare September 12, 2025 18:42

@EvilGenius13 EvilGenius13 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.

🎩 went well, I tried multiple configurations, passing arguments directly into the command and using the toml file for others. The output is really nice. It's easy to see what is happening to each environment.

@dejmedus
dejmedus force-pushed the jb-multi-env-push-share branch from d44bc9e to 2fbc81e Compare September 18, 2025 21:01
@dejmedus
dejmedus force-pushed the jb-multi-env-pull branch 2 times, most recently from b0478c7 to 27dbca2 Compare September 18, 2025 23:22
@github-actions

Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/ui.d.ts
@@ -322,6 +322,7 @@ interface RenderTableOptions<T extends ScalarDict> extends TableProps<T> {
 export declare function renderTable<T extends ScalarDict>({ renderOptions, ...props }: RenderTableOptions<T>): string | undefined;
 interface RenderTasksOptions {
     renderOptions?: RenderOptions;
+    noProgressBar?: boolean;
 }
 /**
  * Runs async tasks and displays their progress to the console.
@@ -329,7 +330,7 @@ interface RenderTasksOptions {
  * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  * Installing dependencies ...
  */
-export declare function renderTasks<TContext>(tasks: Task<TContext>[], { renderOptions }?: RenderTasksOptions): Promise<TContext>;
+export declare function renderTasks<TContext>(tasks: Task<TContext>[], { renderOptions, noProgressBar }?: RenderTasksOptions): Promise<TContext>;
 /**
  * Awaits a single promise and displays a loading bar while it's in progress. The promise's result is returned.
  * @param options - Configuration object
packages/cli-kit/dist/private/node/ui/components/LoadingBar.d.ts
@@ -2,6 +2,7 @@ import React from 'react';
 interface LoadingBarProps {
     title: string;
     noColor?: boolean;
+    noProgressBar?: boolean;
 }
-declare const LoadingBar: ({ title, noColor }: React.PropsWithChildren<LoadingBarProps>) => JSX.Element;
+declare const LoadingBar: ({ title, noColor, noProgressBar }: React.PropsWithChildren<LoadingBarProps>) => JSX.Element;
 export { LoadingBar };
\ No newline at end of file
packages/cli-kit/dist/private/node/ui/components/Tasks.d.ts
@@ -14,6 +14,7 @@ interface TasksProps<TContext> {
     onComplete?: (ctx: TContext) => void;
     abortSignal?: AbortSignal;
     noColor?: boolean;
+    noProgressBar?: boolean;
 }
-declare function Tasks<TContext>({ tasks, silent, onComplete, abortSignal, noColor, }: React.PropsWithChildren<TasksProps<TContext>>): JSX.Element | null;
+declare function Tasks<TContext>({ tasks, silent, onComplete, abortSignal, noColor, noProgressBar, }: React.PropsWithChildren<TasksProps<TContext>>): JSX.Element | null;
 export { Tasks };
\ No newline at end of file

Base automatically changed from jb-multi-env-push-share to main September 23, 2025 14:57
Previously, `theme push` could only be run in a
single environment at a time. This commit allows
`push` to run in multiple environments in a single
command run. Output is prefixed with the environment
name, when one exists
@dejmedus
dejmedus added this pull request to the merge queue Sep 23, 2025
Merged via the queue into main with commit cd188b4 Sep 23, 2025
@dejmedus
dejmedus deleted the jb-multi-env-pull branch September 23, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants