cli icon indicating copy to clipboard operation
cli copied to clipboard

Shopify theme list command to find exact match by theme name

Open Jay-Plumb opened this issue 1 year ago • 4 comments

What area(s) will this request affect?

Theme

What type of change do you want to see?

New feature

Overview

Example shopify theme list --environment='development_eu' --name="dev" --json currently outputs:

[
  {
    "id": 138723655843,
    "name": "dev",
    "processing": false,
    "createdAtRuntime": false,
    "role": "unpublished"
  },
  {
    "id": 138723885219,
    "name": "dev",
    "processing": false,
    "createdAtRuntime": false,
    "role": "unpublished"
  },
  {
    "id": 138629152931,
    "name": "Development (a0ffa7-MacBook-Pro-2)",
    "processing": false,
    "createdAtRuntime": false,
    "role": "development"
  },
  {
    "id": 138680959139,
    "name": "Development (229622-Andrews-MacBook-Pro)",
    "processing": false,
    "createdAtRuntime": false,
    "role": "development"
  }
]

It would be nice to have a flag that looks for an exact match such that the output returns

[
    {
    "id": 138723655843,
    "name": "dev",
    "processing": false,
    "createdAtRuntime": false,
    "role": "unpublished"
  },
  {
    "id": 138723885219,
    "name": "dev",
    "processing": false,
    "createdAtRuntime": false,
    "role": "unpublished"
  },
]

Motivation

The above impacts our CI/CD pipeline to view preview links from main against dev due to the multiple matches from the list command above.

Jay-Plumb avatar Jun 24 '24 02:06 Jay-Plumb

Hey @Jay-Plumb

Could you clarify what you have in mind to determine whether to return 138723885219 or 138723655843 in the example you provided?

Would specifying the theme ID via the --theme flag, or using a unique name work for your use case?

jamesmengo avatar Jul 04 '24 23:07 jamesmengo

@jamesmengo In the above example there are two themes with the name "dev" so actually i would expect both ids you mentioned to be returned.

The issue is that --name="dev" returns themes with name dev and development so i'm looking for a flag that searches for an exact match for the theme name.

I have edited the example above as I can see it was confusing.

Would specifying the theme ID via the --theme flag, or using a unique name work for your use case?

Passing in an id would not be possible because I dynamically generate preview themes on the fly so I need a way to check whether I should create or update a preview theme. If a theme name matches I then use the theme id to then update the theme.

Jay-Plumb avatar Jul 05 '24 01:07 Jay-Plumb

Thanks for the suggestion! I'll share this with the team to see if this is something we have the bandwidth to build

Not sure about the specifics of your workflow, but an idea I have for the meantime is to avoid conflicts with your development theme by using a different namespace such as preview

I understand that the workaround is imperfect. Feel free to share more about your workflow as well if you'd like us to see if there are any other workarounds or existing features that could address your problem :)

jamesmengo avatar Jul 05 '24 17:07 jamesmengo

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Aug 17 '24 03:08 github-actions[bot]