shopify-cli 2.25.0 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/dev.yml +0 -3
- data/lib/project_types/extension/models/specification_handlers/default.rb +6 -1
- data/lib/project_types/script/cli.rb +0 -79
- data/lib/project_types/script/commands/connect.rb +3 -8
- data/lib/project_types/script/commands/create.rb +4 -29
- data/lib/project_types/script/commands/javy.rb +3 -8
- data/lib/project_types/script/commands/push.rb +4 -41
- data/lib/project_types/script/messages/messages.rb +1 -258
- data/lib/project_types/theme/commands/common/shop_helper.rb +13 -0
- data/lib/project_types/theme/commands/delete.rb +4 -1
- data/lib/project_types/theme/commands/list.rb +3 -4
- data/lib/project_types/theme/commands/open.rb +4 -1
- data/lib/project_types/theme/commands/publish.rb +4 -1
- data/lib/project_types/theme/commands/pull.rb +3 -1
- data/lib/project_types/theme/commands/push.rb +3 -1
- data/lib/project_types/theme/commands/serve.rb +2 -1
- data/lib/project_types/theme/messages/messages.rb +5 -5
- data/lib/shopify_cli/messages/messages.rb +1 -1
- data/lib/shopify_cli/packager.rb +12 -3
- data/lib/shopify_cli/release.rb +4 -2
- data/lib/shopify_cli/version.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +1 -1
- metadata +3 -48
- data/lib/project_types/script/config/extension_points.yml +0 -45
- data/lib/project_types/script/errors.rb +0 -10
- data/lib/project_types/script/forms/ask_app.rb +0 -27
- data/lib/project_types/script/forms/ask_org.rb +0 -30
- data/lib/project_types/script/forms/ask_script_uuid.rb +0 -22
- data/lib/project_types/script/forms/create.rb +0 -33
- data/lib/project_types/script/forms/run_against_shopify_org.rb +0 -14
- data/lib/project_types/script/graphql/app_script_set.graphql +0 -46
- data/lib/project_types/script/graphql/get_app_scripts.graphql +0 -6
- data/lib/project_types/script/graphql/module_upload_url_generate.graphql +0 -13
- data/lib/project_types/script/graphql/script_service_proxy.graphql +0 -7
- data/lib/project_types/script/layers/application/build_script.rb +0 -25
- data/lib/project_types/script/layers/application/connect_app.rb +0 -86
- data/lib/project_types/script/layers/application/create_script.rb +0 -90
- data/lib/project_types/script/layers/application/extension_points.rb +0 -66
- data/lib/project_types/script/layers/application/project_dependencies.rb +0 -26
- data/lib/project_types/script/layers/application/push_script.rb +0 -74
- data/lib/project_types/script/layers/domain/app_bridge.rb +0 -16
- data/lib/project_types/script/layers/domain/errors.rb +0 -47
- data/lib/project_types/script/layers/domain/extension_point.rb +0 -81
- data/lib/project_types/script/layers/domain/metadata.rb +0 -46
- data/lib/project_types/script/layers/domain/push_package.rb +0 -41
- data/lib/project_types/script/layers/domain/script_config.rb +0 -32
- data/lib/project_types/script/layers/domain/script_project.rb +0 -61
- data/lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb +0 -53
- data/lib/project_types/script/layers/infrastructure/api_clients/script_service_api_client.rb +0 -35
- data/lib/project_types/script/layers/infrastructure/command_runner.rb +0 -19
- data/lib/project_types/script/layers/infrastructure/errors.rb +0 -211
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +0 -37
- data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +0 -62
- data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +0 -47
- data/lib/project_types/script/layers/infrastructure/languages/tool_version_checker.rb +0 -26
- data/lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb +0 -45
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +0 -103
- data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +0 -12
- data/lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb +0 -32
- data/lib/project_types/script/layers/infrastructure/metadata_repository.rb +0 -18
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +0 -36
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +0 -273
- data/lib/project_types/script/layers/infrastructure/script_service.rb +0 -135
- data/lib/project_types/script/layers/infrastructure/script_uploader.rb +0 -40
- data/lib/project_types/script/layers/infrastructure/service_locator.rb +0 -20
- data/lib/project_types/script/layers/infrastructure/sparse_checkout_details.rb +0 -35
- data/lib/project_types/script/ui/error_handler.rb +0 -331
- data/lib/project_types/script/ui/printing_spinner.rb +0 -75
- data/lib/project_types/script/ui/strict_spinner.rb +0 -20
| @@ -1,9 +1,12 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 | 
             
            require "shopify_cli/theme/theme"
         | 
| 3 | 
            +
            require "project_types/theme/commands/common/shop_helper"
         | 
| 3 4 |  | 
| 4 5 | 
             
            module Theme
         | 
| 5 6 | 
             
              class Command
         | 
| 6 7 | 
             
                class Publish < ShopifyCLI::Command::SubCommand
         | 
| 8 | 
            +
                  include Common::ShopHelper
         | 
| 9 | 
            +
             | 
| 7 10 | 
             
                  recommend_default_ruby_range
         | 
| 8 11 |  | 
| 9 12 | 
             
                  options do |parser, flags|
         | 
| @@ -17,7 +20,7 @@ module Theme | |
| 17 20 | 
             
                      form = Forms::Select.ask(
         | 
| 18 21 | 
             
                        @ctx,
         | 
| 19 22 | 
             
                        [],
         | 
| 20 | 
            -
                        title: @ctx.message("theme.publish.select"),
         | 
| 23 | 
            +
                        title: @ctx.message("theme.publish.select", shop),
         | 
| 21 24 | 
             
                        exclude_roles: ["live", "development", "demo"],
         | 
| 22 25 | 
             
                        cmd: :publish
         | 
| 23 26 | 
             
                      )
         | 
| @@ -5,12 +5,14 @@ require "shopify_cli/theme/ignore_filter" | |
| 5 5 | 
             
            require "shopify_cli/theme/include_filter"
         | 
| 6 6 | 
             
            require "shopify_cli/theme/syncer"
         | 
| 7 7 | 
             
            require "project_types/theme/commands/common/root_helper"
         | 
| 8 | 
            +
            require "project_types/theme/commands/common/shop_helper"
         | 
| 8 9 | 
             
            require "project_types/theme/conversions/include_glob"
         | 
| 9 10 | 
             
            require "project_types/theme/conversions/ignore_glob"
         | 
| 10 11 |  | 
| 11 12 | 
             
            module Theme
         | 
| 12 13 | 
             
              class Command
         | 
| 13 14 | 
             
                class Pull < ShopifyCLI::Command::SubCommand
         | 
| 15 | 
            +
                  include Common::ShopHelper
         | 
| 14 16 | 
             
                  include Common::RootHelper
         | 
| 15 17 |  | 
| 16 18 | 
             
                  recommend_default_ruby_range
         | 
| @@ -97,7 +99,7 @@ module Theme | |
| 97 99 | 
             
                    form = Forms::Select.ask(
         | 
| 98 100 | 
             
                      @ctx,
         | 
| 99 101 | 
             
                      [],
         | 
| 100 | 
            -
                      title: @ctx.message("theme.pull.select"),
         | 
| 102 | 
            +
                      title: @ctx.message("theme.pull.select", shop),
         | 
| 101 103 | 
             
                      root: root,
         | 
| 102 104 | 
             
                    )
         | 
| 103 105 | 
             
                    form&.theme
         | 
| @@ -5,12 +5,14 @@ require "shopify_cli/theme/ignore_filter" | |
| 5 5 | 
             
            require "shopify_cli/theme/include_filter"
         | 
| 6 6 | 
             
            require "shopify_cli/theme/syncer"
         | 
| 7 7 | 
             
            require "project_types/theme/commands/common/root_helper"
         | 
| 8 | 
            +
            require "project_types/theme/commands/common/shop_helper"
         | 
| 8 9 | 
             
            require "project_types/theme/conversions/include_glob"
         | 
| 9 10 | 
             
            require "project_types/theme/conversions/ignore_glob"
         | 
| 10 11 |  | 
| 11 12 | 
             
            module Theme
         | 
| 12 13 | 
             
              class Command
         | 
| 13 14 | 
             
                class Push < ShopifyCLI::Command::SubCommand
         | 
| 15 | 
            +
                  include Common::ShopHelper
         | 
| 14 16 | 
             
                  include Common::RootHelper
         | 
| 15 17 |  | 
| 16 18 | 
             
                  recommend_default_ruby_range
         | 
| @@ -134,7 +136,7 @@ module Theme | |
| 134 136 | 
             
                    form = Forms::Select.ask(
         | 
| 135 137 | 
             
                      @ctx,
         | 
| 136 138 | 
             
                      [],
         | 
| 137 | 
            -
                      title: @ctx.message("theme.push.select"),
         | 
| 139 | 
            +
                      title: @ctx.message("theme.push.select", shop),
         | 
| 138 140 | 
             
                      root: root,
         | 
| 139 141 | 
             
                    )
         | 
| 140 142 | 
             
                    form&.theme
         | 
| @@ -77,7 +77,8 @@ module Theme | |
| 77 77 | 
             
                  end
         | 
| 78 78 |  | 
| 79 79 | 
             
                  def storefront_renderer_token
         | 
| 80 | 
            -
                    ShopifyCLI:: | 
| 80 | 
            +
                    ShopifyCLI::Environment.storefront_renderer_auth_token ||
         | 
| 81 | 
            +
                      ShopifyCLI::DB.get(:storefront_renderer_production_exchange_token)
         | 
| 81 82 | 
             
                  end
         | 
| 82 83 | 
             
                end
         | 
| 83 84 | 
             
              end
         | 
| @@ -47,7 +47,7 @@ module Theme | |
| 47 47 | 
             
                      not_found: "Theme #%s does not exist",
         | 
| 48 48 | 
             
                      no_themes_error: "You don't have any theme to be published.",
         | 
| 49 49 | 
             
                      no_themes_resolution: "Try to create an unpublished theme with {{command:theme push -u -t <theme_name>}}.",
         | 
| 50 | 
            -
                      select: "Select theme to push to",
         | 
| 50 | 
            +
                      select: "Select theme to push to %s",
         | 
| 51 51 | 
             
                      confirm: "Are you sure you want to make %s the new live theme on %s?",
         | 
| 52 52 | 
             
                    },
         | 
| 53 53 | 
             
                    forms: {
         | 
| @@ -87,7 +87,7 @@ module Theme | |
| 87 87 | 
             
                        pushing: "Pushing theme files to %s (#%s) on %s",
         | 
| 88 88 | 
             
                      },
         | 
| 89 89 | 
             
                      push: "Pushing theme files to Shopify",
         | 
| 90 | 
            -
                      select: "Select theme to push to",
         | 
| 90 | 
            +
                      select: "Select theme to push to %s",
         | 
| 91 91 | 
             
                      live: "Are you sure you want to push to your live theme?",
         | 
| 92 92 | 
             
                      theme: "\n  Theme: {{blue:%s #%s}} {{green:[live]}}",
         | 
| 93 93 | 
             
                      deprecated_themeid: <<~WARN,
         | 
| @@ -285,7 +285,7 @@ module Theme | |
| 285 285 |  | 
| 286 286 | 
             
                        Run without options to select the theme to delete from a list.
         | 
| 287 287 | 
             
                      HELP
         | 
| 288 | 
            -
                      select: "Select theme to delete",
         | 
| 288 | 
            +
                      select: "Select theme to delete from %s",
         | 
| 289 289 | 
             
                      done: "%s theme(s) deleted",
         | 
| 290 290 | 
             
                      no_themes_error: "You don't have any theme to be deleted.",
         | 
| 291 291 | 
             
                      no_themes_resolution: "Try to create an unpublished theme with {{command:theme push -u -t <theme_name>}}.",
         | 
| @@ -330,7 +330,7 @@ module Theme | |
| 330 330 |  | 
| 331 331 | 
             
                        Run without options to select theme from a list.
         | 
| 332 332 | 
             
                      HELP
         | 
| 333 | 
            -
                      select: "Select a theme to pull from",
         | 
| 333 | 
            +
                      select: "Select a theme to pull from %s",
         | 
| 334 334 | 
             
                      pulling: "Pulling theme files from %s (#%s) on %s",
         | 
| 335 335 | 
             
                      done: "Theme pulled successfully.",
         | 
| 336 336 | 
             
                      done_with_errors: "{{warning:Your theme was pulled with errors.}}",
         | 
| @@ -340,7 +340,7 @@ module Theme | |
| 340 340 | 
             
                      theme_not_found: "Theme \"%s\" doesn't exist",
         | 
| 341 341 | 
             
                    },
         | 
| 342 342 | 
             
                    open: {
         | 
| 343 | 
            -
                      select: "Select a theme to open",
         | 
| 343 | 
            +
                      select: "Select a theme to open in %s",
         | 
| 344 344 | 
             
                      theme_not_found: "Theme \"%s\" doesn't exist",
         | 
| 345 345 | 
             
                      details: <<~DETAILS,
         | 
| 346 346 | 
             
                        {{*}} {{bold:%s}}
         | 
| @@ -788,7 +788,7 @@ module ShopifyCLI | |
| 788 788 | 
             
                        {{*}} {{yellow:A new version of Shopify CLI is available! You have version %s and the latest version is %s.
         | 
| 789 789 |  | 
| 790 790 | 
             
                          To upgrade, follow the instructions for the package manager you’re using:
         | 
| 791 | 
            -
                          {{underline:https://shopify.dev/tools/cli/ | 
| 791 | 
            +
                          {{underline:https://shopify.dev/themes/tools/cli/upgrade-uninstall}}}}
         | 
| 792 792 |  | 
| 793 793 | 
             
                      MESSAGE
         | 
| 794 794 |  | 
    
        data/lib/shopify_cli/packager.rb
    CHANGED
    
    | @@ -70,9 +70,10 @@ module ShopifyCLI | |
| 70 70 | 
             
                  root_dir = File.join(PACKAGING_DIR, "homebrew")
         | 
| 71 71 |  | 
| 72 72 | 
             
                  build_path = File.join(BUILDS_DIR, "shopify-cli.rb")
         | 
| 73 | 
            -
                   | 
| 73 | 
            +
                  build_path_2 = File.join(BUILDS_DIR, "shopify-cli@2.rb")
         | 
| 74 | 
            +
                  puts "\nBuilding Homebrew packages"
         | 
| 74 75 |  | 
| 75 | 
            -
                  puts "Generating  | 
| 76 | 
            +
                  puts "Generating formulae…"
         | 
| 76 77 | 
             
                  File.delete(build_path) if File.exist?(build_path)
         | 
| 77 78 |  | 
| 78 79 | 
             
                  spec_contents = File.read(File.join(root_dir, "shopify-cli.base.rb"))
         | 
| @@ -89,7 +90,15 @@ module ShopifyCLI | |
| 89 90 | 
             
                  spec_contents = spec_contents.gsub("SHOPIFY_CLI_GEM_CHECKSUM", gem_checksum)
         | 
| 90 91 |  | 
| 91 92 | 
             
                  puts "Writing generated formula\n  To: #{build_path}\n\n"
         | 
| 92 | 
            -
                  File.write(build_path, spec_contents)
         | 
| 93 | 
            +
                  File.write(build_path, spec_contents.gsub("SHOPIFY_CLI_BINSTUB_SUFFIX", ""))
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                  puts "Writing generated formula\n  To: #{build_path_2}\n\n"
         | 
| 96 | 
            +
                  File.write(
         | 
| 97 | 
            +
                    build_path_2,
         | 
| 98 | 
            +
                    spec_contents
         | 
| 99 | 
            +
                      .sub("class ShopifyCli < Formula", "class ShopifyCliAT2 < Formula")
         | 
| 100 | 
            +
                      .sub("SHOPIFY_CLI_BINSTUB_SUFFIX", "2")
         | 
| 101 | 
            +
                  )
         | 
| 93 102 | 
             
                end
         | 
| 94 103 |  | 
| 95 104 | 
             
                private
         | 
    
        data/lib/shopify_cli/release.rb
    CHANGED
    
    | @@ -120,8 +120,10 @@ module ShopifyCLI | |
| 120 120 | 
             
                end
         | 
| 121 121 |  | 
| 122 122 | 
             
                def update_homebrew_repo
         | 
| 123 | 
            -
                   | 
| 124 | 
            -
             | 
| 123 | 
            +
                  %w(shopify-cli.rb shopify-cli@2.rb).each do |source_filename|
         | 
| 124 | 
            +
                    source_file = File.join(package_dir, source_filename)
         | 
| 125 | 
            +
                    FileUtils.copy(source_file, homebrew_path)
         | 
| 126 | 
            +
                  end
         | 
| 125 127 | 
             
                  Dir.chdir(homebrew_path) do
         | 
| 126 128 | 
             
                    system_or_fail("git commit -am '#{homebrew_update_message}'", "commit homebrew update")
         | 
| 127 129 | 
             
                    system_or_fail("git push -u origin #{homebrew_release_branch}", "push homebrew branch")
         | 
    
        data/lib/shopify_cli/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: shopify-cli
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.27.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Shopify
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-10-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -304,58 +304,13 @@ files: | |
| 304 304 | 
             
            - lib/project_types/script/commands/create.rb
         | 
| 305 305 | 
             
            - lib/project_types/script/commands/javy.rb
         | 
| 306 306 | 
             
            - lib/project_types/script/commands/push.rb
         | 
| 307 | 
            -
            - lib/project_types/script/config/extension_points.yml
         | 
| 308 | 
            -
            - lib/project_types/script/errors.rb
         | 
| 309 | 
            -
            - lib/project_types/script/forms/ask_app.rb
         | 
| 310 | 
            -
            - lib/project_types/script/forms/ask_org.rb
         | 
| 311 | 
            -
            - lib/project_types/script/forms/ask_script_uuid.rb
         | 
| 312 | 
            -
            - lib/project_types/script/forms/create.rb
         | 
| 313 | 
            -
            - lib/project_types/script/forms/run_against_shopify_org.rb
         | 
| 314 | 
            -
            - lib/project_types/script/graphql/app_script_set.graphql
         | 
| 315 | 
            -
            - lib/project_types/script/graphql/get_app_scripts.graphql
         | 
| 316 | 
            -
            - lib/project_types/script/graphql/module_upload_url_generate.graphql
         | 
| 317 | 
            -
            - lib/project_types/script/graphql/script_service_proxy.graphql
         | 
| 318 | 
            -
            - lib/project_types/script/layers/application/build_script.rb
         | 
| 319 | 
            -
            - lib/project_types/script/layers/application/connect_app.rb
         | 
| 320 | 
            -
            - lib/project_types/script/layers/application/create_script.rb
         | 
| 321 | 
            -
            - lib/project_types/script/layers/application/extension_points.rb
         | 
| 322 | 
            -
            - lib/project_types/script/layers/application/project_dependencies.rb
         | 
| 323 | 
            -
            - lib/project_types/script/layers/application/push_script.rb
         | 
| 324 | 
            -
            - lib/project_types/script/layers/domain/app_bridge.rb
         | 
| 325 | 
            -
            - lib/project_types/script/layers/domain/errors.rb
         | 
| 326 | 
            -
            - lib/project_types/script/layers/domain/extension_point.rb
         | 
| 327 | 
            -
            - lib/project_types/script/layers/domain/metadata.rb
         | 
| 328 | 
            -
            - lib/project_types/script/layers/domain/push_package.rb
         | 
| 329 | 
            -
            - lib/project_types/script/layers/domain/script_config.rb
         | 
| 330 | 
            -
            - lib/project_types/script/layers/domain/script_project.rb
         | 
| 331 | 
            -
            - lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb
         | 
| 332 | 
            -
            - lib/project_types/script/layers/infrastructure/api_clients/script_service_api_client.rb
         | 
| 333 | 
            -
            - lib/project_types/script/layers/infrastructure/command_runner.rb
         | 
| 334 | 
            -
            - lib/project_types/script/layers/infrastructure/errors.rb
         | 
| 335 | 
            -
            - lib/project_types/script/layers/infrastructure/extension_point_repository.rb
         | 
| 336 | 
            -
            - lib/project_types/script/layers/infrastructure/languages/project_creator.rb
         | 
| 337 | 
            -
            - lib/project_types/script/layers/infrastructure/languages/task_runner.rb
         | 
| 338 | 
            -
            - lib/project_types/script/layers/infrastructure/languages/tool_version_checker.rb
         | 
| 339 | 
            -
            - lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb
         | 
| 340 | 
            -
            - lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb
         | 
| 341 | 
            -
            - lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb
         | 
| 342 | 
            -
            - lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb
         | 
| 343 | 
            -
            - lib/project_types/script/layers/infrastructure/metadata_repository.rb
         | 
| 344 | 
            -
            - lib/project_types/script/layers/infrastructure/push_package_repository.rb
         | 
| 345 | 
            -
            - lib/project_types/script/layers/infrastructure/script_project_repository.rb
         | 
| 346 | 
            -
            - lib/project_types/script/layers/infrastructure/script_service.rb
         | 
| 347 | 
            -
            - lib/project_types/script/layers/infrastructure/script_uploader.rb
         | 
| 348 | 
            -
            - lib/project_types/script/layers/infrastructure/service_locator.rb
         | 
| 349 | 
            -
            - lib/project_types/script/layers/infrastructure/sparse_checkout_details.rb
         | 
| 350 307 | 
             
            - lib/project_types/script/loaders/project.rb
         | 
| 351 308 | 
             
            - lib/project_types/script/loaders/specification_handler.rb
         | 
| 352 309 | 
             
            - lib/project_types/script/messages/messages.rb
         | 
| 353 | 
            -
            - lib/project_types/script/ui/error_handler.rb
         | 
| 354 | 
            -
            - lib/project_types/script/ui/printing_spinner.rb
         | 
| 355 | 
            -
            - lib/project_types/script/ui/strict_spinner.rb
         | 
| 356 310 | 
             
            - lib/project_types/theme/cli.rb
         | 
| 357 311 | 
             
            - lib/project_types/theme/commands/check.rb
         | 
| 358 312 | 
             
            - lib/project_types/theme/commands/common/root_helper.rb
         | 
| 313 | 
            +
            - lib/project_types/theme/commands/common/shop_helper.rb
         | 
| 359 314 | 
             
            - lib/project_types/theme/commands/delete.rb
         | 
| 360 315 | 
             
            - lib/project_types/theme/commands/init.rb
         | 
| 361 316 | 
             
            - lib/project_types/theme/commands/language_server.rb
         | 
| @@ -1,45 +0,0 @@ | |
| 1 | 
            -
            payment_customization:
         | 
| 2 | 
            -
              beta: true
         | 
| 3 | 
            -
              domain: 'checkout'
         | 
| 4 | 
            -
              libraries:
         | 
| 5 | 
            -
                wasm:
         | 
| 6 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 7 | 
            -
                rust:
         | 
| 8 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 9 | 
            -
            shipping_methods:
         | 
| 10 | 
            -
              domain: 'checkout'
         | 
| 11 | 
            -
              libraries:
         | 
| 12 | 
            -
                wasm:
         | 
| 13 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 14 | 
            -
                rust:
         | 
| 15 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 16 | 
            -
            product_discounts:
         | 
| 17 | 
            -
              beta: true
         | 
| 18 | 
            -
              domain: 'discounts'
         | 
| 19 | 
            -
              libraries:
         | 
| 20 | 
            -
                wasm:
         | 
| 21 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 22 | 
            -
                rust:
         | 
| 23 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 24 | 
            -
            order_discounts:
         | 
| 25 | 
            -
              beta: true
         | 
| 26 | 
            -
              domain: 'discounts'
         | 
| 27 | 
            -
              libraries:
         | 
| 28 | 
            -
                wasm:
         | 
| 29 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 30 | 
            -
                rust:
         | 
| 31 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 32 | 
            -
            shipping_discounts:
         | 
| 33 | 
            -
              beta: true
         | 
| 34 | 
            -
              domain: 'discounts'
         | 
| 35 | 
            -
              libraries:
         | 
| 36 | 
            -
                wasm:
         | 
| 37 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 38 | 
            -
                rust:
         | 
| 39 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| 40 | 
            -
            shipping_rates_consolidation:
         | 
| 41 | 
            -
              beta: true
         | 
| 42 | 
            -
              domain: 'checkout'
         | 
| 43 | 
            -
              libraries:
         | 
| 44 | 
            -
                wasm:
         | 
| 45 | 
            -
                  repo: "https://github.com/Shopify/function-examples"
         | 
| @@ -1,27 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Script
         | 
| 4 | 
            -
              module Forms
         | 
| 5 | 
            -
                class AskApp < ShopifyCLI::Form
         | 
| 6 | 
            -
                  attr_reader :app
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  def ask
         | 
| 9 | 
            -
                    apps = @xargs.fetch(:apps)
         | 
| 10 | 
            -
                    raise Errors::NoExistingAppsError if apps.empty?
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                    @app =
         | 
| 13 | 
            -
                      if apps.count > 1
         | 
| 14 | 
            -
                        CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.app_select")) do |handler|
         | 
| 15 | 
            -
                          apps.each do |app|
         | 
| 16 | 
            -
                            handler.option(app["title"]) { app }
         | 
| 17 | 
            -
                          end
         | 
| 18 | 
            -
                        end
         | 
| 19 | 
            -
                      else
         | 
| 20 | 
            -
                        apps.first.tap do |app|
         | 
| 21 | 
            -
                          ctx.puts(ctx.message("script.application.ensure_env.app", app["title"]))
         | 
| 22 | 
            -
                        end
         | 
| 23 | 
            -
                      end
         | 
| 24 | 
            -
                  end
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
            end
         | 
| @@ -1,30 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Script
         | 
| 4 | 
            -
              module Forms
         | 
| 5 | 
            -
                class AskOrg < ShopifyCLI::Form
         | 
| 6 | 
            -
                  attr_reader :org
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  BUSINESS_NAME = "businessName"
         | 
| 9 | 
            -
                  ID = "id"
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                  def ask
         | 
| 12 | 
            -
                    orgs = @xargs
         | 
| 13 | 
            -
                    @org =
         | 
| 14 | 
            -
                      if orgs.count == 1
         | 
| 15 | 
            -
                        orgs.first.tap do |org|
         | 
| 16 | 
            -
                          ctx.puts(ctx.message("script.application.ensure_env.organization", org[BUSINESS_NAME], org[ID]))
         | 
| 17 | 
            -
                        end
         | 
| 18 | 
            -
                      elsif orgs.count > 0
         | 
| 19 | 
            -
                        CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.organization_select")) do |handler|
         | 
| 20 | 
            -
                          orgs.each do |org|
         | 
| 21 | 
            -
                            handler.option("#{org[BUSINESS_NAME]} (#{org[ID]})") { org }
         | 
| 22 | 
            -
                          end
         | 
| 23 | 
            -
                        end
         | 
| 24 | 
            -
                      else
         | 
| 25 | 
            -
                        raise Errors::NoExistingOrganizationsError
         | 
| 26 | 
            -
                      end
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
            end
         | 
| @@ -1,22 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Script
         | 
| 4 | 
            -
              module Forms
         | 
| 5 | 
            -
                class AskScriptUuid < ShopifyCLI::Form
         | 
| 6 | 
            -
                  attr_reader :uuid
         | 
| 7 | 
            -
                  def ask
         | 
| 8 | 
            -
                    scripts = @xargs
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                    return if scripts.empty? ||
         | 
| 11 | 
            -
                      !CLI::UI::Prompt.confirm(ctx.message("script.application.ensure_env.ask_connect_to_existing_script"))
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                    @uuid =
         | 
| 14 | 
            -
                      CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.ask_which_script_to_connect_to")) do |handler|
         | 
| 15 | 
            -
                        scripts.each do |script|
         | 
| 16 | 
            -
                          handler.option("#{script["title"]} (#{script["uuid"]})") { script["uuid"] }
         | 
| 17 | 
            -
                        end
         | 
| 18 | 
            -
                      end
         | 
| 19 | 
            -
                  end
         | 
| 20 | 
            -
                end
         | 
| 21 | 
            -
              end
         | 
| 22 | 
            -
            end
         | 
| @@ -1,33 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Script
         | 
| 4 | 
            -
              module Forms
         | 
| 5 | 
            -
                class Create < ShopifyCLI::Form
         | 
| 6 | 
            -
                  flag_arguments :extension_point, :title
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  def ask
         | 
| 9 | 
            -
                    self.title = valid_name
         | 
| 10 | 
            -
                    self.extension_point ||= ask_extension_point
         | 
| 11 | 
            -
                  end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                  private
         | 
| 14 | 
            -
             | 
| 15 | 
            -
                  def ask_extension_point
         | 
| 16 | 
            -
                    CLI::UI::Prompt.ask(
         | 
| 17 | 
            -
                      @ctx.message("script.forms.create.select_extension_point"),
         | 
| 18 | 
            -
                      options: Layers::Application::ExtensionPoints.available_types
         | 
| 19 | 
            -
                    )
         | 
| 20 | 
            -
                  end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                  def ask_title
         | 
| 23 | 
            -
                    CLI::UI::Prompt.ask(@ctx.message("script.forms.create.script_title"))
         | 
| 24 | 
            -
                  end
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                  def valid_name
         | 
| 27 | 
            -
                    normalized_title = (title || ask_title).downcase.gsub(" ", "_")
         | 
| 28 | 
            -
                    return normalized_title if normalized_title.match?(/^[0-9A-Za-z_-]*$/)
         | 
| 29 | 
            -
                    raise Errors::InvalidScriptTitleError
         | 
| 30 | 
            -
                  end
         | 
| 31 | 
            -
                end
         | 
| 32 | 
            -
              end
         | 
| 33 | 
            -
            end
         | 
| @@ -1,14 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Script
         | 
| 4 | 
            -
              module Forms
         | 
| 5 | 
            -
                class RunAgainstShopifyOrg < ShopifyCLI::Form
         | 
| 6 | 
            -
                  attr_reader :response
         | 
| 7 | 
            -
                  def ask
         | 
| 8 | 
            -
                    @ctx.puts(@ctx.message("core.tasks.select_org_and_shop.identified_as_shopify"))
         | 
| 9 | 
            -
                    message = @ctx.message("core.tasks.select_org_and_shop.first_party")
         | 
| 10 | 
            -
                    @response = CLI::UI::Prompt.confirm(message, default: false)
         | 
| 11 | 
            -
                  end
         | 
| 12 | 
            -
                end
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
            end
         | 
| @@ -1,46 +0,0 @@ | |
| 1 | 
            -
            mutation AppScriptSet(
         | 
| 2 | 
            -
              $uuid: String
         | 
| 3 | 
            -
              $extensionPointName: ExtensionPointName!,
         | 
| 4 | 
            -
              $title: String!,
         | 
| 5 | 
            -
              $description: String,
         | 
| 6 | 
            -
              $force: Boolean,
         | 
| 7 | 
            -
              $schemaMajorVersion: String,
         | 
| 8 | 
            -
              $schemaMinorVersion: String,
         | 
| 9 | 
            -
              $scriptConfigVersion: String!,
         | 
| 10 | 
            -
              $configurationUi: Boolean!,
         | 
| 11 | 
            -
              $configurationDefinition: String!,
         | 
| 12 | 
            -
              $moduleUploadUrl: String!,
         | 
| 13 | 
            -
              $library: LibraryInput,
         | 
| 14 | 
            -
              $inputQuery: String,
         | 
| 15 | 
            -
              $appBridge: AppBridgeInput!,
         | 
| 16 | 
            -
            ) {
         | 
| 17 | 
            -
              appScriptSet(
         | 
| 18 | 
            -
                uuid: $uuid
         | 
| 19 | 
            -
                extensionPointName: $extensionPointName
         | 
| 20 | 
            -
                title: $title
         | 
| 21 | 
            -
                description: $description
         | 
| 22 | 
            -
                force: $force
         | 
| 23 | 
            -
                schemaMajorVersion: $schemaMajorVersion
         | 
| 24 | 
            -
                schemaMinorVersion: $schemaMinorVersion,
         | 
| 25 | 
            -
                scriptConfigVersion: $scriptConfigVersion,
         | 
| 26 | 
            -
                configurationUi: $configurationUi,
         | 
| 27 | 
            -
                configurationDefinition: $configurationDefinition,
         | 
| 28 | 
            -
                moduleUploadUrl: $moduleUploadUrl,
         | 
| 29 | 
            -
                library: $library,
         | 
| 30 | 
            -
                inputQuery: $inputQuery,
         | 
| 31 | 
            -
                appBridge: $appBridge
         | 
| 32 | 
            -
            ) {
         | 
| 33 | 
            -
                userErrors {
         | 
| 34 | 
            -
                  field
         | 
| 35 | 
            -
                  message
         | 
| 36 | 
            -
                  tag
         | 
| 37 | 
            -
                }
         | 
| 38 | 
            -
                appScript {
         | 
| 39 | 
            -
                  uuid
         | 
| 40 | 
            -
                  appKey
         | 
| 41 | 
            -
                  configSchema
         | 
| 42 | 
            -
                  extensionPointName
         | 
| 43 | 
            -
                  title
         | 
| 44 | 
            -
                }
         | 
| 45 | 
            -
              }
         | 
| 46 | 
            -
            }
         | 
| @@ -1,25 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Script
         | 
| 4 | 
            -
              module Layers
         | 
| 5 | 
            -
                module Application
         | 
| 6 | 
            -
                  class BuildScript
         | 
| 7 | 
            -
                    class << self
         | 
| 8 | 
            -
                      def call(ctx:, task_runner:)
         | 
| 9 | 
            -
                        CLI::UI::Frame.open(ctx.message("script.application.building")) do
         | 
| 10 | 
            -
                          UI::StrictSpinner.spin(ctx.message("script.application.building_script")) do |spinner|
         | 
| 11 | 
            -
                            task_runner.build
         | 
| 12 | 
            -
                            spinner.update_title(ctx.message("script.application.built"))
         | 
| 13 | 
            -
                          end
         | 
| 14 | 
            -
                        rescue Infrastructure::Errors::BuildError => e
         | 
| 15 | 
            -
                          CLI::UI::Frame.with_frame_color_override(:red) do
         | 
| 16 | 
            -
                            ctx.puts("\n{{red:#{e.message}}}")
         | 
| 17 | 
            -
                          end
         | 
| 18 | 
            -
                          raise
         | 
| 19 | 
            -
                        end
         | 
| 20 | 
            -
                      end
         | 
| 21 | 
            -
                    end
         | 
| 22 | 
            -
                  end
         | 
| 23 | 
            -
                end
         | 
| 24 | 
            -
              end
         | 
| 25 | 
            -
            end
         | 
| @@ -1,86 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require "shopify_cli"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            module Script
         | 
| 6 | 
            -
              module Layers
         | 
| 7 | 
            -
                module Application
         | 
| 8 | 
            -
                  class ConnectApp
         | 
| 9 | 
            -
                    class << self
         | 
| 10 | 
            -
                      def call(ctx:, force: false)
         | 
| 11 | 
            -
                        script_project_repo = Layers::Infrastructure::ScriptProjectRepository.new(ctx: ctx)
         | 
| 12 | 
            -
                        script_project = script_project_repo.get
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                        return false if script_project.env_valid? && !force
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                        if ShopifyCLI::Shopifolk.check && Forms::RunAgainstShopifyOrg.ask(ctx, nil, nil).response
         | 
| 17 | 
            -
                          ShopifyCLI::Shopifolk.act_as_shopify_organization
         | 
| 18 | 
            -
                        end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                        org =
         | 
| 21 | 
            -
                          if partner_proxy_bypass
         | 
| 22 | 
            -
                            stubbed_org
         | 
| 23 | 
            -
                          else
         | 
| 24 | 
            -
                            orgs = ShopifyCLI::PartnersAPI::Organizations.fetch_all_with_apps(ctx)
         | 
| 25 | 
            -
                            Forms::AskOrg.ask(ctx, orgs, nil).org
         | 
| 26 | 
            -
                          end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                        app = Forms::AskApp.ask(
         | 
| 29 | 
            -
                          ctx,
         | 
| 30 | 
            -
                          {
         | 
| 31 | 
            -
                            apps: org["apps"],
         | 
| 32 | 
            -
                            acting_as_shopify_organization: ShopifyCLI::Shopifolk.acting_as_shopify_organization?,
         | 
| 33 | 
            -
                          },
         | 
| 34 | 
            -
                          nil
         | 
| 35 | 
            -
                        ).app
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                        script_service = Layers::Infrastructure::ServiceLocator.script_service(ctx: ctx, api_key: app["apiKey"])
         | 
| 38 | 
            -
                        extension_point_type = script_project.extension_point_type
         | 
| 39 | 
            -
                        scripts = script_service.get_app_scripts(extension_point_type: extension_point_type)
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                        uuid = Forms::AskScriptUuid.ask(ctx, scripts, nil)&.uuid
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                        script_project_repo.create_env(
         | 
| 44 | 
            -
                          api_key: app["apiKey"],
         | 
| 45 | 
            -
                          secret: app["apiSecretKeys"].first["secret"],
         | 
| 46 | 
            -
                          uuid: uuid
         | 
| 47 | 
            -
                        )
         | 
| 48 | 
            -
                        ctx.done(ctx.message("script.connect.connected", app["title"]))
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                        true
         | 
| 51 | 
            -
                      rescue SmartProperties::InitializationError, SmartProperties::InvalidValueError => error
         | 
| 52 | 
            -
                        handle_error(error, context: ctx)
         | 
| 53 | 
            -
                      end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                      def handle_error(error, context:)
         | 
| 56 | 
            -
                        properties_hash = { api_key: "SHOPIFY_API_KEY", secret: "SHOPIFY_API_SECRET" }
         | 
| 57 | 
            -
                        missing_env_variables = error.properties.map { |p| properties_hash[p.name] }.compact.join(", ")
         | 
| 58 | 
            -
                        message = context.message("script.error.missing_env_file_variables", missing_env_variables)
         | 
| 59 | 
            -
                        message += context.message("script.error.missing_env_file_variables_solution", ShopifyCLI::TOOL_NAME)
         | 
| 60 | 
            -
                        raise ShopifyCLI::Abort,
         | 
| 61 | 
            -
                          message
         | 
| 62 | 
            -
                      end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                      private
         | 
| 65 | 
            -
             | 
| 66 | 
            -
                      def partner_proxy_bypass
         | 
| 67 | 
            -
                        !ENV["BYPASS_PARTNERS_PROXY"].nil?
         | 
| 68 | 
            -
                      end
         | 
| 69 | 
            -
             | 
| 70 | 
            -
                      def stubbed_org
         | 
| 71 | 
            -
                        {
         | 
| 72 | 
            -
                          "apps" => [
         | 
| 73 | 
            -
                            {
         | 
| 74 | 
            -
                              "appType" => "custom",
         | 
| 75 | 
            -
                              "apiKey" => "stubbed-api-key",
         | 
| 76 | 
            -
                              "apiSecretKeys" => [{ "secret" => "stubbed-api-secret" }],
         | 
| 77 | 
            -
                              "title" => "Fake App (Not connected to Partners)",
         | 
| 78 | 
            -
                            },
         | 
| 79 | 
            -
                          ],
         | 
| 80 | 
            -
                        }
         | 
| 81 | 
            -
                      end
         | 
| 82 | 
            -
                    end
         | 
| 83 | 
            -
                  end
         | 
| 84 | 
            -
                end
         | 
| 85 | 
            -
              end
         | 
| 86 | 
            -
            end
         |