-
Notifications
You must be signed in to change notification settings - Fork 251
Upload settings_schema.json before validator-consumer assets #7481
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@shopify/theme': patch | ||
| --- | ||
|
|
||
| Upload `config/settings_schema.json` before any other theme file. Fixes `theme push` failing on the first push when blocks or sections reference a `color_palette` theme setting. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -213,7 +213,8 @@ function orderFilesToBeDeleted(files: Checksum[]): Checksum[] { | |
| ...fileSets.blockLiquidFiles, | ||
| ...fileSets.layoutFiles, | ||
| ...fileSets.otherLiquidFiles, | ||
| ...fileSets.configFiles, | ||
| ...fileSets.configDataFile, | ||
| ...fileSets.configSchemaFile, | ||
| ...fileSets.staticAssetFiles, | ||
| ] | ||
| } | ||
|
|
@@ -311,13 +312,23 @@ function selectUploadableFiles(themeFileSystem: ThemeFileSystem, remoteChecksums | |
| * We use this 2d array to batch files of the same type together | ||
| * while maintaining the order between file types. The files with | ||
| * dependencies we have are: | ||
| * 1. Layout files don't necessarily need to be the first, but they must uploaded before templates. | ||
| * 2. Liquid blocks need to be uploaded before sections | ||
| * 3. Liquid sections need to be uploaded afterwards | ||
| * 4. JSON sections need to be uploaded after sections | ||
| * 5. JSON templates need to be uploaded after all sections and layouts | ||
| * 6. Contextualized templates should be uploaded after as they are variations of templates | ||
| * 7. Config files must be the last ones, but we need to upload config/settings_schema.json first, followed by config/settings_data.json | ||
| * | ||
| * 1. config/settings_schema.json must be uploaded FIRST. It declares the | ||
| * theme-level settings that block / section / section-group / template | ||
| * validators resolve dynamic-source defaults against (e.g. defaults of | ||
| * the form `{{ settings.<theme_setting>.<property> }}`). | ||
| * 2. Layout files don't necessarily need to be the first, but they must be | ||
| * uploaded before templates. | ||
| * 3. Liquid blocks need to be uploaded before sections | ||
| * 4. Liquid sections need to be uploaded afterwards | ||
| * 5. JSON sections need to be uploaded after sections | ||
| * 6. JSON templates need to be uploaded after all sections and layouts | ||
| * 7. Contextualized templates should be uploaded after as they are | ||
| * variations of templates | ||
| * 8. config/settings_data.json must be uploaded LAST. Its current and | ||
| * presets are validated against the freshly-uploaded | ||
| * settings_schema.json, and presets can reference sections and | ||
| * templates uploaded in earlier steps. | ||
| * | ||
| * The files with no dependencies we have are: | ||
| * - The other Liquid files (for example, snippets, and liquid templates) | ||
|
|
@@ -336,13 +347,14 @@ function orderFilesToBeUploaded(files: ChecksumWithSize[]): { | |
| independentFiles: [fileSets.otherLiquidFiles, fileSets.otherJsonFiles, fileSets.staticAssetFiles], | ||
| // Follow order of dependencies: | ||
| dependentFiles: [ | ||
| fileSets.configSchemaFile, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If schema upload fails, would you want later dependent uploads to proceed? Current batch upload doesn't throw when bulk upload fails.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a great point, but I don't want to tackle that in this PR because its a larger change to the failure mode of |
||
| fileSets.layoutFiles, | ||
| fileSets.blockLiquidFiles, | ||
| fileSets.sectionLiquidFiles, | ||
| fileSets.sectionJsonFiles, | ||
| fileSets.templateJsonFiles, | ||
| fileSets.contextualizedJsonFiles, | ||
| fileSets.configFiles, | ||
| fileSets.configDataFile, | ||
| ], | ||
| } | ||
| } | ||
|
|
||
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.
Does this ordering matter at runtime for deletion as well? Currently it looks like deletion happens in async batches where the ordering might not be guaranteed.
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.
Effectively it doesn't. My understanding is that mirrors the upload just for consistency, but not an actual contract. So I'll update my inline comment about "config file consideration" just to not make it seem important
But as to whether it actually matters: the utility of deleting is getting the remote theme in sync with local dev. Doesn't matter where
settings_schemais because there's no use-case for ever deleting that file and keeping a functioning theme.