Skip to content
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

Shopify theme list command to find exact match by theme name #4119

Open
Jay-Plumb opened this issue Jun 24, 2024 · 3 comments
Open

Shopify theme list command to find exact match by theme name #4119

Jay-Plumb opened this issue Jun 24, 2024 · 3 comments
Labels
Area: @shopify/theme @shopify/theme package issues Type: Enhancement New feature or request

Comments

@Jay-Plumb
Copy link

Jay-Plumb commented Jun 24, 2024

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 Jay-Plumb added the Type: Enhancement New feature or request label Jun 24, 2024
@isaacroldan isaacroldan added the Area: @shopify/theme @shopify/theme package issues label Jul 2, 2024
@jamesmengo
Copy link
Contributor

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?

@Jay-Plumb
Copy link
Author

Jay-Plumb commented Jul 5, 2024

@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.

@jamesmengo
Copy link
Contributor

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: @shopify/theme @shopify/theme package issues Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants