shopify-cli 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +12 -12
  4. data/Rakefile +32 -30
  5. data/bin/load_shopify.rb +6 -6
  6. data/bin/shopify +2 -2
  7. data/ext/shopify-cli/extconf.rb +7 -7
  8. data/lib/docgen/markdown.rb +11 -11
  9. data/lib/{project_types/extension/graphql → graphql}/get_app_by_api_key.graphql +0 -0
  10. data/lib/project_types/extension/cli.rb +52 -45
  11. data/lib/project_types/extension/commands/build.rb +3 -3
  12. data/lib/project_types/extension/commands/create.rb +16 -9
  13. data/lib/project_types/extension/commands/extension_command.rb +8 -5
  14. data/lib/project_types/extension/commands/push.rb +8 -8
  15. data/lib/project_types/extension/commands/register.rb +19 -30
  16. data/lib/project_types/extension/commands/serve.rb +2 -2
  17. data/lib/project_types/extension/commands/tunnel.rb +12 -12
  18. data/lib/project_types/extension/extension_project.rb +4 -4
  19. data/lib/project_types/extension/extension_project_keys.rb +4 -4
  20. data/lib/project_types/extension/features/argo.rb +13 -13
  21. data/lib/project_types/extension/features/argo_config.rb +5 -5
  22. data/lib/project_types/extension/features/argo_dependencies.rb +5 -5
  23. data/lib/project_types/extension/features/argo_setup.rb +2 -2
  24. data/lib/project_types/extension/features/argo_setup_steps.rb +4 -4
  25. data/lib/project_types/extension/forms/create.rb +28 -34
  26. data/lib/project_types/extension/forms/questions/ask_app.rb +53 -0
  27. data/lib/project_types/extension/forms/questions/ask_name.rb +40 -0
  28. data/lib/project_types/extension/forms/questions/ask_type.rb +36 -0
  29. data/lib/project_types/extension/messages/messages.rb +53 -52
  30. data/lib/project_types/extension/models/lazy_specification_handler.rb +12 -0
  31. data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
  32. data/lib/project_types/extension/models/specification_handlers/default.rb +2 -2
  33. data/lib/project_types/extension/models/specifications.rb +3 -3
  34. data/lib/project_types/extension/tasks/configure_features.rb +4 -4
  35. data/lib/project_types/extension/tasks/converters/app_converter.rb +6 -6
  36. data/lib/project_types/extension/tasks/converters/registration_converter.rb +6 -6
  37. data/lib/project_types/extension/tasks/converters/validation_error_converter.rb +4 -4
  38. data/lib/project_types/extension/tasks/converters/version_converter.rb +7 -7
  39. data/lib/project_types/extension/tasks/create_extension.rb +4 -4
  40. data/lib/project_types/extension/tasks/fetch_specifications.rb +4 -4
  41. data/lib/project_types/extension/tasks/get_app.rb +4 -4
  42. data/lib/project_types/extension/tasks/get_apps.rb +3 -3
  43. data/lib/project_types/extension/tasks/update_draft.rb +4 -4
  44. data/lib/project_types/extension/tasks/user_errors.rb +4 -4
  45. data/lib/project_types/node/cli.rb +19 -19
  46. data/lib/project_types/node/commands/connect.rb +3 -3
  47. data/lib/project_types/node/commands/create.rb +40 -38
  48. data/lib/project_types/node/commands/deploy.rb +4 -4
  49. data/lib/project_types/node/commands/deploy/heroku.rb +24 -24
  50. data/lib/project_types/node/commands/generate.rb +8 -8
  51. data/lib/project_types/node/commands/open.rb +2 -2
  52. data/lib/project_types/node/commands/populate.rb +6 -6
  53. data/lib/project_types/node/commands/populate/customer.rb +5 -5
  54. data/lib/project_types/node/commands/populate/draft_order.rb +5 -5
  55. data/lib/project_types/node/commands/populate/product.rb +5 -5
  56. data/lib/project_types/node/commands/serve.rb +9 -9
  57. data/lib/project_types/node/commands/tunnel.rb +7 -7
  58. data/lib/project_types/node/forms/create.rb +7 -7
  59. data/lib/project_types/node/messages/messages.rb +3 -3
  60. data/lib/project_types/rails/cli.rb +21 -21
  61. data/lib/project_types/rails/commands/connect.rb +3 -3
  62. data/lib/project_types/rails/commands/create.rb +51 -48
  63. data/lib/project_types/rails/commands/deploy.rb +4 -4
  64. data/lib/project_types/rails/commands/deploy/heroku.rb +30 -30
  65. data/lib/project_types/rails/commands/generate.rb +7 -7
  66. data/lib/project_types/rails/commands/generate/webhook.rb +6 -6
  67. data/lib/project_types/rails/commands/open.rb +2 -2
  68. data/lib/project_types/rails/commands/populate.rb +6 -6
  69. data/lib/project_types/rails/commands/populate/customer.rb +5 -5
  70. data/lib/project_types/rails/commands/populate/draft_order.rb +5 -5
  71. data/lib/project_types/rails/commands/populate/product.rb +5 -5
  72. data/lib/project_types/rails/commands/serve.rb +11 -11
  73. data/lib/project_types/rails/commands/tunnel.rb +7 -7
  74. data/lib/project_types/rails/forms/create.rb +23 -23
  75. data/lib/project_types/rails/gem.rb +23 -23
  76. data/lib/project_types/rails/messages/messages.rb +4 -4
  77. data/lib/project_types/rails/ruby.rb +2 -2
  78. data/lib/project_types/script/cli.rb +40 -40
  79. data/lib/project_types/script/commands/create.rb +9 -8
  80. data/lib/project_types/script/commands/disable.rb +3 -3
  81. data/lib/project_types/script/commands/enable.rb +9 -7
  82. data/lib/project_types/script/commands/push.rb +5 -4
  83. data/lib/project_types/script/errors.rb +17 -0
  84. data/lib/project_types/script/forms/create.rb +5 -5
  85. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +2 -0
  86. data/lib/project_types/script/layers/application/build_script.rb +6 -8
  87. data/lib/project_types/script/layers/application/create_script.rb +2 -2
  88. data/lib/project_types/script/layers/application/disable_script.rb +2 -2
  89. data/lib/project_types/script/layers/application/enable_script.rb +2 -2
  90. data/lib/project_types/script/layers/application/project_dependencies.rb +4 -4
  91. data/lib/project_types/script/layers/application/push_script.rb +4 -12
  92. data/lib/project_types/script/layers/domain/push_package.rb +5 -1
  93. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +3 -3
  94. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +10 -10
  95. data/lib/project_types/script/layers/infrastructure/errors.rb +1 -1
  96. data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +2 -2
  97. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +12 -17
  98. data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +4 -4
  99. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +1 -1
  100. data/lib/project_types/script/layers/infrastructure/script_service.rb +18 -16
  101. data/lib/project_types/script/messages/messages.rb +14 -8
  102. data/lib/project_types/script/script_project.rb +27 -5
  103. data/lib/project_types/script/ui/error_handler.rb +80 -68
  104. data/lib/project_types/script/ui/printing_spinner.rb +1 -1
  105. data/lib/project_types/script/ui/strict_spinner.rb +1 -1
  106. data/lib/project_types/theme/cli.rb +19 -19
  107. data/lib/project_types/theme/commands/connect.rb +12 -12
  108. data/lib/project_types/theme/commands/create.rb +11 -11
  109. data/lib/project_types/theme/commands/deploy.rb +8 -8
  110. data/lib/project_types/theme/commands/generate.rb +3 -3
  111. data/lib/project_types/theme/commands/generate/env.rb +15 -15
  112. data/lib/project_types/theme/commands/push.rb +15 -15
  113. data/lib/project_types/theme/commands/serve.rb +5 -5
  114. data/lib/project_types/theme/forms/connect.rb +4 -4
  115. data/lib/project_types/theme/forms/create.rb +5 -5
  116. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +22 -22
  117. data/lib/project_types/theme/themekit.rb +15 -15
  118. data/lib/rubygems_plugin.rb +3 -3
  119. data/lib/shopify-cli/admin_api.rb +11 -11
  120. data/lib/shopify-cli/admin_api/populate_resource_command.rb +17 -17
  121. data/lib/shopify-cli/admin_api/schema.rb +3 -3
  122. data/lib/shopify-cli/api.rb +10 -10
  123. data/lib/shopify-cli/command.rb +1 -1
  124. data/lib/shopify-cli/commands.rb +9 -9
  125. data/lib/shopify-cli/commands/config.rb +28 -52
  126. data/lib/shopify-cli/commands/connect.rb +10 -10
  127. data/lib/shopify-cli/commands/create.rb +5 -5
  128. data/lib/shopify-cli/commands/help.rb +6 -6
  129. data/lib/shopify-cli/commands/logout.rb +3 -3
  130. data/lib/shopify-cli/commands/system.rb +32 -32
  131. data/lib/shopify-cli/commands/version.rb +2 -2
  132. data/lib/shopify-cli/context.rb +23 -23
  133. data/lib/shopify-cli/core.rb +4 -4
  134. data/lib/shopify-cli/core/entry_point.rb +5 -5
  135. data/lib/shopify-cli/core/executor.rb +1 -1
  136. data/lib/shopify-cli/core/help_resolver.rb +2 -2
  137. data/lib/shopify-cli/core/monorail.rb +16 -16
  138. data/lib/shopify-cli/db.rb +2 -2
  139. data/lib/shopify-cli/feature.rb +1 -1
  140. data/lib/shopify-cli/form.rb +1 -1
  141. data/lib/shopify-cli/git.rb +17 -17
  142. data/lib/shopify-cli/helpers.rb +1 -1
  143. data/lib/shopify-cli/helpers/haikunator.rb +1 -1
  144. data/lib/shopify-cli/heroku.rb +28 -28
  145. data/lib/shopify-cli/http_request.rb +2 -2
  146. data/lib/shopify-cli/js_deps.rb +12 -12
  147. data/lib/shopify-cli/js_system.rb +5 -5
  148. data/lib/shopify-cli/lazy_delegator.rb +55 -0
  149. data/lib/shopify-cli/messages/messages.rb +4 -14
  150. data/lib/shopify-cli/oauth.rb +25 -25
  151. data/lib/shopify-cli/oauth/servlet.rb +9 -9
  152. data/lib/shopify-cli/options.rb +3 -3
  153. data/lib/shopify-cli/packager.rb +24 -24
  154. data/lib/shopify-cli/partners_api.rb +16 -16
  155. data/lib/shopify-cli/partners_api/organizations.rb +10 -10
  156. data/lib/shopify-cli/process_supervision.rb +7 -7
  157. data/lib/shopify-cli/project.rb +16 -16
  158. data/lib/shopify-cli/project_type.rb +3 -3
  159. data/lib/shopify-cli/resources.rb +1 -1
  160. data/lib/shopify-cli/resources/env_file.rb +9 -9
  161. data/lib/shopify-cli/result.rb +8 -8
  162. data/lib/shopify-cli/shopifolk.rb +6 -9
  163. data/lib/shopify-cli/sub_command.rb +1 -1
  164. data/lib/shopify-cli/task.rb +3 -3
  165. data/lib/shopify-cli/tasks.rb +7 -7
  166. data/lib/shopify-cli/tasks/create_api_client.rb +5 -5
  167. data/lib/shopify-cli/tasks/ensure_dev_store.rb +11 -11
  168. data/lib/shopify-cli/tasks/ensure_env.rb +15 -15
  169. data/lib/shopify-cli/tasks/ensure_loopback_url.rb +4 -4
  170. data/lib/shopify-cli/tasks/select_org_and_shop.rb +19 -19
  171. data/lib/shopify-cli/tasks/update_dashboard_urls.rb +10 -10
  172. data/lib/shopify-cli/transform_data_structure.rb +86 -0
  173. data/lib/shopify-cli/tunnel.rb +30 -30
  174. data/lib/shopify-cli/version.rb +1 -1
  175. data/lib/shopify_cli.rb +56 -54
  176. data/shopify-cli.gemspec +6 -6
  177. data/vendor/gen/template/bin/update-deps +9 -9
  178. metadata +9 -4
  179. data/lib/project_types/extension/forms/register.rb +0 -47
@@ -4,10 +4,11 @@ module Script
4
4
  module Commands
5
5
  class Create < ShopifyCli::SubCommand
6
6
  options do |parser, flags|
7
- parser.on('--name=NAME') { |name| flags[:name] = name }
8
- parser.on('--description=DESCRIPTION') { |description| flags[:description] = description }
9
- parser.on('--extension_point=EP_NAME') { |ep_name| flags[:extension_point] = ep_name }
10
- parser.on('--language=LANGUAGE') { |language| flags[:language] = language }
7
+ parser.on("--name=NAME") { |name| flags[:name] = name }
8
+ parser.on("--description=DESCRIPTION") { |description| flags[:description] = description }
9
+ parser.on("--extension_point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
10
+ parser.on("--extension-point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
11
+ parser.on("--language=LANGUAGE") { |language| flags[:language] = language }
11
12
  end
12
13
 
13
14
  def call(args, _name)
@@ -27,17 +28,17 @@ module Script
27
28
  extension_point_type: form.extension_point,
28
29
  description: form.description
29
30
  )
30
- @ctx.puts(@ctx.message('script.create.change_directory_notice', project.script_name))
31
+ @ctx.puts(@ctx.message("script.create.change_directory_notice", project.script_name))
31
32
  rescue Script::Errors::ScriptProjectAlreadyExistsError => e
32
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.create.error.operation_failed'))
33
+ UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
33
34
  rescue StandardError => e
34
35
  ScriptProject.cleanup(ctx: @ctx, script_name: form.name, root_dir: cur_dir) if form
35
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.create.error.operation_failed'))
36
+ UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.create.error.operation_failed"))
36
37
  end
37
38
 
38
39
  def self.help
39
40
  allowed_values = Script::Layers::Application::ExtensionPoints.types.map { |type| "{{cyan:#{type}}}" }
40
- ShopifyCli::Context.message('script.create.help', ShopifyCli::TOOL_NAME, allowed_values.join(', '))
41
+ ShopifyCli::Context.message("script.create.help", ShopifyCli::TOOL_NAME, allowed_values.join(", "))
41
42
  end
42
43
  end
43
44
  end
@@ -12,13 +12,13 @@ module Script
12
12
  shop_domain: project.env[:shop],
13
13
  extension_point_type: project.extension_point_type
14
14
  )
15
- @ctx.puts(@ctx.message('script.disable.script_disabled'))
15
+ @ctx.puts(@ctx.message("script.disable.script_disabled"))
16
16
  rescue StandardError => e
17
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.disable.error.operation_failed'))
17
+ UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.disable.error.operation_failed"))
18
18
  end
19
19
 
20
20
  def self.help
21
- ShopifyCli::Context.message('script.disable.help', ShopifyCli::TOOL_NAME)
21
+ ShopifyCli::Context.message("script.disable.help", ShopifyCli::TOOL_NAME)
22
22
  end
23
23
  end
24
24
  end
@@ -4,8 +4,10 @@ module Script
4
4
  module Commands
5
5
  class Enable < ShopifyCli::Command
6
6
  options do |parser, flags|
7
- parser.on('--config_props=KEYVALUEPAIRS', Array) { |t| flags[:config_props] = t }
8
- parser.on('--config_file=CONFIGFILEPATH') { |t| flags[:config_file] = t }
7
+ parser.on("--config_props=KEYVALUEPAIRS", Array) { |t| flags[:config_props] = t }
8
+ parser.on("--config-props=KEYVALUEPAIRS", Array) { |t| flags[:config_props] = t }
9
+ parser.on("--config_file=CONFIGFILEPATH") { |t| flags[:config_file] = t }
10
+ parser.on("--config-file=CONFIGFILEPATH") { |t| flags[:config_file] = t }
9
11
  end
10
12
 
11
13
  def call(_args, _name)
@@ -23,21 +25,21 @@ module Script
23
25
  title: project.script_name
24
26
  )
25
27
  @ctx.puts(@ctx.message(
26
- 'script.enable.script_enabled',
28
+ "script.enable.script_enabled",
27
29
  api_key: api_key,
28
30
  shop_domain: shop_domain,
29
31
  type: project.extension_point_type.capitalize,
30
32
  title: project.script_name
31
33
  ))
32
- @ctx.puts(@ctx.message('script.enable.info'))
34
+ @ctx.puts(@ctx.message("script.enable.info"))
33
35
  rescue Errors::InvalidConfigYAMLError => e
34
36
  UI::ErrorHandler.pretty_print_and_raise(e)
35
37
  rescue StandardError => e
36
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.enable.error.operation_failed'))
38
+ UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.enable.error.operation_failed"))
37
39
  end
38
40
 
39
41
  def self.help
40
- ShopifyCli::Context.message('script.enable.help', ShopifyCli::TOOL_NAME)
42
+ ShopifyCli::Context.message("script.enable.help", ShopifyCli::TOOL_NAME)
41
43
  end
42
44
 
43
45
  private
@@ -62,7 +64,7 @@ module Script
62
64
  def parse_config_props(config_props)
63
65
  Hash[
64
66
  config_props.map do |s|
65
- args = s.split(':').map(&:strip)
67
+ args = s.split(":").map(&:strip)
66
68
  raise Errors::InvalidConfigProps unless args.size == 2
67
69
  args
68
70
  end
@@ -4,7 +4,7 @@ module Script
4
4
  module Commands
5
5
  class Push < ShopifyCli::Command
6
6
  options do |parser, flags|
7
- parser.on('--force') { |t| flags[:force] = t }
7
+ parser.on("--force") { |t| flags[:force] = t }
8
8
  end
9
9
 
10
10
  def call(_args, _name)
@@ -14,13 +14,14 @@ module Script
14
14
  return @ctx.puts(self.class.help) unless api_key
15
15
 
16
16
  Layers::Application::PushScript.call(ctx: @ctx, force: options.flags.key?(:force))
17
- @ctx.puts(@ctx.message('script.push.script_pushed', api_key: api_key))
17
+ @ctx.puts(@ctx.message("script.push.script_pushed", api_key: api_key))
18
18
  rescue StandardError => e
19
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.push.error.operation_failed'))
19
+ msg = @ctx.message("script.push.error.operation_failed", api_key: ShopifyCli::Project.current.env.api_key)
20
+ UI::ErrorHandler.pretty_print_and_raise(e, failed_op: msg)
20
21
  end
21
22
 
22
23
  def self.help
23
- ShopifyCli::Context.message('script.push.help', ShopifyCli::TOOL_NAME)
24
+ ShopifyCli::Context.message("script.push.help", ShopifyCli::TOOL_NAME)
24
25
  end
25
26
  end
26
27
  end
@@ -4,6 +4,23 @@ module Script
4
4
  module Errors
5
5
  class InvalidContextError < ScriptProjectError; end
6
6
  class InvalidScriptNameError < ScriptProjectError; end
7
+
8
+ class InvalidConfigUiDefinitionError < ScriptProjectError
9
+ attr_reader :filename
10
+ def initialize(filename)
11
+ super()
12
+ @filename = filename
13
+ end
14
+ end
15
+
16
+ class MissingSpecifiedConfigUiDefinitionError < ScriptProjectError
17
+ attr_reader :filename
18
+ def initialize(filename)
19
+ super()
20
+ @filename = filename
21
+ end
22
+ end
23
+
7
24
  class NoExistingAppsError < ScriptProjectError; end
8
25
  class NoExistingOrganizationsError < ScriptProjectError; end
9
26
 
@@ -16,21 +16,21 @@ module Script
16
16
 
17
17
  def ask_extension_point
18
18
  CLI::UI::Prompt.ask(
19
- @ctx.message('script.forms.create.select_extension_point'),
19
+ @ctx.message("script.forms.create.select_extension_point"),
20
20
  options: Layers::Application::ExtensionPoints.non_deprecated_types
21
21
  )
22
22
  end
23
23
 
24
24
  def ask_name
25
- CLI::UI::Prompt.ask(@ctx.message('script.forms.create.script_name'))
25
+ CLI::UI::Prompt.ask(@ctx.message("script.forms.create.script_name"))
26
26
  end
27
27
 
28
28
  def ask_description
29
- CLI::UI::Prompt.ask(@ctx.message('script.forms.create.description'))
29
+ CLI::UI::Prompt.ask(@ctx.message("script.forms.create.description"))
30
30
  end
31
31
 
32
32
  def valid_name
33
- n = (name || ask_name).downcase.gsub(' ', '_')
33
+ n = (name || ask_name).downcase.gsub(" ", "_")
34
34
  return n if n.match?(/^[0-9A-Za-z_-]*$/)
35
35
  raise Errors::InvalidScriptNameError
36
36
  end
@@ -48,7 +48,7 @@ module Script
48
48
  return all_languages.first if all_languages.count == 1
49
49
 
50
50
  CLI::UI::Prompt.ask(
51
- ctx.message('script.forms.create.select_language'),
51
+ ctx.message("script.forms.create.select_language"),
52
52
  options: all_languages
53
53
  )
54
54
  end
@@ -2,6 +2,7 @@ mutation AppScriptUpdateOrCreate(
2
2
  $extensionPointName: ExtensionPointName!,
3
3
  $title: String,
4
4
  $description: String,
5
+ $configUi: String,
5
6
  $sourceCode: String,
6
7
  $language: String,
7
8
  $force: Boolean,
@@ -13,6 +14,7 @@ mutation AppScriptUpdateOrCreate(
13
14
  extensionPointName: $extensionPointName
14
15
  title: $title
15
16
  description: $description
17
+ configUi: $configUi
16
18
  sourceCode: $sourceCode
17
19
  language: $language
18
20
  force: $force
@@ -5,19 +5,17 @@ module Script
5
5
  module Application
6
6
  class BuildScript
7
7
  class << self
8
- def call(ctx:, task_runner:, script_name:, description:, extension_point_type:)
9
- CLI::UI::Frame.open(ctx.message('script.application.building')) do
8
+ def call(ctx:, task_runner:, script_project:)
9
+ CLI::UI::Frame.open(ctx.message("script.application.building")) do
10
10
  begin
11
- UI::StrictSpinner.spin(ctx.message('script.application.building_script')) do |spinner|
11
+ UI::StrictSpinner.spin(ctx.message("script.application.building_script")) do |spinner|
12
12
  Infrastructure::PushPackageRepository.new(ctx: ctx).create_push_package(
13
- extension_point_type: extension_point_type,
14
- script_name: script_name,
15
- description: description,
13
+ script_project: script_project,
16
14
  script_content: task_runner.build,
17
15
  compiled_type: task_runner.compiled_type,
18
- metadata: task_runner.metadata
16
+ metadata: task_runner.metadata,
19
17
  )
20
- spinner.update_title(ctx.message('script.application.built'))
18
+ spinner.update_title(ctx.message("script.application.built"))
21
19
  end
22
20
  rescue StandardError => e
23
21
  CLI::UI::Frame.with_frame_color_override(:red) do
@@ -40,9 +40,9 @@ module Script
40
40
  end
41
41
 
42
42
  def bootstrap(ctx, project_creator)
43
- UI::StrictSpinner.spin(ctx.message('script.create.creating')) do |spinner|
43
+ UI::StrictSpinner.spin(ctx.message("script.create.creating")) do |spinner|
44
44
  project_creator.bootstrap
45
- spinner.update_title(ctx.message('script.create.created'))
45
+ spinner.update_title(ctx.message("script.create.created"))
46
46
  end
47
47
  end
48
48
  end
@@ -5,14 +5,14 @@ module Script
5
5
  module Application
6
6
  class DisableScript
7
7
  def self.call(ctx:, api_key:, shop_domain:, extension_point_type:)
8
- UI::PrintingSpinner.spin(ctx, ctx.message('script.application.disabling')) do |p_ctx, spinner|
8
+ UI::PrintingSpinner.spin(ctx, ctx.message("script.application.disabling")) do |p_ctx, spinner|
9
9
  script_service = Infrastructure::ScriptService.new(ctx: p_ctx)
10
10
  script_service.disable(
11
11
  api_key: api_key,
12
12
  shop_domain: shop_domain,
13
13
  extension_point_type: extension_point_type,
14
14
  )
15
- spinner.update_title(p_ctx.message('script.application.disabled'))
15
+ spinner.update_title(p_ctx.message("script.application.disabled"))
16
16
  end
17
17
  end
18
18
  end
@@ -5,7 +5,7 @@ module Script
5
5
  module Application
6
6
  class EnableScript
7
7
  def self.call(ctx:, api_key:, shop_domain:, configuration:, extension_point_type:, title:)
8
- UI::PrintingSpinner.spin(ctx, ctx.message('script.application.enabling')) do |p_ctx, spinner|
8
+ UI::PrintingSpinner.spin(ctx, ctx.message("script.application.enabling")) do |p_ctx, spinner|
9
9
  script_service = Infrastructure::ScriptService.new(ctx: p_ctx)
10
10
  script_service.enable(
11
11
  api_key: api_key,
@@ -14,7 +14,7 @@ module Script
14
14
  extension_point_type: extension_point_type,
15
15
  title: title
16
16
  )
17
- spinner.update_title(p_ctx.message('script.application.enabled'))
17
+ spinner.update_title(p_ctx.message("script.application.enabled"))
18
18
  end
19
19
  end
20
20
  end
@@ -3,14 +3,14 @@ module Script
3
3
  module Application
4
4
  class ProjectDependencies
5
5
  def self.install(ctx:, task_runner:)
6
- CLI::UI::Frame.open(ctx.message('script.project_deps.checking_with_npm')) do
6
+ CLI::UI::Frame.open(ctx.message("script.project_deps.checking_with_npm")) do
7
7
  begin
8
8
  if task_runner.dependencies_installed?
9
- ctx.puts(ctx.message('script.project_deps.none_required'))
9
+ ctx.puts(ctx.message("script.project_deps.none_required"))
10
10
  else
11
- UI::StrictSpinner.spin(ctx.message('script.project_deps.installing')) do |spinner|
11
+ UI::StrictSpinner.spin(ctx.message("script.project_deps.installing")) do |spinner|
12
12
  task_runner.install_dependencies
13
- spinner.update_title(ctx.message('script.project_deps.installed'))
13
+ spinner.update_title(ctx.message("script.project_deps.installed"))
14
14
  end
15
15
  end
16
16
  true
@@ -9,24 +9,16 @@ module Script
9
9
  script_project = ScriptProject.current
10
10
  task_runner = Infrastructure::TaskRunner.for(ctx, script_project.language, script_project.script_name)
11
11
  ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
12
- BuildScript.call(
13
- ctx: ctx,
14
- task_runner: task_runner,
15
- extension_point_type: script_project.extension_point_type,
16
- script_name: script_project.script_name,
17
- description: script_project.description
18
- )
12
+ BuildScript.call(ctx: ctx, task_runner: task_runner, script_project: script_project)
19
13
 
20
- UI::PrintingSpinner.spin(ctx, ctx.message('script.application.pushing')) do |p_ctx, spinner|
14
+ UI::PrintingSpinner.spin(ctx, ctx.message("script.application.pushing")) do |p_ctx, spinner|
21
15
  package = Infrastructure::PushPackageRepository.new(ctx: p_ctx).get_push_package(
22
- extension_point_type: script_project.extension_point_type,
23
- script_name: script_project.script_name,
24
- description: script_project.description,
16
+ script_project: script_project,
25
17
  compiled_type: task_runner.compiled_type,
26
18
  metadata: task_runner.metadata
27
19
  )
28
20
  package.push(Infrastructure::ScriptService.new(ctx: p_ctx), script_project.api_key, force)
29
- spinner.update_title(p_ctx.message('script.application.pushed'))
21
+ spinner.update_title(p_ctx.message("script.application.pushed"))
30
22
  end
31
23
  end
32
24
  end
@@ -8,6 +8,7 @@ module Script
8
8
  :extension_point_type,
9
9
  :script_name,
10
10
  :description,
11
+ :config_ui,
11
12
  :script_content,
12
13
  :compiled_type,
13
14
  :metadata
@@ -19,7 +20,8 @@ module Script
19
20
  description:,
20
21
  script_content:,
21
22
  compiled_type:,
22
- metadata:
23
+ metadata:,
24
+ config_ui:
23
25
  )
24
26
  @id = id
25
27
  @extension_point_type = extension_point_type
@@ -28,6 +30,7 @@ module Script
28
30
  @script_content = script_content
29
31
  @compiled_type = compiled_type
30
32
  @metadata = metadata
33
+ @config_ui = config_ui
31
34
  end
32
35
 
33
36
  def push(script_service, api_key, force)
@@ -40,6 +43,7 @@ module Script
40
43
  api_key: api_key,
41
44
  force: force,
42
45
  metadata: @metadata,
46
+ config_ui: @config_ui,
43
47
  )
44
48
  end
45
49
  end
@@ -19,7 +19,7 @@ module Script
19
19
  end
20
20
 
21
21
  def bootstrap
22
- type = extension_point.type.gsub('_', '-')
22
+ type = extension_point.type.gsub("_", "-")
23
23
  out, status = ctx.capture2e(format(BOOTSTRAP, extension_point: type, base: path_to_project))
24
24
  raise Domain::Errors::ServiceFailureError, out unless status.success?
25
25
  end
@@ -28,10 +28,10 @@ module Script
28
28
 
29
29
  def write_npmrc
30
30
  ctx.system(
31
- 'npm', '--userconfig', './.npmrc', 'config', 'set', '@shopify:registry', 'https://registry.npmjs.com'
31
+ "npm", "--userconfig", "./.npmrc", "config", "set", "@shopify:registry", "https://registry.npmjs.com"
32
32
  )
33
33
  ctx.system(
34
- 'npm', '--userconfig', './.npmrc', 'config', 'set', 'engine-strict', 'true'
34
+ "npm", "--userconfig", "./.npmrc", "config", "set", "engine-strict", "true"
35
35
  )
36
36
  end
37
37
 
@@ -40,7 +40,7 @@ module Script
40
40
 
41
41
  def metadata
42
42
  unless @ctx.file_exist?(METADATA_FILE)
43
- msg = @ctx.message('script.error.metadata_not_found_cause', METADATA_FILE)
43
+ msg = @ctx.message("script.error.metadata_not_found_cause", METADATA_FILE)
44
44
  raise Domain::Errors::MetadataNotFoundError, msg
45
45
  end
46
46
 
@@ -54,7 +54,7 @@ module Script
54
54
  output, status = @ctx.capture2e("node", "--version")
55
55
  raise Errors::DependencyInstallError, output unless status.success?
56
56
 
57
- require 'semantic/semantic'
57
+ require "semantic/semantic"
58
58
  version = ::Semantic::Version.new(output[1..-1])
59
59
  unless version >= ::Semantic::Version.new(AssemblyScriptProjectCreator::MIN_NODE_VERSION)
60
60
  raise Errors::DependencyInstallError,
@@ -71,8 +71,8 @@ module Script
71
71
  end
72
72
 
73
73
  def check_compilation_dependencies!
74
- pkg = JSON.parse(File.read('package.json'))
75
- build_script = pkg.dig('scripts', 'build')
74
+ pkg = JSON.parse(File.read("package.json"))
75
+ build_script = pkg.dig("scripts", "build")
76
76
 
77
77
  raise Errors::BuildScriptNotFoundError,
78
78
  "Build script not found" if build_script.nil?
@@ -93,23 +93,23 @@ module Script
93
93
  end
94
94
 
95
95
  def check_if_ep_dependencies_up_to_date!
96
- return true if ENV['SHOPIFY_CLI_SCRIPTS_IGNORE_OUTDATED']
96
+ return true if ENV["SHOPIFY_CLI_SCRIPTS_IGNORE_OUTDATED"]
97
97
 
98
98
  # ignore exit code since it will not be 0 unless every package is up to date which they probably won't be
99
99
  out, _ = ctx.capture2e("npm", "outdated", "--json", "--depth", "0")
100
100
  parsed_outdated_check = JSON.parse(out)
101
101
  outdated_ep_packages = parsed_outdated_check
102
- .select { |package_name, _| package_name.start_with?('@shopify/extension-point-as-') }
102
+ .select { |package_name, _| package_name.start_with?("@shopify/extension-point-as-") }
103
103
  .select { |_, version_info| !package_is_up_to_date?(version_info) }
104
104
  .keys
105
105
  raise Errors::PackagesOutdatedError.new(outdated_ep_packages),
106
- "NPM packages out of date: #{outdated_ep_packages.join(', ')}" unless outdated_ep_packages.empty?
106
+ "NPM packages out of date: #{outdated_ep_packages.join(", ")}" unless outdated_ep_packages.empty?
107
107
  end
108
108
 
109
109
  def package_is_up_to_date?(version_info)
110
- require 'semantic/semantic'
111
- current_version = version_info['current']
112
- latest_version = version_info['latest']
110
+ require "semantic/semantic"
111
+ current_version = version_info["current"]
112
+ latest_version = version_info["latest"]
113
113
 
114
114
  # making an assumption that the script developer knows what they're doing if they're not referencing a
115
115
  # semver version