-
Notifications
You must be signed in to change notification settings - Fork 102
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
[Themes] Feat: Poll for JSON changes when the themeEditorSync
flag is passed to the dev
command
#3894
Conversation
Thanks for your contribution! Depending on what you are working on, you may want to request a review from a Shopify team:
|
Coverage report
Show files with reduced coverage 🔻
Test suite run success1650 tests passing in 766 suites. Report generated by 🧪jest coverage report action from 1a52026 |
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. |
e6599fd
to
86bfbbd
Compare
Differences in type declarationsWe 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:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/common/version.d.ts@@ -1 +1 @@
-export declare const CLI_KIT_VERSION = "3.60.0";
\ No newline at end of file
+export declare const CLI_KIT_VERSION = "3.59.0";
\ No newline at end of file
packages/cli-kit/dist/private/node/ui/components/TextPrompt.d.ts@@ -11,7 +11,6 @@ export interface TextPromptProps {
emptyDisplayedValue?: string;
abortSignal?: AbortSignal;
preview?: (value: string) => TokenItem<InlineToken>;
- initialAnswer?: string;
}
declare const TextPrompt: FunctionComponent<TextPromptProps>;
export { TextPrompt };
\ No newline at end of file
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR, @jamesmengo! 🚀 Please, let me know what you think about them :)
edc69e5
to
95407dd
Compare
packages/theme/src/cli/utilities/theme-environment/theme-polling.ts
Outdated
Show resolved
Hide resolved
f1ba15a
to
77d53ed
Compare
} | ||
|
||
await uploadTheme(theme, ctx.session, ctx.remoteChecksums, ctx.localThemeFileSystem, {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are handling theme upload here, I added a comment here to clarify that the remote-theme-watcher
does not upload files
expect(initializeThemeEditorSync).toHaveBeenCalled() | ||
expect(uploadTheme).not.toHaveBeenCalled() | ||
expect(reconcileAndPollThemeEditorChanges).toHaveBeenCalled() | ||
expect(uploadTheme).toHaveBeenCalled() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handling upload in theme-environment now :)
packages/theme/src/cli/utilities/theme-environment/remote-theme-watcher.ts
Outdated
Show resolved
Hide resolved
themeEditorSync
flag is passed to the dev
command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @jamesmengo! Really expressive code! I've left some minor comments; please let me know what you think about them :)
packages/theme/src/cli/utilities/theme-environment/remote-theme-watcher.ts
Outdated
Show resolved
Hide resolved
packages/theme/src/cli/utilities/theme-environment/remote-theme-watcher.test.ts
Outdated
Show resolved
Hide resolved
packages/theme/src/cli/utilities/theme-environment/remote-theme-watcher.ts
Outdated
Show resolved
Hide resolved
e37611e
to
f57c353
Compare
Initiate polling for theme editor changes Update local theme file system after reconciling files Modify theme polling reconciliation strategy Fix: Exit process when local and remote values are both changed Move Theme Upload to Theme-Environment instead of AssetFileSyncer Refactor - file reconciliation strategy to accept callbacks Add user-facing message when initiating asset synchronization and polling Handle AbortError properly when multiple source changes are detected Extract Theme Polling logic to separate file Extract Theme Reconciliation logic to its own file Render warning to users when there is a non-fatal error when polling remote changes Throw all errors when polling remote changes instead of retrying on non-fatal errors Refactor theme reconciliation to handle only JSON files Refactor theme polling to handle only JSON files Rename asset-file-syncer to remote-theme-watcher Remove call to fetchChecksums by updating remote checksums locally Move theme-environment.ts under the theme-environment folder Convert to JSDOC Revert "Remove call to fetchChecksums by updating remote checksums locally" This reverts commit fc5a1fa. Rename test describe block Create new themeFileSystem object for theme polling Render polling error to UI
f57c353
to
1a52026
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @jamesmengo!
WHY are these changes introduced?
WHAT is this pull request doing?
How to test your changes?
pnpm shopify theme dev --path=<PATH_TO_THEME> --dev-preview --theme-editor-sync
Remote Changes -> should automatically propagate locally
deleting a file in your editor -> should delete locally
modifying a file in your editor -> should update local theme
creating a file in your editor -> should download locally
Local Changes (No-op)
delete/modify/create a file in your local theme -> do nothing (this will be handled by FS Watcher)
Remote + local Changes
delete/modify/create a file in your local theme that is also changed on remote -> Abort the entire process
Code.-.cli.packages_theme_src_cli_utilities_asset-file-syncer.ts.cli.Workspace.mp4
Measuring impact
How do we know this change was effective? Please choose one:
Checklist
dev
ordeploy
have been reflected in the internal flowchart.