shopify-cli 2.7.0 → 2.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +2 -2
  3. data/.github/workflows/shopify.yml +1 -1
  4. data/.gitignore +2 -0
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +46 -0
  7. data/Codespace.dockerfile +2 -2
  8. data/Gemfile.lock +4 -4
  9. data/Rakefile +27 -0
  10. data/Tests.dockerfile +2 -2
  11. data/dev.yml +3 -3
  12. data/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +1 -0
  13. data/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +1 -0
  14. data/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +1 -0
  15. data/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +1 -0
  16. data/ext/javy/javy.rb +204 -0
  17. data/ext/javy/version +1 -0
  18. data/lib/graphql/get_extension_registrations.graphql +27 -0
  19. data/lib/project_types/extension/cli.rb +27 -2
  20. data/lib/project_types/extension/commands/build.rb +10 -14
  21. data/lib/project_types/extension/commands/create.rb +3 -6
  22. data/lib/project_types/extension/commands/push.rb +36 -8
  23. data/lib/project_types/extension/extension_project.rb +1 -1
  24. data/lib/project_types/extension/features/argo_serve.rb +6 -5
  25. data/lib/project_types/extension/forms/questions/ask_registration.rb +6 -2
  26. data/lib/project_types/extension/loaders/project.rb +29 -0
  27. data/lib/project_types/extension/loaders/specification_handler.rb +22 -0
  28. data/lib/project_types/extension/messages/messages.rb +4 -2
  29. data/lib/project_types/extension/models/app.rb +1 -1
  30. data/lib/project_types/extension/models/development_server.rb +2 -2
  31. data/lib/project_types/extension/models/specification_handlers/default.rb +4 -0
  32. data/lib/project_types/extension/tasks/convert_server_config.rb +3 -1
  33. data/lib/project_types/extension/tasks/execute_commands/base.rb +13 -0
  34. data/lib/project_types/extension/tasks/execute_commands/build.rb +29 -0
  35. data/lib/project_types/extension/tasks/execute_commands/create.rb +33 -0
  36. data/lib/project_types/extension/tasks/execute_commands/serve.rb +35 -0
  37. data/lib/project_types/extension/tasks/merge_server_config.rb +33 -22
  38. data/lib/project_types/rails/commands/create.rb +2 -4
  39. data/lib/project_types/script/cli.rb +9 -1
  40. data/lib/project_types/script/commands/connect.rb +19 -0
  41. data/lib/project_types/script/commands/create.rb +1 -3
  42. data/lib/project_types/script/commands/javy.rb +29 -0
  43. data/lib/project_types/script/commands/push.rb +2 -1
  44. data/lib/project_types/script/config/extension_points.yml +12 -30
  45. data/lib/project_types/script/forms/ask_app.rb +32 -0
  46. data/lib/project_types/script/forms/ask_org.rb +30 -0
  47. data/lib/project_types/script/forms/ask_script_uuid.rb +22 -0
  48. data/lib/project_types/script/forms/run_against_shopify_org.rb +14 -0
  49. data/lib/project_types/script/graphql/app_script_set.graphql +2 -2
  50. data/lib/project_types/script/layers/application/build_script.rb +0 -1
  51. data/lib/project_types/script/layers/application/connect_app.rb +79 -0
  52. data/lib/project_types/script/layers/application/create_script.rb +17 -17
  53. data/lib/project_types/script/layers/application/push_script.rb +1 -1
  54. data/lib/project_types/script/layers/domain/errors.rb +1 -4
  55. data/lib/project_types/script/layers/domain/push_package.rb +3 -3
  56. data/lib/project_types/script/layers/domain/{script_json.rb → script_config.rb} +2 -2
  57. data/lib/project_types/script/layers/domain/script_project.rb +5 -1
  58. data/lib/project_types/script/layers/infrastructure/errors.rb +36 -7
  59. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +0 -4
  60. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +0 -4
  61. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -2
  62. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +125 -27
  63. data/lib/project_types/script/layers/infrastructure/script_service.rb +11 -11
  64. data/lib/project_types/script/messages/messages.rb +32 -4
  65. data/lib/project_types/script/ui/error_handler.rb +31 -21
  66. data/lib/project_types/theme/commands/pull.rb +3 -0
  67. data/lib/project_types/theme/commands/push.rb +7 -1
  68. data/lib/project_types/theme/commands/serve.rb +1 -1
  69. data/lib/project_types/theme/messages/messages.rb +35 -1
  70. data/lib/project_types/theme/ui/sync_progress_bar.rb +2 -2
  71. data/lib/shopify_cli/command/project_command.rb +20 -7
  72. data/lib/shopify_cli/command.rb +6 -0
  73. data/lib/shopify_cli/commands/app/create/node.rb +1 -3
  74. data/lib/shopify_cli/commands/app/create/rails.rb +1 -3
  75. data/lib/shopify_cli/constants.rb +7 -0
  76. data/lib/shopify_cli/context.rb +11 -1
  77. data/lib/shopify_cli/environment.rb +4 -0
  78. data/lib/shopify_cli/form.rb +2 -0
  79. data/lib/shopify_cli/git.rb +2 -0
  80. data/lib/shopify_cli/identity_auth.rb +18 -0
  81. data/lib/shopify_cli/messages/messages.rb +9 -2
  82. data/lib/shopify_cli/partners_api/app_extensions/job.rb +36 -0
  83. data/lib/shopify_cli/partners_api/app_extensions.rb +46 -0
  84. data/lib/shopify_cli/partners_api/organizations.rb +2 -5
  85. data/lib/shopify_cli/partners_api.rb +2 -8
  86. data/lib/shopify_cli/project.rb +8 -7
  87. data/lib/shopify_cli/resources/env_file.rb +13 -5
  88. data/lib/shopify_cli/services/app/create/node_service.rb +2 -0
  89. data/lib/shopify_cli/services/app/create/php_service.rb +1 -1
  90. data/lib/shopify_cli/services/app/create/rails_service.rb +3 -1
  91. data/lib/shopify_cli/services/app/serve/node_service.rb +1 -1
  92. data/lib/shopify_cli/services/app/serve/rails_service.rb +1 -1
  93. data/lib/shopify_cli/tasks/ensure_authenticated.rb +9 -3
  94. data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +73 -0
  95. data/lib/shopify_cli/theme/dev_server/hot-reload.js +38 -9
  96. data/lib/shopify_cli/theme/dev_server/proxy/template_param_builder.rb +84 -0
  97. data/lib/shopify_cli/theme/dev_server/proxy.rb +9 -15
  98. data/lib/shopify_cli/theme/dev_server.rb +32 -19
  99. data/lib/shopify_cli/theme/syncer/error_reporter.rb +45 -0
  100. data/lib/shopify_cli/theme/syncer/operation.rb +56 -0
  101. data/lib/shopify_cli/theme/syncer/standard_reporter.rb +32 -0
  102. data/lib/shopify_cli/theme/syncer.rb +40 -39
  103. data/lib/shopify_cli/theme/theme.rb +31 -19
  104. data/lib/shopify_cli/thread_pool/job.rb +27 -0
  105. data/lib/shopify_cli/thread_pool.rb +37 -0
  106. data/lib/shopify_cli/tunnel.rb +26 -22
  107. data/lib/shopify_cli/version.rb +1 -1
  108. data/shopify-cli.gemspec +1 -1
  109. data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +3 -1
  110. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +1 -1
  111. metadata +34 -8
  112. data/lib/graphql/all_orgs_with_extensions.graphql +0 -37
  113. data/lib/project_types/extension/tasks/run_extension_command.rb +0 -82
  114. data/lib/project_types/script/tasks/ensure_env.rb +0 -106
@@ -1,82 +0,0 @@
1
-
2
- # frozen_string_literal: true
3
- require "shopify_cli"
4
-
5
- module Extension
6
- module Tasks
7
- class RunExtensionCommand < ShopifyCLI::Task
8
- include SmartProperties
9
-
10
- SUPPORTED_COMMANDS = [
11
- "create",
12
- "build",
13
- "serve",
14
- ]
15
-
16
- property! :command, accepts: SUPPORTED_COMMANDS
17
- property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
18
- property :context, accepts: ShopifyCLI::Context
19
- property :config_file_name, accepts: String
20
- property :port, accepts: Integer, default: 39351
21
- property :resource_url, accepts: String
22
- property :root_dir, accepts: String
23
- property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES
24
- property :tunnel_url, accepts: String
25
-
26
- def call
27
- ShopifyCLI::Result.success(config_file_exists?)
28
- .then(&method(:load_or_build_server_config))
29
- .then(&method(:run_command))
30
- .unwrap do |error|
31
- raise error unless error.nil?
32
- end
33
- end
34
-
35
- private
36
-
37
- def config_file_exists?
38
- return false if config_file_name.nil?
39
- project = ExtensionProject.current
40
- File.exist?(File.join(project.directory, config_file_name))
41
- end
42
-
43
- def load_or_build_server_config(config_file_exists)
44
- return merge_server_config if config_file_exists
45
- build_server_config
46
- end
47
-
48
- def merge_server_config
49
- Tasks::MergeServerConfig.call(
50
- context: context,
51
- file_name: config_file_name,
52
- resource_url: resource_url,
53
- tunnel_url: tunnel_url,
54
- type: type
55
- )
56
- end
57
-
58
- def build_server_config
59
- extension = Models::ServerConfig::Extension.build(
60
- template: template,
61
- type: type,
62
- root_dir: root_dir,
63
- )
64
-
65
- Models::ServerConfig::Root.new(port: port, extensions: [extension])
66
- end
67
-
68
- def run_command(server_config)
69
- case command
70
- when "create"
71
- Models::DevelopmentServer.new.create(server_config)
72
- when "build"
73
- Models::DevelopmentServer.new.build(server_config)
74
- when "serve"
75
- Models::DevelopmentServer.new.serve(context, server_config)
76
- else
77
- raise NotImplementedError
78
- end
79
- end
80
- end
81
- end
82
- end
@@ -1,106 +0,0 @@
1
- require "shopify_cli"
2
-
3
- module Script
4
- module Tasks
5
- class EnsureEnv < ShopifyCLI::Task
6
- attr_accessor :ctx
7
-
8
- def call(ctx)
9
- self.ctx = ctx
10
-
11
- script_project_repo = Layers::Infrastructure::ScriptProjectRepository.new(ctx: ctx)
12
- script_project = script_project_repo.get
13
-
14
- return false if script_project.api_key && script_project.api_secret && script_project.uuid_defined?
15
-
16
- org = ask_org
17
- app = ask_app(org["apps"])
18
- uuid = ask_script_uuid(app, script_project.extension_point_type)
19
-
20
- script_project_repo.create_env(
21
- api_key: app["apiKey"],
22
- secret: app["apiSecretKeys"].first["secret"],
23
- uuid: uuid
24
- )
25
-
26
- true
27
- end
28
-
29
- private
30
-
31
- def ask_org
32
- return stubbed_org if partner_proxy_bypass
33
-
34
- if ShopifyCLI::Shopifolk.check && wants_to_run_against_shopify_org?
35
- ShopifyCLI::Shopifolk.act_as_shopify_organization
36
- end
37
-
38
- orgs = ShopifyCLI::PartnersAPI::Organizations.fetch_with_app(ctx)
39
- if orgs.count == 1
40
- default = orgs.first
41
- ctx.puts(ctx.message("script.application.ensure_env.organization", default["businessName"], default["id"]))
42
- default
43
- elsif orgs.count > 0
44
- CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.organization_select")) do |handler|
45
- orgs.each do |org|
46
- handler.option("#{org["businessName"]} (#{org["id"]})") { org }
47
- end
48
- end
49
- else
50
- raise Errors::NoExistingOrganizationsError
51
- end
52
- end
53
-
54
- def stubbed_org
55
- {
56
- "apps" => [
57
- {
58
- "appType" => "custom",
59
- "apiKey" => "stubbed-api-key",
60
- "apiSecretKeys" => [{ "secret" => "stubbed-api-secret" }],
61
- "title" => "Fake App (Not connected to Partners)",
62
- },
63
- ],
64
- }
65
- end
66
-
67
- def partner_proxy_bypass
68
- !ENV["BYPASS_PARTNERS_PROXY"].nil?
69
- end
70
-
71
- def ask_app(apps)
72
- unless ShopifyCLI::Shopifolk.acting_as_shopify_organization?
73
- apps = apps.select { |app| app["appType"] == "custom" }
74
- end
75
-
76
- if apps.count == 1
77
- default = apps.first
78
- ctx.puts(ctx.message("script.application.ensure_env.app", default["title"]))
79
- default
80
- elsif apps.count > 0
81
- CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.app_select")) do |handler|
82
- apps.each do |app|
83
- handler.option(app["title"]) { app }
84
- end
85
- end
86
- else
87
- raise Errors::NoExistingAppsError
88
- end
89
- end
90
-
91
- def ask_script_uuid(app, extension_point_type)
92
- script_service = Layers::Infrastructure::ServiceLocator.script_service(ctx: ctx, api_key: app["apiKey"])
93
- scripts = script_service.get_app_scripts(extension_point_type: extension_point_type)
94
-
95
- return nil unless scripts.count > 0 &&
96
- CLI::UI::Prompt.confirm(ctx.message("script.application.ensure_env.ask_connect_to_existing_script"))
97
-
98
- CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.ask_which_script_to_connect_to")) do |handler|
99
- scripts.each do |script|
100
- handler.option("#{script["title"]} (#{script["uuid"]})") { script["uuid"] }
101
- end
102
- end
103
- end
104
- end
105
- end
106
- end