Conversation
Coverage report
Test suite run success3731 tests passing in 1443 suites. Report generated by 🧪jest coverage report action from fedff6f |
2adb0f2 to
06454b5
Compare
06454b5 to
f131575
Compare
| devFlags.path = resolvedSource | ||
| } else { | ||
| recordEvent('theme-command:dev:override-session') | ||
| await createOverrideDevSession(resolvedSource, devFlags, adminSession) |
There was a problem hiding this comment.
Using this same pattern here to "create" a dev session even if we don't have a long running process yet. This will make it trivial to add hot reloading.
This comment has been minimized.
This comment has been minimized.
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/private/node/session.d.ts@@ -31,7 +31,7 @@ interface AppManagementAPIOauthOptions {
/**
* A scope supported by the Storefront Renderer API.
*/
-export type StorefrontRendererScope = 'devtools';
+export type StorefrontRendererScope = 'devtools' | 'graphql';
interface StorefrontRendererAPIOAuthOptions {
/** List of scopes to request permissions for. */
scopes: StorefrontRendererScope[];
|
karreiro
left a comment
There was a problem hiding this comment.
Thank you for this PR, @dengjeffrey!
This feature is going to be really useful for developers — it feels like something they could use as a building block to create interesting things on top of.
I've left some comments. Once we tophat this, I'll revisit the review, try things end-to-end, and approve.
Thanks again!
| } | ||
|
|
||
| const fileContent = await readFile(options.overrideJson) | ||
| const overrides = JSON.parse(fileContent) as ThemeOverrides |
There was a problem hiding this comment.
May we handle JSON parser errors here?
| description: | ||
| 'The source for the dev server. Can be a directory or a JSON overrides file. When a directory is provided, it is used as the theme directory. When a JSON file is provided, overrides are applied to the theme specified by --theme.', | ||
| env: 'SHOPIFY_FLAG_SOURCE', | ||
| }), |
There was a problem hiding this comment.
While reviewing the flags for this command, I noticed we already have --path, so there are two options:
- When
--sourceis empty, document that the command uses the file system as the source and relies on--path. - Remove
--sourcein favor of--path, allowing you to pass either a--pathor an override file as a parameter.
I think option 2 is the cleaner approach. What do you think?
| 'preview-id': Flags.string({ | ||
| description: | ||
| 'An existing preview identifier to update instead of creating a new preview. Used with --source when pointing to a JSON overrides file.', | ||
| env: 'SHOPIFY_FLAG_PREVIEW_ID', | ||
| }), |
There was a problem hiding this comment.
When reading this as a user, I immediately wondered how I would get a --preview-id. I think we could mention that --preview-id is an optional field that you may get from previous preview runs.
| /** | ||
| * A scope supported by the Storefront Renderer API. | ||
| */ | ||
| export type StorefrontRendererScope = 'devtools' |
There was a problem hiding this comment.
Deferring review of this line to the @Shopify/app-inner-loop team, as they implemented the storefront renderer scopes and have more context on this area.
| overridesContent, | ||
| }: CreateThemePreviewOptions): Promise<ThemePreviewResult> { | ||
| recordTiming('theme-preview:create') | ||
| const baseUrl = buildBaseStorefrontUrl(session) |
There was a problem hiding this comment.
Did you have a chance to tophat this using the Theme Access app?
I wonder if changes will be required there to support the new API call. I think it should work out of the box, but worth double-checking (specially from scopes perspective).
WHY are these changes introduced?
Resolves https://github.com/shop/issues-growth-activation/issues/1902
WHAT is this pull request doing?
theme devto support temporarily overriding a theme via JSON and being able to preview itMore internal context: https://docs.google.com/document/d/13sa0iRs_DSgyPHbx9IIF64rvhh_KZCDLfJgwpSIxP4A/edit?usp=sharing
--sourceallows for either a theme directory or a JSON. We will document the JSON schema on shopify.dev--preview-idspecifies an existing preview session to be updated with the JSON value in sourceHow to test your changes?
Requires https://app.graphite.com/github/pr/shop/world/448726/Add-ThemePreviewController-to-support-Shopify-CLI-theme-previews
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist