shopify-cli 2.9.0 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -2
  3. data/Gemfile.lock +1 -1
  4. data/lib/project_types/script/layers/domain/errors.rb +3 -2
  5. data/lib/project_types/script/layers/domain/script_config.rb +6 -4
  6. data/lib/project_types/script/layers/infrastructure/errors.rb +37 -24
  7. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +28 -28
  8. data/lib/project_types/script/layers/infrastructure/script_service.rb +22 -5
  9. data/lib/project_types/script/messages/messages.rb +15 -17
  10. data/lib/project_types/script/ui/error_handler.rb +41 -29
  11. data/lib/project_types/theme/commands/pull.rb +6 -1
  12. data/lib/project_types/theme/commands/push.rb +6 -1
  13. data/lib/project_types/theme/messages/messages.rb +4 -0
  14. data/lib/shopify_cli/commands/login.rb +4 -10
  15. data/lib/shopify_cli/constants.rb +6 -2
  16. data/lib/shopify_cli/core/executor.rb +4 -4
  17. data/lib/shopify_cli/environment.rb +35 -16
  18. data/lib/shopify_cli/identity_auth.rb +3 -3
  19. data/lib/shopify_cli/messages/messages.rb +1 -1
  20. data/lib/shopify_cli/method_object.rb +21 -9
  21. data/lib/shopify_cli/result.rb +61 -59
  22. data/lib/shopify_cli/task.rb +5 -3
  23. data/lib/shopify_cli/theme/dev_server/cdn/cdn_helper.rb +49 -0
  24. data/lib/shopify_cli/theme/dev_server/cdn_assets.rb +69 -0
  25. data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +8 -28
  26. data/lib/shopify_cli/theme/dev_server/local_assets.rb +4 -0
  27. data/lib/shopify_cli/theme/dev_server.rb +2 -0
  28. data/lib/shopify_cli/theme/file.rb +2 -2
  29. data/lib/shopify_cli/theme/filter/path_matcher.rb +38 -0
  30. data/lib/shopify_cli/theme/ignore_filter.rb +14 -18
  31. data/lib/shopify_cli/theme/include_filter.rb +43 -0
  32. data/lib/shopify_cli/theme/syncer.rb +17 -2
  33. data/lib/shopify_cli/version.rb +1 -1
  34. data/lib/shopify_cli.rb +2 -1
  35. data/vendor/deps/ruby2_keywords/LICENSE +22 -0
  36. data/vendor/deps/ruby2_keywords/README.md +67 -0
  37. data/vendor/deps/ruby2_keywords/Rakefile +54 -0
  38. data/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +57 -0
  39. data/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +18 -0
  40. data/vendor/deps/ruby2_keywords/test/test_keyword.rb +41 -0
  41. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3126bd5c9f4667732d248380f29b84fcac3bab1e3c944748b18dd3b0a639301d
4
- data.tar.gz: 8c6ffbcf72d7360e227178f970c63a6041ee6c7f61b0ea22a9d6747f163f5b6b
3
+ metadata.gz: a580fc4c23a82fc147e126d1f2cc4b057e5194e75e9c3045e2fa26c97f3d88da
4
+ data.tar.gz: 7cd7c21a2bac85a9f0bd3809acfb2ae7389f99be65e34e4411cb4fc4bc6235e8
5
5
  SHA512:
6
- metadata.gz: 2a21a55b5b258fa6c5037fff6652c43ba09a207e7f2b313b52a950b7a1d221e41d7edf719ce66c089200c1f2fba577e412fb985420c872ee83a4d40ef0cd05be
7
- data.tar.gz: 338348f5e2220ef8b307e619981cc16985f012ecafc09c2d2eb232c2639ca65a11df12249f0d64fea5839b9015e1e31f0617eae84b82b4e530df587969b5fcc8
6
+ metadata.gz: 8ef4d2ddcb62c393d7ad69fca6cbdfd577926522fcafe6f172f3370cc4a55d8bf3db68f8fc154dbb6c483b38f718df7991e43c773801c27e1f7a055e3cd0ed1b
7
+ data.tar.gz: 94d84b3588aeb62ee53f49593e486e268d58a112d73cdae15e2212dbb4a356ba736ff5e5adf31db4d979e83d7e1a8f56650911b0aab89837ef251f73ce6926b4
data/CHANGELOG.md CHANGED
@@ -2,8 +2,16 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
- ## 2.9.0
5
+ ## Version 2.10.0
6
+ ### Fixed
7
+ * [#1937](https://github.com/Shopify/shopify-cli/pull/1937): Fix `theme pull` to no longer add empty lines on Windows
8
+ * [#1952](https://github.com/Shopify/shopify-cli/pull/1952): Fix CORS (cross-origin resource sharing) errors
9
+ * [#1965](https://github.com/Shopify/shopify-cli/pull/1965): Revert: Fix partners ability to login to external shops. (#1873)
10
+
11
+ ### Added
12
+ * [#1892](https://github.com/Shopify/shopify-cli/pull/1892): Add `-o`/`--only` parameter to filter files on `theme push`/`theme pull` commands
6
13
 
14
+ ## Version 2.9.0
7
15
  ### Fixed
8
16
  * [#1922](https://github.com/Shopify/shopify-cli/pull/1922): Respect RUBY_BINDIR from Homebrew for installing gem
9
17
  * [#1906](https://github.com/Shopify/shopify-cli/pull/1906): Fix Ngrok incompatibility with some Apple ARM environments
@@ -12,7 +20,6 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
12
20
 
13
21
  ### Added
14
22
  * [#1900](https://github.com/Shopify/shopify-cli/pull/1900): Add `-d`/`--development` flag to Shopify theme pull command
15
- * [#1896](https://github.com/Shopify/shopify-cli/pull/1896): Release Typescript options for payment_methods and shipping_methods scripts
16
23
  * [#1891](https://github.com/Shopify/shopify-cli/pull/1891): Allow for additional arguments in `shopify push script` on CI.
17
24
  * [#1877](https://github.com/Shopify/shopify-cli/pull/1877): Add theme (`-t`/`--theme=NAME_OR_ID`) parameter to `theme push`/`theme pull` commands
18
25
  * [#1871](https://github.com/Shopify/shopify-cli/pull/1871): Add a new `--live-reload` parameter to the `theme serve` command
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.9.0)
4
+ shopify-cli (2.10.0)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.9.0)
@@ -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
 
@@ -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,65 +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
61
  class ScriptEnvAppNotConnectedError < ScriptProjectError; end
43
62
 
44
- class InvalidScriptConfigYmlDefinitionError < ScriptProjectError; end
45
-
46
- class InvalidScriptJsonDefinitionError < ScriptProjectError; end
47
-
48
- class MissingScriptConfigYmlFieldError < ScriptProjectError
49
- attr_reader :field
50
- def initialize(field)
63
+ class ScriptConfigParseError < ScriptProjectError
64
+ attr_reader :filename, :serialization_format
65
+ def initialize(filename:, serialization_format:)
51
66
  super()
52
- @field = field
67
+ @filename = filename
68
+ @serialization_format = serialization_format
53
69
  end
54
70
  end
55
71
 
56
- class MissingScriptJsonFieldError < ScriptProjectError
57
- attr_reader :field
58
- def initialize(field)
72
+ class NoScriptConfigFileError < ScriptProjectError
73
+ attr_reader :filename
74
+ def initialize(filename)
59
75
  super()
60
- @field = field
76
+ @filename = filename
61
77
  end
62
78
  end
63
79
 
64
- class NoScriptConfigYmlFileError < ScriptProjectError; end
65
- class NoScriptConfigFileError < ScriptProjectError; end
66
-
67
80
  class APILibraryNotFoundError < ScriptProjectError
68
81
  attr_reader :library_name
69
82
  def initialize(library_name)
@@ -160,12 +160,15 @@ module Script
160
160
 
161
161
  def script_config_repository
162
162
  @script_config_repository ||= begin
163
+ script_config_yml_repo = ScriptConfigYmlRepository.new(ctx: ctx)
163
164
  supported_repos = [
164
- ScriptConfigYmlRepository.new(ctx: ctx),
165
+ script_config_yml_repo,
165
166
  ScriptJsonRepository.new(ctx: ctx),
166
167
  ]
167
168
  repo = supported_repos.find(&:active?)
168
- raise Infrastructure::Errors::NoScriptConfigYmlFileError if repo.nil?
169
+ if repo.nil?
170
+ raise Infrastructure::Errors::NoScriptConfigFileError, script_config_yml_repo.filename
171
+ end
169
172
  repo
170
173
  end
171
174
  end
@@ -179,7 +182,7 @@ module Script
179
182
  end
180
183
 
181
184
  def get!
182
- raise Infrastructure::Errors::NoScriptConfigFileError unless active?
185
+ raise Infrastructure::Errors::NoScriptConfigFileError, filename unless active?
183
186
 
184
187
  content = ctx.read(filename)
185
188
  hash = file_content_to_hash(content)
@@ -196,6 +199,10 @@ module Script
196
199
  from_h(hash)
197
200
  end
198
201
 
202
+ def filename
203
+ raise NotImplementedError
204
+ end
205
+
199
206
  private
200
207
 
201
208
  def update_hash(hash:, title:)
@@ -204,14 +211,7 @@ module Script
204
211
  end
205
212
 
206
213
  def from_h(hash)
207
- Domain::ScriptConfig.new(content: hash)
208
- rescue Domain::Errors::MissingScriptConfigFieldError => e
209
- raise missing_field_error, e.field
210
- end
211
-
212
- # to be implemented by subclasses
213
- def filename
214
- raise NotImplementedError
214
+ Domain::ScriptConfig.new(content: hash, filename: filename)
215
215
  end
216
216
 
217
217
  def file_content_to_hash(file_content)
@@ -221,26 +221,22 @@ module Script
221
221
  def hash_to_file_content(hash)
222
222
  raise NotImplementedError
223
223
  end
224
-
225
- def missing_field_error
226
- raise NotImplementedError
227
- end
228
224
  end
229
225
 
230
226
  class ScriptConfigYmlRepository < ScriptConfigRepository
231
- private
232
-
233
227
  def filename
234
228
  "script.config.yml"
235
229
  end
236
230
 
231
+ private
232
+
237
233
  def file_content_to_hash(file_content)
238
234
  begin
239
235
  hash = YAML.load(file_content)
240
236
  rescue Psych::SyntaxError
241
- raise Errors::InvalidScriptConfigYmlDefinitionError
237
+ raise parse_error
242
238
  end
243
- raise Errors::InvalidScriptConfigYmlDefinitionError unless hash.is_a?(Hash)
239
+ raise parse_error unless hash.is_a?(Hash)
244
240
  hash
245
241
  end
246
242
 
@@ -248,30 +244,34 @@ module Script
248
244
  YAML.dump(hash)
249
245
  end
250
246
 
251
- def missing_field_error
252
- Errors::MissingScriptConfigYmlFieldError
247
+ def parse_error
248
+ Errors::ScriptConfigParseError.new(filename: filename, serialization_format: "YAML")
253
249
  end
254
250
  end
255
251
 
256
252
  class ScriptJsonRepository < ScriptConfigRepository
257
- private
258
-
259
253
  def filename
260
254
  "script.json"
261
255
  end
262
256
 
257
+ private
258
+
263
259
  def file_content_to_hash(file_content)
264
- JSON.parse(file_content)
265
- rescue JSON::ParserError
266
- raise Errors::InvalidScriptJsonDefinitionError
260
+ begin
261
+ hash = JSON.parse(file_content)
262
+ rescue JSON::ParserError
263
+ raise parse_error
264
+ end
265
+ raise parse_error unless hash.is_a?(Hash)
266
+ hash
267
267
  end
268
268
 
269
269
  def hash_to_file_content(hash)
270
270
  JSON.pretty_generate(hash)
271
271
  end
272
272
 
273
- def missing_field_error
274
- Errors::MissingScriptJsonFieldError
273
+ def parse_error
274
+ Errors::ScriptConfigParseError.new(filename: filename, serialization_format: "JSON")
275
275
  end
276
276
  end
277
277
  end
@@ -46,20 +46,37 @@ module Script
46
46
 
47
47
  if user_errors.any? { |e| e["tag"] == "already_exists_error" }
48
48
  raise Errors::ScriptRepushError, uuid
49
+ elsif (e = user_errors.find { |err| err["tag"] == "configuration_definition_error" })
50
+ raise Errors::ScriptConfigurationDefinitionError.new(
51
+ message: e["message"],
52
+ filename: script_config.filename,
53
+ )
49
54
  elsif (e = user_errors.any? { |err| err["tag"] == "configuration_definition_syntax_error" })
50
- raise Errors::ScriptConfigSyntaxError
55
+ raise Errors::ScriptConfigSyntaxError, script_config.filename
51
56
  elsif (e = user_errors.find { |err| err["tag"] == "configuration_definition_missing_keys_error" })
52
- raise Errors::ScriptConfigMissingKeysError, e["message"]
57
+ raise Errors::ScriptConfigMissingKeysError.new(
58
+ missing_keys: e["message"],
59
+ filename: script_config.filename,
60
+ )
53
61
  elsif (e = user_errors.find { |err| err["tag"] == "configuration_definition_invalid_value_error" })
54
- raise Errors::ScriptConfigInvalidValueError, e["message"]
62
+ raise Errors::ScriptConfigInvalidValueError.new(
63
+ valid_input_modes: e["message"],
64
+ filename: script_config.filename,
65
+ )
55
66
  elsif (e = user_errors.find do |err|
56
67
  err["tag"] == "configuration_definition_schema_field_missing_keys_error"
57
68
  end)
58
- raise Errors::ScriptConfigFieldsMissingKeysError, e["message"]
69
+ raise Errors::ScriptConfigFieldsMissingKeysError.new(
70
+ missing_keys: e["message"],
71
+ filename: script_config.filename,
72
+ )
59
73
  elsif (e = user_errors.find do |err|
60
74
  err["tag"] == "configuration_definition_schema_field_invalid_value_error"
61
75
  end)
62
- raise Errors::ScriptConfigFieldsInvalidValueError, e["message"]
76
+ raise Errors::ScriptConfigFieldsInvalidValueError.new(
77
+ valid_types: e["message"],
78
+ filename: script_config.filename,
79
+ )
63
80
  elsif user_errors.find { |err| %w(not_use_msgpack_error schema_version_argument_error).include?(err["tag"]) }
64
81
  raise Domain::Errors::MetadataValidationError
65
82
  else
@@ -47,41 +47,39 @@ module Script
47
47
  invalid_language_cause: "Invalid language %s.",
48
48
  invalid_language_help: "Allowed values: %s.",
49
49
 
50
- missing_script_config_yml_field_cause: "The script.config.yml file is missing the required %s field.",
51
- missing_script_config_yml_field_help: "Add the field and try again.",
50
+ missing_script_config_field_cause: "The %{filename} file is missing the required %{field} field.",
51
+ missing_script_config_field_help: "Add the field and try again.",
52
52
 
53
- missing_script_json_field_cause: "The script.json file is missing the required %s field.",
54
- missing_script_json_field_help: "Add the field and try again.",
53
+ script_config_parse_error_cause: "The %{filename} file contains invalid %{serialization_format}.",
54
+ script_config_parse_error_help: "Fix the errors and try again.",
55
55
 
56
- invalid_script_json_definition_cause: "The script.json file contains invalid JSON.",
57
- invalid_script_json_definition_help: "Fix the errors and try again.",
58
-
59
- invalid_script_config_yml_definition_cause: "The script.config.yml file contains invalid YAML.",
60
- invalid_script_config_yml_definition_help: "Fix the errors and try again.",
61
-
62
- no_script_config_yml_file_cause: "The script.config.yml file is missing.",
63
- no_script_config_yml_file_help: "Create this file and try again.",
56
+ no_script_config_file_cause: "The %{filename} file is missing.",
57
+ no_script_config_file_help: "Create this file and try again.",
64
58
 
65
59
  app_not_connected_cause: "Script is not connected to an app.",
66
60
  app_not_connected_help: "Run shopify connect or enter fields for api-key and api-secret.",
67
61
 
68
- configuration_syntax_error_cause: "The script.json is not formatted properly.",
62
+ configuration_definition_error_cause: "In the %{filename} file, there was a problem with the "\
63
+ "configuration. %{message}",
64
+ configuration_definition_error_help: "Fix the error and try again.",
65
+
66
+ configuration_syntax_error_cause: "The %{filename} is not formatted properly.",
69
67
  configuration_syntax_error_help: "Fix the errors and try again.",
70
68
 
71
- configuration_missing_keys_error_cause: "The script.json file is missing required keys: "\
69
+ configuration_missing_keys_error_cause: "The %{filename} file is missing required keys: "\
72
70
  "%{missing_keys}.",
73
71
  configuration_missing_keys_error_help: "Add the keys and try again.",
74
72
 
75
- configuration_invalid_value_error_cause: "The script.json configuration only accepts "\
73
+ configuration_invalid_value_error_cause: "The %{filename} configuration only accepts "\
76
74
  "one of the following types(s): %{valid_input_modes}.",
77
75
  configuration_invalid_value_error_help: "Change the type and try again.",
78
76
 
79
- configuration_schema_field_missing_keys_error_cause: "A configuration entry in the script.json file "\
77
+ configuration_schema_field_missing_keys_error_cause: "A configuration entry in the %{filename} file "\
80
78
  "is missing required keys: %{missing_keys}.",
81
79
  configuration_definition_schema_field_missing_keys_error_help: "Add the keys and try again.",
82
80
 
83
81
  configuration_schema_field_invalid_value_error_cause: "The configuration entries in the "\
84
- "script.json file only accept one of the following "\
82
+ "%{filename} file only accept one of the following "\
85
83
  "type(s): %{valid_types}.",
86
84
  configuration_schema_field_invalid_value_error_help: "Change the types and try again.",
87
85
 
@@ -103,44 +103,52 @@ module Script
103
103
  cause_of_error: ShopifyCLI::Context.message("script.error.metadata_not_found_cause"),
104
104
  help_suggestion: ShopifyCLI::Context.message("script.error.metadata_not_found_help"),
105
105
  }
106
+ when Layers::Domain::Errors::MissingScriptConfigFieldError
107
+ {
108
+ cause_of_error: ShopifyCLI::Context.message(
109
+ "script.error.missing_script_config_field_cause",
110
+ field: e.field,
111
+ filename: e.filename,
112
+ ),
113
+ help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_config_field_help"),
114
+ }
106
115
  when Layers::Infrastructure::Errors::BuildError
107
116
  {
108
117
  cause_of_error: ShopifyCLI::Context.message("script.error.build_error_cause"),
109
118
  help_suggestion: ShopifyCLI::Context.message("script.error.build_error_help"),
110
119
  }
111
- when Layers::Infrastructure::Errors::InvalidScriptConfigYmlDefinitionError
112
- {
113
- cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_config_yml_definition_cause"),
114
- help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_config_yml_definition_help"),
115
- }
116
- when Layers::Infrastructure::Errors::InvalidScriptJsonDefinitionError
117
- {
118
- cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_json_definition_cause"),
119
- help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_json_definition_help"),
120
- }
121
- when Layers::Infrastructure::Errors::MissingScriptConfigYmlFieldError
122
- {
123
- cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_cause", e.field),
124
- help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_help"),
125
- }
126
- when Layers::Infrastructure::Errors::MissingScriptConfigYmlFieldError
120
+ when Layers::Infrastructure::Errors::ScriptConfigParseError
127
121
  {
128
- cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_cause", e.field),
129
- help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_help"),
122
+ cause_of_error: ShopifyCLI::Context.message(
123
+ "script.error.script_config_parse_error_cause",
124
+ filename: e.filename,
125
+ serialization_format: e.serialization_format,
126
+ ),
127
+ help_suggestion: ShopifyCLI::Context.message("script.error.script_config_parse_error_help"),
130
128
  }
131
- when Layers::Infrastructure::Errors::MissingScriptJsonFieldError
129
+ when Layers::Infrastructure::Errors::NoScriptConfigFileError
132
130
  {
133
- cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_json_field_cause", e.field),
134
- help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_json_field_help"),
131
+ cause_of_error: ShopifyCLI::Context.message(
132
+ "script.error.no_script_config_file_cause",
133
+ filename: e.filename,
134
+ ),
135
+ help_suggestion: ShopifyCLI::Context.message("script.error.no_script_config_file_help"),
135
136
  }
136
- when Layers::Infrastructure::Errors::NoScriptConfigYmlFileError
137
+ when Layers::Infrastructure::Errors::ScriptConfigurationDefinitionError
137
138
  {
138
- cause_of_error: ShopifyCLI::Context.message("script.error.no_script_config_yml_file_cause"),
139
- help_suggestion: ShopifyCLI::Context.message("script.error.no_script_config_yml_file_help"),
139
+ cause_of_error: ShopifyCLI::Context.message(
140
+ "script.error.configuration_definition_error_cause",
141
+ message: e.message,
142
+ filename: e.filename,
143
+ ),
144
+ help_suggestion: ShopifyCLI::Context.message("script.error.configuration_definition_error_help"),
140
145
  }
141
146
  when Layers::Infrastructure::Errors::ScriptConfigSyntaxError
142
147
  {
143
- cause_of_error: ShopifyCLI::Context.message("script.error.configuration_syntax_error_cause"),
148
+ cause_of_error: ShopifyCLI::Context.message(
149
+ "script.error.configuration_syntax_error_cause",
150
+ filename: e.filename,
151
+ ),
144
152
  help_suggestion: ShopifyCLI::Context.message("script.error.configuration_syntax_error_help"),
145
153
  }
146
154
  when Layers::Infrastructure::Errors::ScriptEnvAppNotConnectedError
@@ -152,7 +160,8 @@ module Script
152
160
  {
153
161
  cause_of_error: ShopifyCLI::Context.message(
154
162
  "script.error.configuration_missing_keys_error_cause",
155
- missing_keys: e.missing_keys
163
+ missing_keys: e.missing_keys,
164
+ filename: e.filename,
156
165
  ),
157
166
  help_suggestion: ShopifyCLI::Context.message("script.error.configuration_missing_keys_error_help"),
158
167
  }
@@ -160,7 +169,8 @@ module Script
160
169
  {
161
170
  cause_of_error: ShopifyCLI::Context.message(
162
171
  "script.error.configuration_invalid_value_error_cause",
163
- valid_input_modes: e.valid_input_modes
172
+ valid_input_modes: e.valid_input_modes,
173
+ filename: e.filename,
164
174
  ),
165
175
  help_suggestion: ShopifyCLI::Context.message("script.error.configuration_invalid_value_error_help"),
166
176
  }
@@ -168,7 +178,8 @@ module Script
168
178
  {
169
179
  cause_of_error: ShopifyCLI::Context.message(
170
180
  "script.error.configuration_schema_field_missing_keys_error_cause",
171
- missing_keys: e.missing_keys
181
+ missing_keys: e.missing_keys,
182
+ filename: e.filename,
172
183
  ),
173
184
  help_suggestion: ShopifyCLI::Context.message(
174
185
  "script.error.configuration_definition_schema_field_missing_keys_error_help"
@@ -178,7 +189,8 @@ module Script
178
189
  {
179
190
  cause_of_error: ShopifyCLI::Context.message(
180
191
  "script.error.configuration_schema_field_invalid_value_error_cause",
181
- valid_types: e.valid_types
192
+ valid_types: e.valid_types,
193
+ filename: e.filename,
182
194
  ),
183
195
  help_suggestion: ShopifyCLI::Context.message(
184
196
  "script.error.configuration_schema_field_invalid_value_error_help"
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require "shopify_cli/theme/theme"
3
3
  require "shopify_cli/theme/ignore_filter"
4
+ require "shopify_cli/theme/include_filter"
4
5
  require "shopify_cli/theme/syncer"
5
6
 
6
7
  module Theme
@@ -12,6 +13,7 @@ module Theme
12
13
  parser.on("-t", "--theme=NAME_OR_ID") { |theme| flags[:theme] = theme }
13
14
  parser.on("-l", "--live") { flags[:live] = true }
14
15
  parser.on("-d", "--development") { flags[:development] = true }
16
+ parser.on("-o", "--only=PATTERN") { |pattern| flags[:includes] = pattern }
15
17
  parser.on("-x", "--ignore=PATTERN") do |pattern|
16
18
  flags[:ignores] ||= []
17
19
  flags[:ignores] << pattern
@@ -24,10 +26,13 @@ module Theme
24
26
  theme = find_theme(root, **options.flags)
25
27
  return if theme.nil?
26
28
 
29
+ include_filter = ShopifyCLI::Theme::IncludeFilter.new(options.flags[:includes])
27
30
  ignore_filter = ShopifyCLI::Theme::IgnoreFilter.from_path(root)
28
31
  ignore_filter.add_patterns(options.flags[:ignores]) if options.flags[:ignores]
29
32
 
30
- syncer = ShopifyCLI::Theme::Syncer.new(@ctx, theme: theme, ignore_filter: ignore_filter)
33
+ syncer = ShopifyCLI::Theme::Syncer.new(@ctx, theme: theme,
34
+ include_filter: include_filter,
35
+ ignore_filter: ignore_filter)
31
36
  begin
32
37
  syncer.start_threads
33
38
  CLI::UI::Frame.open(@ctx.message("theme.pull.pulling", theme.name, theme.id, theme.shop)) do
@@ -2,6 +2,7 @@
2
2
  require "shopify_cli/theme/theme"
3
3
  require "shopify_cli/theme/development_theme"
4
4
  require "shopify_cli/theme/ignore_filter"
5
+ require "shopify_cli/theme/include_filter"
5
6
  require "shopify_cli/theme/syncer"
6
7
 
7
8
  module Theme
@@ -17,6 +18,7 @@ module Theme
17
18
  parser.on("-j", "--json") { flags[:json] = true }
18
19
  parser.on("-a", "--allow-live") { flags[:allow_live] = true }
19
20
  parser.on("-p", "--publish") { flags[:publish] = true }
21
+ parser.on("-o", "--only=PATTERN") { |pattern| flags[:includes] = pattern }
20
22
  parser.on("-x", "--ignore=PATTERN") do |pattern|
21
23
  flags[:ignores] ||= []
22
24
  flags[:ignores] << pattern
@@ -35,10 +37,13 @@ module Theme
35
37
  return unless CLI::UI::Prompt.confirm(question)
36
38
  end
37
39
 
40
+ include_filter = ShopifyCLI::Theme::IncludeFilter.new(options.flags[:includes])
38
41
  ignore_filter = ShopifyCLI::Theme::IgnoreFilter.from_path(root)
39
42
  ignore_filter.add_patterns(options.flags[:ignores]) if options.flags[:ignores]
40
43
 
41
- syncer = ShopifyCLI::Theme::Syncer.new(@ctx, theme: theme, ignore_filter: ignore_filter)
44
+ syncer = ShopifyCLI::Theme::Syncer.new(@ctx, theme: theme,
45
+ include_filter: include_filter,
46
+ ignore_filter: ignore_filter)
42
47
  begin
43
48
  syncer.start_threads
44
49
  if options.flags[:json]
@@ -65,6 +65,8 @@ module Theme
65
65
  {{command:-j, --json}} Output JSON instead of a UI.
66
66
  {{command:-a, --allow-live}} Allow push to a live theme.
67
67
  {{command:-p, --publish}} Publish as the live theme after uploading.
68
+ {{command:-o, --only}} Upload only the specified files.
69
+ {{command:-x, --ignore}} Skip uploading the specified files.
68
70
 
69
71
  Run without options to select theme from a list.
70
72
  HELP
@@ -200,6 +202,8 @@ module Theme
200
202
  {{command:-l, --live}} Pull theme files from your remote live theme.
201
203
  {{command:-d, --development}} Pull theme files from your remote development theme.
202
204
  {{command:-n, --nodelete}} Runs the pull command without deleting local files.
205
+ {{command:-o, --only}} Download only the specified files.
206
+ {{command:-x, --ignore}} Skip downloading the specified files.
203
207
 
204
208
  Run without options to select theme from a list.
205
209
  HELP