shopify-cli 2.11.1 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/shopify.yml +2 -1
  3. data/.rubocop.yml +1 -1
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +32 -0
  6. data/Gemfile.lock +14 -14
  7. data/bin/shopify +17 -4
  8. data/dev.yml +1 -1
  9. data/docs/users/installation.md +1 -44
  10. data/ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256 +1 -0
  11. data/ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256 +1 -0
  12. data/ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256 +1 -0
  13. data/ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256 +1 -0
  14. data/ext/javy/version +1 -1
  15. data/lib/project_types/extension/commands/build.rb +0 -3
  16. data/lib/project_types/extension/commands/check.rb +0 -1
  17. data/lib/project_types/extension/commands/create.rb +0 -1
  18. data/lib/project_types/extension/commands/push.rb +0 -1
  19. data/lib/project_types/extension/commands/serve.rb +0 -1
  20. data/lib/project_types/extension/features/argo_setup_steps.rb +4 -6
  21. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +114 -0
  22. data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +7 -1
  23. data/lib/project_types/extension/tasks/configure_features.rb +15 -2
  24. data/lib/project_types/extension/tasks/convert_server_config.rb +2 -1
  25. data/lib/project_types/script/cli.rb +2 -0
  26. data/lib/project_types/script/commands/create.rb +5 -5
  27. data/lib/project_types/script/commands/push.rb +4 -6
  28. data/lib/project_types/script/config/extension_points.yml +0 -4
  29. data/lib/project_types/script/errors.rb +1 -1
  30. data/lib/project_types/script/forms/create.rb +7 -20
  31. data/lib/project_types/script/layers/application/build_script.rb +22 -24
  32. data/lib/project_types/script/layers/application/connect_app.rb +3 -2
  33. data/lib/project_types/script/layers/application/create_script.rb +9 -10
  34. data/lib/project_types/script/layers/application/project_dependencies.rb +12 -14
  35. data/lib/project_types/script/layers/application/push_script.rb +2 -0
  36. data/lib/project_types/script/layers/domain/errors.rb +3 -3
  37. data/lib/project_types/script/layers/domain/push_package.rb +6 -0
  38. data/lib/project_types/script/layers/domain/script_config.rb +2 -4
  39. data/lib/project_types/script/layers/domain/script_project.rb +3 -2
  40. data/lib/project_types/script/layers/infrastructure/errors.rb +11 -0
  41. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +20 -9
  42. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +29 -18
  43. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +0 -15
  44. data/lib/project_types/script/layers/infrastructure/languages/tool_version_checker.rb +26 -0
  45. data/lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb +22 -10
  46. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +30 -19
  47. data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +0 -3
  48. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +4 -0
  49. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +13 -25
  50. data/lib/project_types/script/layers/infrastructure/script_service.rb +4 -2
  51. data/lib/project_types/script/loaders/project.rb +8 -7
  52. data/lib/project_types/script/messages/messages.rb +20 -19
  53. data/lib/project_types/script/ui/error_handler.rb +17 -4
  54. data/lib/project_types/script/ui/strict_spinner.rb +4 -6
  55. data/lib/project_types/theme/cli.rb +2 -0
  56. data/lib/project_types/theme/commands/common/root_helper.rb +71 -0
  57. data/lib/project_types/theme/commands/init.rb +2 -0
  58. data/lib/project_types/theme/commands/list.rb +34 -0
  59. data/lib/project_types/theme/commands/open.rb +65 -0
  60. data/lib/project_types/theme/commands/pull.rb +20 -10
  61. data/lib/project_types/theme/commands/push.rb +18 -12
  62. data/lib/project_types/theme/commands/serve.rb +6 -2
  63. data/lib/project_types/theme/conversions/base_glob.rb +50 -0
  64. data/lib/project_types/theme/conversions/ignore_glob.rb +15 -0
  65. data/lib/project_types/theme/conversions/include_glob.rb +15 -0
  66. data/lib/project_types/theme/forms/select.rb +11 -39
  67. data/lib/project_types/theme/messages/messages.rb +36 -7
  68. data/lib/project_types/theme/presenters/theme_presenter.rb +48 -0
  69. data/lib/project_types/theme/presenters/themes_presenter.rb +32 -0
  70. data/lib/shopify_cli/api.rb +1 -1
  71. data/lib/shopify_cli/command.rb +3 -1
  72. data/lib/shopify_cli/commands/app/create/node.rb +1 -0
  73. data/lib/shopify_cli/commands/app/create/php.rb +1 -0
  74. data/lib/shopify_cli/commands/app/create/rails.rb +1 -0
  75. data/lib/shopify_cli/commands/app/deploy.rb +1 -0
  76. data/lib/shopify_cli/constants.rb +3 -3
  77. data/lib/shopify_cli/context.rb +11 -13
  78. data/lib/shopify_cli/environment.rb +6 -0
  79. data/lib/shopify_cli/git.rb +9 -1
  80. data/lib/shopify_cli/messages/messages.rb +23 -3
  81. data/lib/shopify_cli/services/app/create/rails_service.rb +1 -1
  82. data/lib/shopify_cli/tasks/ensure_git_dependency.rb +14 -0
  83. data/lib/shopify_cli/tasks.rb +1 -0
  84. data/lib/shopify_cli/theme/dev_server/proxy.rb +14 -2
  85. data/lib/shopify_cli/theme/dev_server.rb +1 -3
  86. data/lib/shopify_cli/theme/development_theme.rb +11 -0
  87. data/lib/shopify_cli/theme/include_filter.rb +4 -2
  88. data/lib/shopify_cli/theme/syncer.rb +20 -11
  89. data/lib/shopify_cli/theme/theme.rb +0 -4
  90. data/lib/shopify_cli/version.rb +1 -1
  91. data/shopify-dev +9 -11
  92. metadata +16 -2
@@ -9,7 +9,8 @@ module ShopifyCLI
9
9
 
10
10
  attr_reader :globs, :regexes
11
11
 
12
- def initialize(patterns = [])
12
+ def initialize(root, patterns = [])
13
+ @root = Pathname.new(root)
13
14
  @patterns = patterns.nil? ? [] : patterns.compact.reject(&:empty?)
14
15
 
15
16
  regexes, globs = patterns_to_regexes_and_globs(@patterns)
@@ -22,9 +23,10 @@ module ShopifyCLI
22
23
  return true unless present?(@patterns)
23
24
 
24
25
  path = path.to_s
25
-
26
26
  return true if path.empty?
27
27
 
28
+ path = @root.join(path).to_s
29
+
28
30
  regexes.each do |regex|
29
31
  return true if regex_match?(regex, path)
30
32
  end
@@ -42,16 +42,16 @@ module ShopifyCLI
42
42
  # Latest theme assets checksums. Updated on each upload.
43
43
  @checksums = {}
44
44
 
45
- # Checksums of assets with errors.
45
+ # Checksums of assets with errors.
46
46
  @error_checksums = []
47
47
  end
48
48
 
49
49
  def lock_io!
50
- @reporters.each { |reporter| reporter.disable! }
50
+ @reporters.each(&:disable!)
51
51
  end
52
52
 
53
53
  def unlock_io!
54
- @reporters.each { |reporter| reporter.enable! }
54
+ @reporters.each(&:enable!)
55
55
  end
56
56
 
57
57
  def enqueue_updates(files)
@@ -118,7 +118,7 @@ module ShopifyCLI
118
118
  operation = @queue.pop
119
119
  break if operation.nil? # shutdown was called
120
120
  perform(operation)
121
- rescue Exception => e
121
+ rescue Exception => e # rubocop:disable Lint/RescueException
122
122
  error_suffix = ": #{e}"
123
123
  error_suffix += + "\n\t#{e.backtrace.join("\n\t")}" if @ctx.debug?
124
124
  report_error(operation, error_suffix)
@@ -168,7 +168,7 @@ module ShopifyCLI
168
168
  # Delete local files not present remotely
169
169
  missing_files = @theme.theme_files
170
170
  .reject { |file| checksums.key?(file.relative_path.to_s) }.uniq
171
- .reject { |file| @ignore_filter&.ignore?(file) }
171
+ .reject { |file| ignore_file?(file) }
172
172
  missing_files.each do |file|
173
173
  @ctx.debug("rm #{file.relative_path}")
174
174
  file.delete
@@ -195,7 +195,7 @@ module ShopifyCLI
195
195
  # Already enqueued
196
196
  return if @pending.include?(operation)
197
197
 
198
- if ignore?(operation)
198
+ if ignore_operation?(operation)
199
199
  @ctx.debug("ignore #{operation.file_path}")
200
200
  return
201
201
  end
@@ -253,8 +253,17 @@ module ShopifyCLI
253
253
  response
254
254
  end
255
255
 
256
- def ignore?(operation)
256
+ def ignore_operation?(operation)
257
257
  path = operation.file_path
258
+ ignore_path?(path)
259
+ end
260
+
261
+ def ignore_file?(file)
262
+ path = file.path
263
+ ignore_path?(path)
264
+ end
265
+
266
+ def ignore_path?(path)
258
267
  ignored_by_ignore_filter?(path) || ignored_by_include_filter?(path)
259
268
  end
260
269
 
@@ -279,7 +288,7 @@ module ShopifyCLI
279
288
  update_checksums(body)
280
289
 
281
290
  attachment = body.dig("asset", "attachment")
282
- value = if attachment
291
+ if attachment
283
292
  file.write(Base64.decode64(attachment))
284
293
  else
285
294
  file.write(body.dig("asset", "value"))
@@ -296,7 +305,7 @@ module ShopifyCLI
296
305
  method: "DELETE",
297
306
  api_version: API_VERSION,
298
307
  body: JSON.generate(asset: {
299
- key: file.relative_path.to_s
308
+ key: file.relative_path.to_s,
300
309
  })
301
310
  )
302
311
 
@@ -323,7 +332,7 @@ module ShopifyCLI
323
332
  parsed_body = JSON.parse(exception&.response&.body)
324
333
  message = parsed_body.dig("errors", "asset") || parsed_body["message"] || exception.message
325
334
  # Truncate to first lines
326
- [message].flatten.map { |message| message.split("\n", 2).first }
335
+ [message].flatten.map { |mess| mess.split("\n", 2).first }
327
336
  rescue JSON::ParserError
328
337
  [exception.message]
329
338
  end
@@ -331,7 +340,7 @@ module ShopifyCLI
331
340
  def backoff_if_near_limit!(used, limit)
332
341
  if used > limit - @threads.size
333
342
  @ctx.debug("Near API call limit, waiting 2 sec…")
334
- @backoff_mutex.synchronize { sleep 2 }
343
+ @backoff_mutex.synchronize { sleep(2) }
335
344
  end
336
345
  end
337
346
 
@@ -176,10 +176,6 @@ module ShopifyCLI
176
176
  find(ctx, root) { |attrs| attrs["role"] == "main" }
177
177
  end
178
178
 
179
- def development(ctx, root: nil)
180
- find(ctx, root) { |attrs| attrs["role"] == "development" }
181
- end
182
-
183
179
  # Finds a Theme by its identifier
184
180
  #
185
181
  # #### Parameters
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.11.1"
2
+ VERSION = "2.13.0"
3
3
  end
data/shopify-dev CHANGED
@@ -3,16 +3,14 @@
3
3
  require_relative "./bin/load_shopify"
4
4
 
5
5
  exit(proc do
6
- begin
7
- ShopifyCLI::ErrorHandler.call do
8
- ShopifyCLI::Core::EntryPoint.call(ARGV.dup)
9
- end
10
- rescue StandardError => error
11
- ShopifyCLI::ErrorHandler.exception = error
12
- if ShopifyCLI::Environment.print_stacktrace?
13
- raise error
14
- else
15
- 1
16
- end
6
+ ShopifyCLI::ErrorHandler.call do
7
+ ShopifyCLI::Core::EntryPoint.call(ARGV.dup)
17
8
  end
9
+ rescue StandardError => error
10
+ ShopifyCLI::ErrorHandler.exception = error
11
+ if ShopifyCLI::Environment.print_stacktrace?
12
+ raise error
13
+ else
14
+ 1
15
+ end
18
16
  end.call)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.1
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-09 00:00:00.000000000 Z
11
+ date: 2022-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -154,9 +154,13 @@ files:
154
154
  - docs/users/installation.md
155
155
  - docs/users/migrate-from-themekit.md
156
156
  - ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256
157
+ - ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256
157
158
  - ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256
159
+ - ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256
158
160
  - ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256
161
+ - ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256
159
162
  - ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256
163
+ - ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256
160
164
  - ext/javy/javy.rb
161
165
  - ext/javy/version
162
166
  - ext/shopify-extensions/extconf.rb
@@ -317,6 +321,7 @@ files:
317
321
  - lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb
318
322
  - lib/project_types/script/layers/infrastructure/languages/project_creator.rb
319
323
  - lib/project_types/script/layers/infrastructure/languages/task_runner.rb
324
+ - lib/project_types/script/layers/infrastructure/languages/tool_version_checker.rb
320
325
  - lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb
321
326
  - lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb
322
327
  - lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb
@@ -335,17 +340,25 @@ files:
335
340
  - lib/project_types/script/ui/strict_spinner.rb
336
341
  - lib/project_types/theme/cli.rb
337
342
  - lib/project_types/theme/commands/check.rb
343
+ - lib/project_types/theme/commands/common/root_helper.rb
338
344
  - lib/project_types/theme/commands/delete.rb
339
345
  - lib/project_types/theme/commands/init.rb
340
346
  - lib/project_types/theme/commands/language_server.rb
347
+ - lib/project_types/theme/commands/list.rb
348
+ - lib/project_types/theme/commands/open.rb
341
349
  - lib/project_types/theme/commands/package.rb
342
350
  - lib/project_types/theme/commands/publish.rb
343
351
  - lib/project_types/theme/commands/pull.rb
344
352
  - lib/project_types/theme/commands/push.rb
345
353
  - lib/project_types/theme/commands/serve.rb
354
+ - lib/project_types/theme/conversions/base_glob.rb
355
+ - lib/project_types/theme/conversions/ignore_glob.rb
356
+ - lib/project_types/theme/conversions/include_glob.rb
346
357
  - lib/project_types/theme/forms/confirm_store.rb
347
358
  - lib/project_types/theme/forms/select.rb
348
359
  - lib/project_types/theme/messages/messages.rb
360
+ - lib/project_types/theme/presenters/theme_presenter.rb
361
+ - lib/project_types/theme/presenters/themes_presenter.rb
349
362
  - lib/project_types/theme/ui/sync_progress_bar.rb
350
363
  - lib/rubygems_plugin.rb
351
364
  - lib/shopify_cli.rb
@@ -459,6 +472,7 @@ files:
459
472
  - lib/shopify_cli/tasks/ensure_authenticated.rb
460
473
  - lib/shopify_cli/tasks/ensure_dev_store.rb
461
474
  - lib/shopify_cli/tasks/ensure_env.rb
475
+ - lib/shopify_cli/tasks/ensure_git_dependency.rb
462
476
  - lib/shopify_cli/tasks/ensure_loopback_url.rb
463
477
  - lib/shopify_cli/tasks/ensure_project_type.rb
464
478
  - lib/shopify_cli/tasks/select_org_and_shop.rb