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

[Feature]: Integration flag for theme push #3734

Open
knjshimi opened this issue Apr 17, 2024 · 2 comments
Open

[Feature]: Integration flag for theme push #3734

knjshimi opened this issue Apr 17, 2024 · 2 comments
Labels
Area: @shopify/theme @shopify/theme package issues Type: Enhancement New feature or request

Comments

@knjshimi
Copy link

What area(s) will this request affect?

Theme

What type of change do you want to see?

New feature

Overview

Introduce a flag for integration mode for theme push.

Example: shopify theme push --ci

The output would consist only of a json string that includes the theme, errors and warnings.

Idea of the output:

{
  "theme": {},
  "errors": {
    "Failed to upload file templates/collection.json": [
      "Section type 'main-list-collections' does not refer to an existing section file",
      "Other error related to templates/collection.json"
    ]
  },
  "warnings": [
    "The pattern 'templates/*.json' does not include subdirectories. To maintain backwards compatibility, we have modified your pattern to 'templates/**/*.json' to explicitly include subdirectories."
  ]
}

Motivation

Be able to use Shopify CLI as part of a custom CLI wrapper. The Shopify team is constantly changing the output of its commands, like text formatting, usage of stderr and stdout, adding/removing graphics, etc.

I need a simple and consistent way of knowing the actual results, without having to manipulate strings to extract the information.

Previously, shopify theme push --json would suffice, but recent changes have made it very difficult to deal with.

Now stderr is returning "main errors", while stdout is returning "error detail items" along with the actual json string of the theme result, and a bunch of other graphical elements (that are irrelevant for my integration purposes).

It's becoming very hard to combine the stderr with stdout to get the actual error items per main error (which normally represents a file).

@knjshimi knjshimi added the Type: Enhancement New feature or request label Apr 17, 2024
@notkurt
Copy link

notkurt commented Apr 17, 2024

Seconding this.

It feels as if this year there have been a number of breaking changes when it comes to using the CLI within a CI environment. Typically we'd just keep our CI pipelines pinned at a known good version of the CLI, however there does not seem to be one. More specially it seems as if SHOPIFY_CLI_TTY=0 isn't being fully respected in the latest versions of the CLI.

Some other thoughts here is that the --ci flag should have a bit more consideration around breaking changes, accompanied by a suite of tests reflective of the CLI being used within a CI environment.

@Jay-Plumb
Copy link

Jay-Plumb commented May 1, 2024

I would also like to see the above change and also see any info wrapped within the json entry also. Right now on version 3.59.2 running shopify theme list --environment='eu_development' --theme="name" --json will output

╭─ info ──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                 │
│  Using applicable flags from dev_flg environment:                                                        │
│                                                                                                                 │
│    • store: store.myshopify.com                                                                              │
│                                                                                                                 │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭─ error ─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                 │
│  The store.myshopify.com store doesn't have a theme with the "name" ID or name                          │
│                                                                                                                 │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

so a structure that always returns JSON would be ideal when passing in --json flag

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

4 participants