shopify-cli 2.7.3 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +44 -0
  4. data/Gemfile.lock +1 -1
  5. data/RELEASING.md +4 -3
  6. data/dev.yml +2 -2
  7. data/ext/javy/javy.rb +8 -9
  8. data/lib/graphql/get_extension_registrations.graphql +27 -0
  9. data/lib/project_types/extension/cli.rb +27 -2
  10. data/lib/project_types/extension/commands/build.rb +10 -10
  11. data/lib/project_types/extension/commands/create.rb +2 -3
  12. data/lib/project_types/extension/commands/push.rb +36 -8
  13. data/lib/project_types/extension/extension_project.rb +1 -1
  14. data/lib/project_types/extension/features/argo_serve.rb +6 -5
  15. data/lib/project_types/extension/forms/questions/ask_registration.rb +6 -2
  16. data/lib/project_types/extension/loaders/project.rb +29 -0
  17. data/lib/project_types/extension/loaders/specification_handler.rb +22 -0
  18. data/lib/project_types/extension/messages/messages.rb +4 -0
  19. data/lib/project_types/extension/models/app.rb +1 -1
  20. data/lib/project_types/extension/models/development_server.rb +2 -4
  21. data/lib/project_types/extension/models/specification_handlers/default.rb +4 -0
  22. data/lib/project_types/extension/tasks/convert_server_config.rb +3 -1
  23. data/lib/project_types/extension/tasks/execute_commands/base.rb +13 -0
  24. data/lib/project_types/extension/tasks/execute_commands/build.rb +29 -0
  25. data/lib/project_types/extension/tasks/execute_commands/create.rb +33 -0
  26. data/lib/project_types/extension/tasks/execute_commands/serve.rb +35 -0
  27. data/lib/project_types/extension/tasks/merge_server_config.rb +33 -22
  28. data/lib/project_types/rails/gem.rb +1 -2
  29. data/lib/project_types/script/cli.rb +7 -0
  30. data/lib/project_types/script/commands/connect.rb +19 -0
  31. data/lib/project_types/script/commands/create.rb +8 -2
  32. data/lib/project_types/script/commands/push.rb +35 -12
  33. data/lib/project_types/script/layers/application/connect_app.rb +15 -3
  34. data/lib/project_types/script/layers/application/create_script.rb +16 -16
  35. data/lib/project_types/script/layers/application/extension_points.rb +50 -26
  36. data/lib/project_types/script/layers/application/push_script.rb +5 -2
  37. data/lib/project_types/script/layers/domain/errors.rb +3 -2
  38. data/lib/project_types/script/layers/domain/extension_point.rb +14 -0
  39. data/lib/project_types/script/layers/domain/script_config.rb +6 -4
  40. data/lib/project_types/script/layers/infrastructure/errors.rb +38 -23
  41. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +49 -28
  42. data/lib/project_types/script/layers/infrastructure/script_service.rb +22 -5
  43. data/lib/project_types/script/loaders/project.rb +44 -0
  44. data/lib/project_types/script/loaders/specification_handler.rb +22 -0
  45. data/lib/project_types/script/messages/messages.rb +39 -16
  46. data/lib/project_types/script/ui/error_handler.rb +46 -29
  47. data/lib/project_types/theme/commands/pull.rb +45 -17
  48. data/lib/project_types/theme/commands/push.rb +65 -28
  49. data/lib/project_types/theme/commands/serve.rb +5 -0
  50. data/lib/project_types/theme/messages/messages.rb +34 -18
  51. data/lib/shopify_cli/command.rb +6 -0
  52. data/lib/shopify_cli/commands/login.rb +1 -1
  53. data/lib/shopify_cli/commands/switch.rb +1 -1
  54. data/lib/shopify_cli/constants.rb +11 -2
  55. data/lib/shopify_cli/context.rb +66 -12
  56. data/lib/shopify_cli/core/executor.rb +4 -4
  57. data/lib/shopify_cli/environment.rb +50 -20
  58. data/lib/shopify_cli/form.rb +2 -0
  59. data/lib/shopify_cli/identity_auth.rb +4 -3
  60. data/lib/shopify_cli/messages/messages.rb +9 -1
  61. data/lib/shopify_cli/method_object.rb +21 -9
  62. data/lib/shopify_cli/partners_api/app_extensions/job.rb +36 -0
  63. data/lib/shopify_cli/partners_api/app_extensions.rb +46 -0
  64. data/lib/shopify_cli/partners_api/organizations.rb +2 -5
  65. data/lib/shopify_cli/partners_api.rb +1 -0
  66. data/lib/shopify_cli/project.rb +8 -7
  67. data/lib/shopify_cli/resources/env_file.rb +18 -6
  68. data/lib/shopify_cli/result.rb +61 -59
  69. data/lib/shopify_cli/task.rb +5 -3
  70. data/lib/shopify_cli/theme/dev_server/cdn/cdn_helper.rb +49 -0
  71. data/lib/shopify_cli/theme/dev_server/cdn_assets.rb +69 -0
  72. data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +8 -28
  73. data/lib/shopify_cli/theme/dev_server/hot-reload.js +34 -3
  74. data/lib/shopify_cli/theme/dev_server/hot_reload.rb +18 -2
  75. data/lib/shopify_cli/theme/dev_server/local_assets.rb +4 -0
  76. data/lib/shopify_cli/theme/dev_server/proxy/template_param_builder.rb +84 -0
  77. data/lib/shopify_cli/theme/dev_server/proxy.rb +10 -15
  78. data/lib/shopify_cli/theme/dev_server/reload_mode.rb +34 -0
  79. data/lib/shopify_cli/theme/dev_server.rb +8 -21
  80. data/lib/shopify_cli/theme/file.rb +2 -2
  81. data/lib/shopify_cli/theme/filter/path_matcher.rb +38 -0
  82. data/lib/shopify_cli/theme/ignore_filter.rb +14 -18
  83. data/lib/shopify_cli/theme/include_filter.rb +43 -0
  84. data/lib/shopify_cli/theme/syncer.rb +17 -2
  85. data/lib/shopify_cli/theme/theme.rb +26 -4
  86. data/lib/shopify_cli/thread_pool/job.rb +27 -0
  87. data/lib/shopify_cli/thread_pool.rb +37 -0
  88. data/lib/shopify_cli/version.rb +1 -1
  89. data/lib/shopify_cli.rb +6 -1
  90. data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +3 -1
  91. data/vendor/deps/ruby2_keywords/LICENSE +22 -0
  92. data/vendor/deps/ruby2_keywords/README.md +67 -0
  93. data/vendor/deps/ruby2_keywords/Rakefile +54 -0
  94. data/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +57 -0
  95. data/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +18 -0
  96. data/vendor/deps/ruby2_keywords/test/test_keyword.rb +41 -0
  97. metadata +28 -4
  98. data/lib/graphql/all_orgs_with_extensions.graphql +0 -37
  99. data/lib/project_types/extension/tasks/run_extension_command.rb +0 -82
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ require "shopify_cli"
3
+
4
+ module Extension
5
+ module Tasks
6
+ module ExecuteCommands
7
+ class Serve < Base
8
+ property! :context, accepts: ShopifyCLI::Context
9
+ property! :config_file_path, accepts: String
10
+ property :port, accepts: Integer, default: ShopifyCLI::Constants::Extension::DEFAULT_PORT
11
+ property :resource_url, accepts: String
12
+ property! :tunnel_url, accepts: String
13
+
14
+ def call
15
+ ShopifyCLI::Result
16
+ .call(&method(:merge_server_config))
17
+ .then { |server_config| Models::DevelopmentServer.new.serve(context, server_config) }
18
+ end
19
+
20
+ private
21
+
22
+ def merge_server_config
23
+ Tasks::MergeServerConfig.call(
24
+ context: context,
25
+ file_path: config_file_path,
26
+ port: port,
27
+ resource_url: resource_url,
28
+ tunnel_url: tunnel_url,
29
+ type: type
30
+ )
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -4,28 +4,39 @@ require "yaml"
4
4
 
5
5
  module Extension
6
6
  module Tasks
7
- class MergeServerConfig < ShopifyCLI::Task
8
- class << self
9
- def call(context:, file_name:, resource_url:, tunnel_url:, type:)
10
- config = YAML.load_file(file_name)
11
- project = ExtensionProject.current
12
- Tasks::ConvertServerConfig.call(
13
- api_key: project.env.api_key,
14
- context: context,
15
- hash: config,
16
- registration_uuid: project.registration_uuid,
17
- resource_url: resource_url || project.resource_url,
18
- store: project.env.shop || "",
19
- title: project.title,
20
- tunnel_url: tunnel_url,
21
- type: type
22
- )
23
- rescue Psych::SyntaxError => e
24
- raise(
25
- ShopifyCLI::Abort,
26
- ShopifyCLI::Context.message("core.yaml.error.invalid", file_name, e.message)
27
- )
28
- end
7
+ class MergeServerConfig
8
+ include SmartProperties
9
+
10
+ property! :context, accepts: ShopifyCLI::Context
11
+ property! :file_path, accepts: ->(path) { Pathname(path).yield_self { |pn| pn.absolute? && pn.file? } }
12
+ property :port, accepts: Integer, default: ShopifyCLI::Constants::Extension::DEFAULT_PORT
13
+ property :resource_url, accepts: String
14
+ property :tunnel_url, accepts: String
15
+ property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
16
+
17
+ def self.call(*args)
18
+ new(*args).call
19
+ end
20
+
21
+ def call
22
+ config = YAML.load_file(file_path)
23
+ project = ExtensionProject.current
24
+ Tasks::ConvertServerConfig.call(
25
+ api_key: project.env.api_key,
26
+ context: context,
27
+ hash: config,
28
+ registration_uuid: project.registration_uuid,
29
+ resource_url: resource_url || project.resource_url,
30
+ store: project.env.shop || "",
31
+ title: project.title,
32
+ tunnel_url: tunnel_url,
33
+ type: type
34
+ )
35
+ rescue Psych::SyntaxError => e
36
+ raise(
37
+ ShopifyCLI::Abort,
38
+ ShopifyCLI::Context.message("core.yaml.error.invalid", file_name, e.message)
39
+ )
29
40
  end
30
41
  end
31
42
  end
@@ -79,8 +79,7 @@ module Rails
79
79
  def install!
80
80
  spin = CLI::UI::SpinGroup.new
81
81
  spin.add(ctx.message("rails.gem.installing", name)) do |spinner|
82
- args = %w(gem install)
83
- args.push(name)
82
+ args = ["#{ENV["RUBY_BINDIR"]}gem", "install", name]
84
83
  unless version.nil?
85
84
  if ctx.windows? && version.include?("~")
86
85
  args.push("-v", "\"#{version}\"")
@@ -13,6 +13,7 @@ module Script
13
13
  hidden_feature(feature_set: :script_project)
14
14
  subcommand :Create, "create", Project.project_filepath("commands/create")
15
15
  subcommand :Push, "push", Project.project_filepath("commands/push")
16
+ subcommand :Connect, "connect", Project.project_filepath("commands/connect")
16
17
  subcommand :Javy, "javy", Project.project_filepath("commands/javy")
17
18
  end
18
19
  ShopifyCLI::Commands.register("Script::Command", "script")
@@ -24,6 +25,7 @@ module Script
24
25
  autoload :AskScriptUuid, Project.project_filepath("forms/ask_script_uuid")
25
26
  autoload :RunAgainstShopifyOrg, Project.project_filepath("forms/run_against_shopify_org")
26
27
  autoload :Create, Project.project_filepath("forms/create")
28
+ autoload :Connect, Project.project_filepath("forms/connect")
27
29
  autoload :ScriptForm, Project.project_filepath("forms/script_form")
28
30
  end
29
31
 
@@ -90,5 +92,10 @@ module Script
90
92
 
91
93
  autoload :Errors, Project.project_filepath("errors")
92
94
 
95
+ module Loaders
96
+ autoload :Project, Script::Project.project_filepath("loaders/project")
97
+ autoload :SpecificationHandler, Script::Project.project_filepath("loaders/specification_handler")
98
+ end
99
+
93
100
  class ScriptProjectError < StandardError; end
94
101
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ module Script
3
+ class Command
4
+ class Connect < ShopifyCLI::Command::SubCommand
5
+ prerequisite_task :ensure_authenticated
6
+ prerequisite_task ensure_project_type: :script
7
+
8
+ def call(_args, _)
9
+ Layers::Application::ConnectApp.call(ctx: @ctx, force: true)
10
+ rescue StandardError => e
11
+ UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.connect.error.operation_failed"))
12
+ end
13
+
14
+ def self.help
15
+ ShopifyCLI::Context.new.message("connect.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -33,8 +33,14 @@ module Script
33
33
  end
34
34
 
35
35
  def self.help
36
- allowed_values = Script::Layers::Application::ExtensionPoints.available_types.map { |type| "{{cyan:#{type}}}" }
37
- ShopifyCLI::Context.message("script.create.help", ShopifyCLI::TOOL_NAME, allowed_values.join(", "))
36
+ allowed_apis = Layers::Application::ExtensionPoints.available_types.map { |type| "{{cyan:#{type}}}" }
37
+ allowed_languages = Layers::Application::ExtensionPoints.all_languages.map { |lang| "{{cyan:#{lang}}}" }
38
+ ShopifyCLI::Context.message(
39
+ "script.create.help",
40
+ ShopifyCLI::TOOL_NAME,
41
+ allowed_apis.join(", "),
42
+ allowed_languages.join(", ")
43
+ )
38
44
  end
39
45
  end
40
46
  end
@@ -7,25 +7,48 @@ module Script
7
7
 
8
8
  options do |parser, flags|
9
9
  parser.on("--force") { |t| flags[:force] = t }
10
+ parser.on("--api-key=API_KEY") { |api_key| flags[:api_key] = api_key.gsub('"', "") }
11
+ parser.on("--api-secret=API_SECRET") { |api_secret| flags[:api_secret] = api_secret.gsub('"', "") }
12
+ parser.on("--uuid=UUID") do |uuid|
13
+ flags[:uuid] = uuid.gsub('""', "")
14
+ end
10
15
  end
11
16
 
12
17
  def call(_args, _name)
13
- fresh_env = Layers::Application::ConnectApp.call(ctx: @ctx)
14
-
15
- force = options.flags.key?(:force) || !!fresh_env
18
+ connect_to_app
19
+ project = load_project
20
+ push(project: project)
21
+ rescue StandardError => e
22
+ UI::ErrorHandler.pretty_print_and_raise(e,
23
+ failed_op: @ctx.message("script.push.error.operation_failed_no_api_key"))
24
+ end
16
25
 
17
- api_key = Layers::Infrastructure::ScriptProjectRepository.new(ctx: @ctx).get.api_key
18
- return @ctx.puts(self.class.help) unless api_key
26
+ def push(project:)
27
+ force = options.flags.key?(:force)
28
+ api_key = project.env[:api_key]
29
+ uuid = project.env[:extra]["UUID"]
19
30
 
20
- Layers::Application::PushScript.call(ctx: @ctx, force: force)
21
- @ctx.puts(@ctx.message("script.push.script_pushed", api_key: api_key))
22
- rescue StandardError => e
23
- msg = if api_key
24
- @ctx.message("script.push.error.operation_failed_with_api_key", api_key: api_key)
31
+ if ShopifyCLI::Environment.interactive? || (uuid && !uuid.empty?)
32
+ Layers::Application::PushScript.call(ctx: @ctx, force: force, project: project)
33
+ @ctx.puts(@ctx.message("script.push.script_pushed", api_key: api_key))
25
34
  else
26
- @ctx.message("script.push.error.operation_failed_no_api_key")
35
+ raise ShopifyCLI::Abort, @ctx.message("script.push.error.operation_failed_no_uuid")
36
+ end
37
+ end
38
+
39
+ def load_project
40
+ Script::Loaders::Project.load(
41
+ directory: Dir.pwd,
42
+ api_key: options.flags[:api_key],
43
+ api_secret: options.flags[:api_secret],
44
+ uuid: options.flags[:uuid]
45
+ )
46
+ end
47
+
48
+ def connect_to_app
49
+ if ShopifyCLI::Environment.interactive?
50
+ Layers::Application::ConnectApp.call(ctx: @ctx)
27
51
  end
28
- UI::ErrorHandler.pretty_print_and_raise(e, failed_op: msg)
29
52
  end
30
53
 
31
54
  def self.help
@@ -7,10 +7,11 @@ module Script
7
7
  module Application
8
8
  class ConnectApp
9
9
  class << self
10
- def call(ctx:)
10
+ def call(ctx:, force: false)
11
11
  script_project_repo = Layers::Infrastructure::ScriptProjectRepository.new(ctx: ctx)
12
12
  script_project = script_project_repo.get
13
- return false if script_project.env_valid?
13
+
14
+ return false if script_project.env_valid? && !force
14
15
 
15
16
  if ShopifyCLI::Shopifolk.check && Forms::RunAgainstShopifyOrg.ask(ctx, nil, nil).response
16
17
  ShopifyCLI::Shopifolk.act_as_shopify_organization
@@ -37,15 +38,26 @@ module Script
37
38
  extension_point_type = script_project.extension_point_type
38
39
  scripts = script_service.get_app_scripts(extension_point_type: extension_point_type)
39
40
 
40
- uuid = Forms::AskScriptUuid.ask(ctx, scripts, nil).uuid
41
+ uuid = Forms::AskScriptUuid.ask(ctx, scripts, nil)&.uuid
41
42
 
42
43
  script_project_repo.create_env(
43
44
  api_key: app["apiKey"],
44
45
  secret: app["apiSecretKeys"].first["secret"],
45
46
  uuid: uuid
46
47
  )
48
+ ctx.done(ctx.message("script.connect.connected", app["title"]))
47
49
 
48
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
+ raise ShopifyCLI::Abort,
59
+ context.message("script.connect.error.missing_env_file_variables", missing_env_variables,
60
+ ShopifyCLI::TOOL_NAME)
49
61
  end
50
62
 
51
63
  private
@@ -8,11 +8,14 @@ module Script
8
8
  class CreateScript
9
9
  class << self
10
10
  def call(ctx:, language:, sparse_checkout_branch:, script_name:, extension_point_type:)
11
- raise Infrastructure::Errors::ScriptProjectAlreadyExistsError, script_name if ctx.dir_exist?(script_name)
11
+ script_project_repo = Infrastructure::ScriptProjectRepository.new(
12
+ ctx: ctx,
13
+ directory: script_name,
14
+ initial_directory: ctx.root
15
+ )
12
16
 
13
- in_new_directory_context(ctx, script_name) do
17
+ in_new_directory_context(script_project_repo) do
14
18
  extension_point = ExtensionPoints.get(type: extension_point_type)
15
- script_project_repo = Infrastructure::ScriptProjectRepository.new(ctx: ctx)
16
19
  project = script_project_repo.create(
17
20
  script_name: script_name,
18
21
  extension_point_type: extension_point_type,
@@ -62,19 +65,16 @@ module Script
62
65
  ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
63
66
  end
64
67
 
65
- def in_new_directory_context(ctx, directory)
66
- initial_directory = ctx.root
67
- begin
68
- ctx.mkdir_p(directory)
69
- ctx.chdir(directory)
70
- yield
71
- rescue
72
- ctx.chdir(initial_directory)
73
- ctx.rm_r(directory)
74
- raise
75
- ensure
76
- ctx.chdir(initial_directory)
77
- end
68
+ def in_new_directory_context(script_project_repo)
69
+ script_project_repo.create_project_directory
70
+ yield
71
+ rescue Infrastructure::Errors::ScriptProjectAlreadyExistsError
72
+ raise
73
+ rescue
74
+ script_project_repo.delete_project_directory
75
+ raise
76
+ ensure
77
+ script_project_repo.change_to_initial_directory
78
78
  end
79
79
  end
80
80
  end
@@ -4,37 +4,61 @@ module Script
4
4
  module Layers
5
5
  module Application
6
6
  class ExtensionPoints
7
- def self.get(type:)
8
- Infrastructure::ExtensionPointRepository.new.get_extension_point(type)
9
- end
7
+ class << self
8
+ def get(type:)
9
+ extension_point_repository.get_extension_point(type)
10
+ end
10
11
 
11
- def self.types
12
- Infrastructure::ExtensionPointRepository.new.extension_point_types
13
- end
12
+ def types
13
+ extension_point_repository.extension_point_types
14
+ end
14
15
 
15
- def self.available_types
16
- Infrastructure::ExtensionPointRepository.new.extension_points.select do |ep|
17
- next false if ep.deprecated?
18
- !ep.beta? || ShopifyCLI::Feature.enabled?(:scripts_beta_extension_points)
19
- end.map(&:type)
20
- end
16
+ def available_types
17
+ available_extension_points.map(&:type)
18
+ end
21
19
 
22
- def self.deprecated_types
23
- Infrastructure::ExtensionPointRepository.new
24
- .extension_points
25
- .select(&:deprecated?)
26
- .map(&:type)
27
- end
20
+ def deprecated_types
21
+ extension_point_repository
22
+ .extension_points
23
+ .select(&:deprecated?)
24
+ .map(&:type)
25
+ end
28
26
 
29
- def self.languages(type:)
30
- get(type: type).libraries.all.map do |library|
31
- next nil if library.beta? && !ShopifyCLI::Feature.enabled?(:scripts_beta_languages)
32
- library.language
33
- end.compact
34
- end
27
+ def all_languages
28
+ available_extension_points
29
+ .map { |ep| ep.library_languages(include_betas: include_beta_languages?) }
30
+ .flatten
31
+ .uniq
32
+ end
33
+
34
+ def languages(type:)
35
+ get(type: type).library_languages(include_betas: include_beta_languages?)
36
+ end
37
+
38
+ def supported_language?(type:, language:)
39
+ languages(type: type).include?(language.downcase)
40
+ end
41
+
42
+ private
43
+
44
+ def available_extension_points
45
+ extension_point_repository.extension_points.select do |ep|
46
+ next false if ep.deprecated?
47
+ ep.stable? || include_beta_extension_points?
48
+ end
49
+ end
50
+
51
+ def extension_point_repository
52
+ Infrastructure::ExtensionPointRepository.new
53
+ end
54
+
55
+ def include_beta_languages?
56
+ ShopifyCLI::Feature.enabled?(:scripts_beta_languages)
57
+ end
35
58
 
36
- def self.supported_language?(type:, language:)
37
- languages(type: type).include?(language.downcase)
59
+ def include_beta_extension_points?
60
+ ShopifyCLI::Feature.enabled?(:scripts_beta_extension_points)
61
+ end
38
62
  end
39
63
  end
40
64
  end
@@ -5,9 +5,10 @@ module Script
5
5
  module Application
6
6
  class PushScript
7
7
  class << self
8
- def call(ctx:, force:)
8
+ def call(ctx:, force:, project:)
9
9
  script_project_repo = Infrastructure::ScriptProjectRepository.new(ctx: ctx)
10
10
  script_project = script_project_repo.get
11
+ script_project.env = project.env
11
12
  task_runner = Infrastructure::Languages::TaskRunner
12
13
  .for(ctx, script_project.language, script_project.script_name)
13
14
 
@@ -47,7 +48,9 @@ module Script
47
48
  module_upload_url: module_upload_url,
48
49
  library: package.library,
49
50
  )
50
- script_project_repo.update_env(uuid: uuid)
51
+ if ShopifyCLI::Environment.interactive?
52
+ script_project_repo.update_env(uuid: uuid)
53
+ end
51
54
  spinner.update_title(p_ctx.message("script.application.pushed"))
52
55
  end
53
56
  end
@@ -15,10 +15,11 @@ module Script
15
15
  end
16
16
 
17
17
  class MissingScriptConfigFieldError < ScriptProjectError
18
- attr_reader :field
19
- def initialize(field)
18
+ attr_reader :field, :filename
19
+ def initialize(field:, filename:)
20
20
  super()
21
21
  @field = field
22
+ @filename = filename
22
23
  end
23
24
  end
24
25
 
@@ -18,6 +18,10 @@ module Script
18
18
  @beta
19
19
  end
20
20
 
21
+ def stable?
22
+ !beta?
23
+ end
24
+
21
25
  def deprecated?
22
26
  @deprecated
23
27
  end
@@ -26,6 +30,12 @@ module Script
26
30
  @type.gsub("_", "-")
27
31
  end
28
32
 
33
+ def library_languages(include_betas: false)
34
+ @libraries.all.map do |library|
35
+ include_betas || library.stable? ? library.language : nil
36
+ end.compact
37
+ end
38
+
29
39
  class ExtensionPointLibraries
30
40
  def initialize(config)
31
41
  @config = config
@@ -57,6 +67,10 @@ module Script
57
67
  @beta
58
68
  end
59
69
 
70
+ def stable?
71
+ !beta?
72
+ end
73
+
60
74
  def versioned?
61
75
  @version
62
76
  end
@@ -4,13 +4,13 @@ module Script
4
4
  module Layers
5
5
  module Domain
6
6
  class ScriptConfig
7
- attr_reader :content, :version, :title, :description, :configuration_ui, :configuration
7
+ attr_reader :content, :version, :title, :description, :configuration_ui, :configuration, :filename
8
8
 
9
9
  REQUIRED_FIELDS = %w(version title)
10
10
 
11
- def initialize(content:)
11
+ def initialize(content:, filename:)
12
+ @filename = filename
12
13
  validate_content!(content)
13
-
14
14
  @content = content
15
15
  @version = @content["version"].to_s
16
16
  @title = @content["title"]
@@ -23,7 +23,9 @@ module Script
23
23
 
24
24
  def validate_content!(content)
25
25
  REQUIRED_FIELDS.each do |field|
26
- raise Errors::MissingScriptConfigFieldError, field if content[field].nil?
26
+ if content[field].nil?
27
+ raise Errors::MissingScriptConfigFieldError.new(field: field, filename: filename)
28
+ end
27
29
  end
28
30
  end
29
31
  end
@@ -5,63 +5,78 @@ module Script
5
5
  module Infrastructure
6
6
  module Errors
7
7
  class BuildError < ScriptProjectError; end
8
- class ScriptConfigSyntaxError < ScriptProjectError; end
8
+
9
+ class ScriptConfigurationDefinitionError < ScriptProjectError
10
+ attr_reader :filename
11
+ def initialize(message:, filename:)
12
+ @filename = filename
13
+ super(message)
14
+ end
15
+ end
16
+
17
+ class ScriptConfigSyntaxError < ScriptProjectError
18
+ attr_reader :filename
19
+ def initialize(filename)
20
+ @filename = filename
21
+ super()
22
+ end
23
+ end
9
24
 
10
25
  class ScriptConfigMissingKeysError < ScriptProjectError
11
- attr_reader :missing_keys
12
- def initialize(missing_keys)
26
+ attr_reader :missing_keys, :filename
27
+ def initialize(missing_keys:, filename:)
13
28
  super()
14
29
  @missing_keys = missing_keys
30
+ @filename = filename
15
31
  end
16
32
  end
17
33
 
18
34
  class ScriptConfigInvalidValueError < ScriptProjectError
19
- attr_reader :valid_input_modes
20
- def initialize(valid_input_modes)
35
+ attr_reader :valid_input_modes, :filename
36
+ def initialize(valid_input_modes:, filename:)
21
37
  super()
22
38
  @valid_input_modes = valid_input_modes
39
+ @filename = filename
23
40
  end
24
41
  end
25
42
 
26
43
  class ScriptConfigFieldsMissingKeysError < ScriptProjectError
27
- attr_reader :missing_keys
28
- def initialize(missing_keys)
44
+ attr_reader :missing_keys, :filename
45
+ def initialize(missing_keys:, filename:)
29
46
  super()
30
47
  @missing_keys = missing_keys
48
+ @filename = filename
31
49
  end
32
50
  end
33
51
 
34
52
  class ScriptConfigFieldsInvalidValueError < ScriptProjectError
35
- attr_reader :valid_types
36
- def initialize(valid_types)
53
+ attr_reader :valid_types, :filename
54
+ def initialize(valid_types:, filename:)
37
55
  super()
38
56
  @valid_types = valid_types
57
+ @filename = filename
39
58
  end
40
59
  end
41
60
 
42
- class InvalidScriptConfigYmlDefinitionError < ScriptProjectError; end
61
+ class ScriptEnvAppNotConnectedError < ScriptProjectError; end
43
62
 
44
- class InvalidScriptJsonDefinitionError < ScriptProjectError; end
45
-
46
- class MissingScriptConfigYmlFieldError < ScriptProjectError
47
- attr_reader :field
48
- def initialize(field)
63
+ class ScriptConfigParseError < ScriptProjectError
64
+ attr_reader :filename, :serialization_format
65
+ def initialize(filename:, serialization_format:)
49
66
  super()
50
- @field = field
67
+ @filename = filename
68
+ @serialization_format = serialization_format
51
69
  end
52
70
  end
53
71
 
54
- class MissingScriptJsonFieldError < ScriptProjectError
55
- attr_reader :field
56
- def initialize(field)
72
+ class NoScriptConfigFileError < ScriptProjectError
73
+ attr_reader :filename
74
+ def initialize(filename)
57
75
  super()
58
- @field = field
76
+ @filename = filename
59
77
  end
60
78
  end
61
79
 
62
- class NoScriptConfigYmlFileError < ScriptProjectError; end
63
- class NoScriptConfigFileError < ScriptProjectError; end
64
-
65
80
  class APILibraryNotFoundError < ScriptProjectError
66
81
  attr_reader :library_name
67
82
  def initialize(library_name)