shopify-cli 2.15.1 → 2.15.4

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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/.vscode/settings.json +1 -2
  3. data/CHANGELOG.md +68 -20
  4. data/Gemfile.lock +1 -1
  5. data/Rakefile +21 -0
  6. data/ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256 +1 -0
  7. data/ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256 +1 -0
  8. data/ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256 +1 -0
  9. data/ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256 +1 -0
  10. data/ext/javy/version +1 -1
  11. data/ext/shopify-extensions/version +1 -1
  12. data/lib/project_types/extension/cli.rb +4 -0
  13. data/lib/project_types/extension/commands/check.rb +6 -1
  14. data/lib/project_types/extension/forms/questions/ask_template.rb +1 -2
  15. data/lib/project_types/extension/messages/messages.rb +1 -3
  16. data/lib/project_types/extension/models/development_server_requirements.rb +1 -0
  17. data/lib/project_types/extension/models/specification_handlers/beacon_extension.rb +57 -0
  18. data/lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config.rb +33 -0
  19. data/lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config_repository.rb +75 -0
  20. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +16 -1
  21. data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +4 -1
  22. data/lib/project_types/extension/tasks/configure_options.rb +2 -1
  23. data/lib/project_types/extension/tasks/convert_server_config.rb +13 -2
  24. data/lib/project_types/extension/tasks/merge_server_config.rb +5 -2
  25. data/lib/project_types/script/cli.rb +1 -0
  26. data/lib/project_types/script/layers/application/create_script.rb +14 -6
  27. data/lib/project_types/script/layers/infrastructure/errors.rb +17 -0
  28. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +6 -21
  29. data/lib/project_types/script/layers/infrastructure/script_service.rb +2 -0
  30. data/lib/project_types/script/layers/infrastructure/sparse_checkout_details.rb +35 -0
  31. data/lib/project_types/script/messages/messages.rb +3 -0
  32. data/lib/project_types/script/ui/error_handler.rb +11 -0
  33. data/lib/project_types/theme/cli.rb +1 -0
  34. data/lib/project_types/theme/commands/check.rb +4 -1
  35. data/lib/project_types/theme/commands/open.rb +2 -2
  36. data/lib/project_types/theme/commands/push.rb +1 -3
  37. data/lib/project_types/theme/commands/serve.rb +1 -0
  38. data/lib/project_types/theme/commands/share.rb +56 -0
  39. data/lib/project_types/theme/messages/messages.rb +64 -11
  40. data/lib/shopify_cli/changelog.rb +97 -25
  41. data/lib/shopify_cli/command_options/command_serve_options.rb +10 -0
  42. data/lib/shopify_cli/commands/app/serve.rb +7 -7
  43. data/lib/shopify_cli/commands/login.rb +5 -2
  44. data/lib/shopify_cli/context.rb +13 -0
  45. data/lib/shopify_cli/git.rb +36 -0
  46. data/lib/shopify_cli/identity_auth.rb +24 -4
  47. data/lib/shopify_cli/messages/messages.rb +22 -11
  48. data/lib/shopify_cli/release.rb +120 -20
  49. data/lib/shopify_cli/services/app/create/rails_service.rb +9 -1
  50. data/lib/shopify_cli/services/app/serve/node_service.rb +2 -25
  51. data/lib/shopify_cli/services/app/serve/php_service.rb +2 -25
  52. data/lib/shopify_cli/services/app/serve/rails_service.rb +8 -28
  53. data/lib/shopify_cli/services/app/serve/serve_service.rb +57 -0
  54. data/lib/shopify_cli/services.rb +1 -0
  55. data/lib/shopify_cli/tasks/update_dashboard_urls.rb +7 -9
  56. data/lib/shopify_cli/theme/dev_server/hot-reload.js +40 -13
  57. data/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +1 -1
  58. data/lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb +51 -0
  59. data/lib/shopify_cli/theme/dev_server/hot_reload.rb +6 -1
  60. data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
  61. data/lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb +35 -0
  62. data/lib/shopify_cli/theme/dev_server/remote_watcher.rb +44 -0
  63. data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -8
  64. data/lib/shopify_cli/theme/dev_server.rb +18 -5
  65. data/lib/shopify_cli/theme/file.rb +15 -4
  66. data/lib/shopify_cli/theme/syncer/checksums.rb +60 -0
  67. data/lib/shopify_cli/theme/syncer/forms/apply_to_all.rb +39 -0
  68. data/lib/shopify_cli/theme/syncer/forms/apply_to_all_form.rb +35 -0
  69. data/lib/shopify_cli/theme/syncer/forms/base_strategy_form.rb +62 -0
  70. data/lib/shopify_cli/theme/syncer/forms/select_delete_strategy.rb +27 -0
  71. data/lib/shopify_cli/theme/syncer/forms/select_update_strategy.rb +28 -0
  72. data/lib/shopify_cli/theme/syncer/ignore_helper.rb +33 -0
  73. data/lib/shopify_cli/theme/syncer/json_delete_handler.rb +51 -0
  74. data/lib/shopify_cli/theme/syncer/json_update_handler.rb +82 -0
  75. data/lib/shopify_cli/theme/syncer/merger.rb +53 -0
  76. data/lib/shopify_cli/theme/syncer/operation.rb +1 -1
  77. data/lib/shopify_cli/theme/syncer.rb +79 -63
  78. data/lib/shopify_cli/theme/theme.rb +21 -7
  79. data/lib/shopify_cli/theme/theme_admin_api.rb +23 -8
  80. data/lib/shopify_cli/thread_pool/job.rb +10 -2
  81. data/lib/shopify_cli/thread_pool.rb +15 -3
  82. data/lib/shopify_cli/tunnel.rb +3 -13
  83. data/lib/shopify_cli/version.rb +1 -1
  84. data/vendor/deps/cli-ui/lib/cli/ui/os.rb +8 -0
  85. metadata +25 -2
@@ -41,31 +41,46 @@ module ShopifyCLI
41
41
  )
42
42
  rescue ShopifyCLI::API::APIRequestForbiddenError,
43
43
  ShopifyCLI::API::APIRequestUnauthorizedError => error
44
+
45
+ ##
44
46
  # The Admin API returns 403 Forbidden responses on different
45
47
  # scenarios:
46
48
  #
47
49
  # * when a user doesn't have permissions for a request:
48
- # <APIRequestForbiddenError: 403 {}>
50
+ # - <APIRequestForbiddenError: 403 {}>
51
+ # - <APIRequestForbiddenError: 403 {"errors":"Unauthorized Access"}>
49
52
  #
50
53
  # * when an asset operation cannot be performed:
51
- # <APIRequestForbiddenError: 403 {"message":"templates/gift_card.liquid could not be deleted"}>
52
- if empty_response_error?(error)
53
- return handle_permissions_error
54
+ # - <APIRequestForbiddenError: 403 {"message":"templates/gift_card.liquid could not be deleted"}>
55
+ #
56
+ if empty_response?(error) || unauthorized_response?(error)
57
+ return permission_error
54
58
  end
55
59
 
56
60
  raise error
57
61
  end
58
62
 
59
- def handle_permissions_error
63
+ def permission_error
60
64
  ensure_user_error = @ctx.message("theme.ensure_user_error", shop)
61
65
  ensure_user_try_this = @ctx.message("theme.ensure_user_try_this")
62
66
 
63
67
  @ctx.abort(ensure_user_error, ensure_user_try_this)
64
68
  end
65
69
 
66
- def empty_response_error?(error)
67
- error_message = error&.response&.body.to_s
68
- error_message.empty?
70
+ def empty_response?(error)
71
+ response_body(error).empty?
72
+ end
73
+
74
+ def unauthorized_response?(error)
75
+ parsed_body = JSON.parse(response_body(error))
76
+ errors = parsed_body["errors"].to_s
77
+ errors.match?(/Unauthorized Access/)
78
+ rescue JSON::ParserError
79
+ false
80
+ end
81
+
82
+ def response_body(error)
83
+ error&.response&.body.to_s
69
84
  end
70
85
  end
71
86
  end
@@ -3,10 +3,14 @@
3
3
  module ShopifyCLI
4
4
  class ThreadPool
5
5
  class Job
6
- attr_reader :error
6
+ attr_reader :error, :interval
7
+
8
+ def initialize(interval = 0)
9
+ @interval = interval
10
+ end
7
11
 
8
12
  def perform!
9
- raise "`#{self.class.name}#perform!` must be defined"
13
+ raise "`#{self.class.name}#perform!' must be defined"
10
14
  end
11
15
 
12
16
  def call
@@ -22,6 +26,10 @@ module ShopifyCLI
22
26
  def error?
23
27
  !!@error
24
28
  end
29
+
30
+ def recurring?
31
+ !interval.zero?
32
+ end
25
33
  end
26
34
  end
27
35
  end
@@ -27,11 +27,23 @@ module ShopifyCLI
27
27
  def spawn_thread
28
28
  Thread.new do
29
29
  catch(:stop_thread) do
30
- loop do
31
- @jobs.pop.call
32
- end
30
+ loop { perform(@jobs.pop) }
33
31
  end
34
32
  end
35
33
  end
34
+
35
+ def perform(job)
36
+ job.call
37
+ reschedule(job) if job.recurring?
38
+ end
39
+
40
+ def reschedule(job)
41
+ wait(job.interval)
42
+ schedule(job)
43
+ end
44
+
45
+ def wait(seconds)
46
+ sleep(seconds)
47
+ end
36
48
  end
37
49
  end
@@ -66,14 +66,9 @@ module ShopifyCLI
66
66
  #
67
67
  def start(ctx, port: PORT)
68
68
  install(ctx)
69
- if authenticated?
70
- url, account = start_ngrok(ctx, port)
71
- ctx.puts(ctx.message("core.tunnel.start_with_account", url, account))
72
- else
73
- url, _ = restart_ngrok(ctx, port)
74
- ctx.puts(ctx.message("core.tunnel.start", url))
75
- ctx.puts(ctx.message("core.tunnel.signup_suggestion", ShopifyCLI::TOOL_NAME))
76
- end
69
+ ctx.abort(ctx.message("core.tunnel.error.signup_required", ShopifyCLI::TOOL_NAME)) unless authenticated?
70
+ url, account = start_ngrok(ctx, port)
71
+ ctx.puts(ctx.message("core.tunnel.start_with_account", url, account))
77
72
  url
78
73
  end
79
74
 
@@ -208,11 +203,6 @@ module ShopifyCLI
208
203
  [log.url, log.account]
209
204
  end
210
205
 
211
- def restart_ngrok(ctx, port)
212
- ShopifyCLI::ProcessSupervision.stop(:ngrok)
213
- start_ngrok(ctx, port)
214
- end
215
-
216
206
  def check_prereq_command(ctx, command)
217
207
  cmd_path = ctx.which(command)
218
208
  ctx.abort(ctx.message("core.tunnel.error.prereq_command_required", command)) if cmd_path.nil?
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.15.1"
2
+ VERSION = "2.15.4"
3
3
  end
@@ -35,6 +35,10 @@ module CLI
35
35
  def shift_cursor_on_line_reset?
36
36
  false
37
37
  end
38
+
39
+ def path_separator
40
+ ":"
41
+ end
38
42
  end
39
43
  end
40
44
 
@@ -58,6 +62,10 @@ module CLI
58
62
  def shift_cursor_on_line_reset?
59
63
  true
60
64
  end
65
+
66
+ def path_separator
67
+ ";"
68
+ end
61
69
  end
62
70
  end
63
71
  end
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.15.1
4
+ version: 2.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-24 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -158,15 +158,19 @@ files:
158
158
  - ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256
159
159
  - ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256
160
160
  - ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256
161
+ - ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256
161
162
  - ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256
162
163
  - ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256
163
164
  - ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256
165
+ - ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256
164
166
  - ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256
165
167
  - ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256
166
168
  - ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256
169
+ - ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256
167
170
  - ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256
168
171
  - ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256
169
172
  - ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256
173
+ - ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256
170
174
  - ext/javy/javy.rb
171
175
  - ext/javy/version
172
176
  - ext/shopify-extensions/extconf.rb
@@ -247,6 +251,9 @@ files:
247
251
  - lib/project_types/extension/models/server_config/root.rb
248
252
  - lib/project_types/extension/models/server_config/user.rb
249
253
  - lib/project_types/extension/models/specification.rb
254
+ - lib/project_types/extension/models/specification_handlers/beacon_extension.rb
255
+ - lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config.rb
256
+ - lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config_repository.rb
250
257
  - lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb
251
258
  - lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
252
259
  - lib/project_types/extension/models/specification_handlers/default.rb
@@ -335,6 +342,7 @@ files:
335
342
  - lib/project_types/script/layers/infrastructure/script_service.rb
336
343
  - lib/project_types/script/layers/infrastructure/script_uploader.rb
337
344
  - lib/project_types/script/layers/infrastructure/service_locator.rb
345
+ - lib/project_types/script/layers/infrastructure/sparse_checkout_details.rb
338
346
  - lib/project_types/script/loaders/project.rb
339
347
  - lib/project_types/script/loaders/specification_handler.rb
340
348
  - lib/project_types/script/messages/messages.rb
@@ -354,6 +362,7 @@ files:
354
362
  - lib/project_types/theme/commands/pull.rb
355
363
  - lib/project_types/theme/commands/push.rb
356
364
  - lib/project_types/theme/commands/serve.rb
365
+ - lib/project_types/theme/commands/share.rb
357
366
  - lib/project_types/theme/conversions/base_glob.rb
358
367
  - lib/project_types/theme/conversions/ignore_glob.rb
359
368
  - lib/project_types/theme/conversions/include_glob.rb
@@ -465,6 +474,7 @@ files:
465
474
  - lib/shopify_cli/services/app/serve/node_service.rb
466
475
  - lib/shopify_cli/services/app/serve/php_service.rb
467
476
  - lib/shopify_cli/services/app/serve/rails_service.rb
477
+ - lib/shopify_cli/services/app/serve/serve_service.rb
468
478
  - lib/shopify_cli/services/app/tunnel/auth_service.rb
469
479
  - lib/shopify_cli/services/app/tunnel/start_service.rb
470
480
  - lib/shopify_cli/services/app/tunnel/stop_service.rb
@@ -490,10 +500,13 @@ files:
490
500
  - lib/shopify_cli/theme/dev_server/hot-reload.js
491
501
  - lib/shopify_cli/theme/dev_server/hot_reload.rb
492
502
  - lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb
503
+ - lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb
493
504
  - lib/shopify_cli/theme/dev_server/local_assets.rb
494
505
  - lib/shopify_cli/theme/dev_server/proxy.rb
495
506
  - lib/shopify_cli/theme/dev_server/proxy/template_param_builder.rb
496
507
  - lib/shopify_cli/theme/dev_server/reload_mode.rb
508
+ - lib/shopify_cli/theme/dev_server/remote_watcher.rb
509
+ - lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb
497
510
  - lib/shopify_cli/theme/dev_server/sse.rb
498
511
  - lib/shopify_cli/theme/dev_server/watcher.rb
499
512
  - lib/shopify_cli/theme/dev_server/web_server.rb
@@ -504,7 +517,17 @@ files:
504
517
  - lib/shopify_cli/theme/include_filter.rb
505
518
  - lib/shopify_cli/theme/mime_type.rb
506
519
  - lib/shopify_cli/theme/syncer.rb
520
+ - lib/shopify_cli/theme/syncer/checksums.rb
507
521
  - lib/shopify_cli/theme/syncer/error_reporter.rb
522
+ - lib/shopify_cli/theme/syncer/forms/apply_to_all.rb
523
+ - lib/shopify_cli/theme/syncer/forms/apply_to_all_form.rb
524
+ - lib/shopify_cli/theme/syncer/forms/base_strategy_form.rb
525
+ - lib/shopify_cli/theme/syncer/forms/select_delete_strategy.rb
526
+ - lib/shopify_cli/theme/syncer/forms/select_update_strategy.rb
527
+ - lib/shopify_cli/theme/syncer/ignore_helper.rb
528
+ - lib/shopify_cli/theme/syncer/json_delete_handler.rb
529
+ - lib/shopify_cli/theme/syncer/json_update_handler.rb
530
+ - lib/shopify_cli/theme/syncer/merger.rb
508
531
  - lib/shopify_cli/theme/syncer/operation.rb
509
532
  - lib/shopify_cli/theme/syncer/standard_reporter.rb
510
533
  - lib/shopify_cli/theme/theme.rb