Skip to content

Provide solution for two-way sync #161

Description

@jeffreyguenther

Notes

Related to #142.

Important

This proposal is a work in progress and will be updated.

There are number of scenarios where treating the admin as the source of truth is not desired. The purpose of the CLI is to "do the right thing" ™️ and always treating the Shopify servers as the source of truth is not right. In practice, the workflow is more nuanced than that.

Developer create a new JSON template for a page locally and need to push it live.

Store your new template in the bucket.

shopkeeper bucket save --bucket <bucket name>

In your preview workflow run:

shopkeeper bucket restore --bucket <bucket name>
shopkeeper theme deploy

In your blue/green deploy workflow:

shopkeeper theme deploy --nodelete

App creates or modifies the theme.

I would pull down the files created by apps. To detect these files, I would probably do a hack with .gitignore. I would list all the files in assets after build in the .gitignore temporarily and use that to detect new files. I think something like this would be the lightest touch way of detecting files not from the repo originally. OR maybe the .shopifyignore.

Locales

@nboliver-ventureweb wrote:

I think the main challenge with the locale files is that we kind of need a way to handle them both ways:

Developer builds a new feature, adds strings to locale file(s), pushes to GitHub, creates a PR, merges PR, triggers deployment (changes are pushed from GitHub to theme).

Merchant / app / developer needs to make changes to locales file from Shopify admin, or perhaps needs different strings per store that share the same theme (maybe more of an edge use-case). Checkout text string changes are generated from Shopify admin, and pulling changes down from Shopify admin is needed for that.

Because of the single file uses, we need a clear merge strategy.

  1. Download locales from production
  2. Save in temporary bucket
  3. Restore locales from bucket (so you have locales in theme)
  4. Merge live locales "over" bucket locales.

Using https://github.com/TehShrike/deepmerge which is included in @shopify/cli-kit, we can do a UNION merge. We would include all keys from both files. Any key that is present in the local file that is also present in the remote file will be updated to the remote file's value.

This would preserve keys specific to the Shopify Admin. They would always be updated with the latest values. Developer added keys would be preserved. Pre-existing keys would preserved.

To delete keys in the locale file, special work would need to be done I think. Need to explore more.

In terms of letting repos opt into locale tracking in the bucket, I think this is straightforward. We'll only restore the locales that exist it the bucket, if they exist. And we'll require locales to be stored with their own command. It can be done.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions