shopify-cli 2.7.2 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +2 -2
  3. data/.github/workflows/shopify.yml +1 -1
  4. data/.gitignore +1 -0
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +52 -0
  7. data/Codespace.dockerfile +2 -2
  8. data/Gemfile.lock +4 -4
  9. data/RELEASING.md +4 -3
  10. data/Tests.dockerfile +2 -2
  11. data/dev.yml +3 -3
  12. data/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +1 -0
  13. data/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +1 -0
  14. data/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +1 -0
  15. data/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +1 -0
  16. data/ext/javy/javy.rb +31 -13
  17. data/lib/graphql/get_extension_registrations.graphql +27 -0
  18. data/lib/project_types/extension/cli.rb +27 -2
  19. data/lib/project_types/extension/commands/build.rb +10 -10
  20. data/lib/project_types/extension/commands/create.rb +2 -3
  21. data/lib/project_types/extension/commands/push.rb +36 -8
  22. data/lib/project_types/extension/extension_project.rb +1 -1
  23. data/lib/project_types/extension/features/argo_serve.rb +6 -5
  24. data/lib/project_types/extension/forms/questions/ask_registration.rb +6 -2
  25. data/lib/project_types/extension/loaders/project.rb +29 -0
  26. data/lib/project_types/extension/loaders/specification_handler.rb +22 -0
  27. data/lib/project_types/extension/messages/messages.rb +4 -0
  28. data/lib/project_types/extension/models/app.rb +1 -1
  29. data/lib/project_types/extension/models/development_server.rb +2 -4
  30. data/lib/project_types/extension/models/specification_handlers/default.rb +4 -0
  31. data/lib/project_types/extension/tasks/convert_server_config.rb +3 -1
  32. data/lib/project_types/extension/tasks/execute_commands/base.rb +13 -0
  33. data/lib/project_types/extension/tasks/execute_commands/build.rb +29 -0
  34. data/lib/project_types/extension/tasks/execute_commands/create.rb +33 -0
  35. data/lib/project_types/extension/tasks/execute_commands/serve.rb +35 -0
  36. data/lib/project_types/extension/tasks/merge_server_config.rb +33 -22
  37. data/lib/project_types/rails/commands/create.rb +1 -1
  38. data/lib/project_types/rails/gem.rb +1 -2
  39. data/lib/project_types/script/cli.rb +8 -1
  40. data/lib/project_types/script/commands/connect.rb +19 -0
  41. data/lib/project_types/script/commands/create.rb +8 -2
  42. data/lib/project_types/script/commands/push.rb +35 -12
  43. data/lib/project_types/script/config/extension_points.yml +10 -2
  44. data/lib/project_types/script/graphql/app_script_set.graphql +2 -2
  45. data/lib/project_types/script/layers/application/connect_app.rb +15 -3
  46. data/lib/project_types/script/layers/application/create_script.rb +17 -17
  47. data/lib/project_types/script/layers/application/extension_points.rb +50 -26
  48. data/lib/project_types/script/layers/application/push_script.rb +6 -3
  49. data/lib/project_types/script/layers/domain/errors.rb +1 -4
  50. data/lib/project_types/script/layers/domain/extension_point.rb +14 -0
  51. data/lib/project_types/script/layers/domain/push_package.rb +3 -3
  52. data/lib/project_types/script/layers/domain/{script_json.rb → script_config.rb} +2 -2
  53. data/lib/project_types/script/layers/domain/script_project.rb +1 -1
  54. data/lib/project_types/script/layers/infrastructure/errors.rb +30 -5
  55. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -2
  56. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +125 -27
  57. data/lib/project_types/script/layers/infrastructure/script_service.rb +11 -11
  58. data/lib/project_types/script/loaders/project.rb +44 -0
  59. data/lib/project_types/script/loaders/specification_handler.rb +22 -0
  60. data/lib/project_types/script/messages/messages.rb +34 -3
  61. data/lib/project_types/script/ui/error_handler.rb +35 -15
  62. data/lib/project_types/theme/commands/pull.rb +39 -16
  63. data/lib/project_types/theme/commands/push.rb +60 -29
  64. data/lib/project_types/theme/commands/serve.rb +5 -0
  65. data/lib/project_types/theme/messages/messages.rb +30 -18
  66. data/lib/shopify_cli/command.rb +6 -0
  67. data/lib/shopify_cli/commands/login.rb +11 -5
  68. data/lib/shopify_cli/commands/switch.rb +1 -1
  69. data/lib/shopify_cli/constants.rb +5 -0
  70. data/lib/shopify_cli/context.rb +66 -11
  71. data/lib/shopify_cli/environment.rb +15 -4
  72. data/lib/shopify_cli/form.rb +2 -0
  73. data/lib/shopify_cli/git.rb +2 -0
  74. data/lib/shopify_cli/identity_auth.rb +1 -0
  75. data/lib/shopify_cli/messages/messages.rb +10 -2
  76. data/lib/shopify_cli/partners_api/app_extensions/job.rb +36 -0
  77. data/lib/shopify_cli/partners_api/app_extensions.rb +46 -0
  78. data/lib/shopify_cli/partners_api/organizations.rb +2 -5
  79. data/lib/shopify_cli/partners_api.rb +1 -0
  80. data/lib/shopify_cli/project.rb +8 -7
  81. data/lib/shopify_cli/resources/env_file.rb +18 -6
  82. data/lib/shopify_cli/services/app/create/rails_service.rb +1 -1
  83. data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +73 -0
  84. data/lib/shopify_cli/theme/dev_server/hot-reload.js +57 -10
  85. data/lib/shopify_cli/theme/dev_server/hot_reload.rb +18 -2
  86. data/lib/shopify_cli/theme/dev_server/proxy/template_param_builder.rb +84 -0
  87. data/lib/shopify_cli/theme/dev_server/proxy.rb +10 -15
  88. data/lib/shopify_cli/theme/dev_server/reload_mode.rb +34 -0
  89. data/lib/shopify_cli/theme/dev_server.rb +8 -21
  90. data/lib/shopify_cli/theme/theme.rb +26 -4
  91. data/lib/shopify_cli/thread_pool/job.rb +27 -0
  92. data/lib/shopify_cli/thread_pool.rb +37 -0
  93. data/lib/shopify_cli/tunnel.rb +1 -0
  94. data/lib/shopify_cli/version.rb +1 -1
  95. data/lib/shopify_cli.rb +4 -0
  96. data/shopify-cli.gemspec +1 -1
  97. data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +3 -1
  98. metadata +26 -7
  99. data/lib/graphql/all_orgs_with_extensions.graphql +0 -37
  100. data/lib/project_types/extension/tasks/run_extension_command.rb +0 -82
@@ -3,8 +3,10 @@ require_relative "development_theme"
3
3
  require_relative "ignore_filter"
4
4
  require_relative "syncer"
5
5
 
6
+ require_relative "dev_server/cdn_fonts"
6
7
  require_relative "dev_server/hot_reload"
7
8
  require_relative "dev_server/header_hash"
9
+ require_relative "dev_server/reload_mode"
8
10
  require_relative "dev_server/local_assets"
9
11
  require_relative "dev_server/proxy"
10
12
  require_relative "dev_server/sse"
@@ -24,7 +26,7 @@ module ShopifyCLI
24
26
  class << self
25
27
  attr_accessor :ctx
26
28
 
27
- def start(ctx, root, host: "127.0.0.1", port: 9292, poll: false)
29
+ def start(ctx, root, host: "127.0.0.1", port: 9292, poll: false, mode: ReloadMode.default)
28
30
  @ctx = ctx
29
31
  theme = DevelopmentTheme.new(ctx, root: root)
30
32
  ignore_filter = IgnoreFilter.from_path(root)
@@ -33,8 +35,9 @@ module ShopifyCLI
33
35
 
34
36
  # Setup the middleware stack. Mimics Rack::Builder / config.ru, but in reverse order
35
37
  @app = Proxy.new(ctx, theme: theme, syncer: @syncer)
38
+ @app = CdnFonts.new(@app, theme: theme)
36
39
  @app = LocalAssets.new(ctx, @app, theme: theme)
37
- @app = HotReload.new(ctx, @app, theme: theme, watcher: watcher, ignore_filter: ignore_filter)
40
+ @app = HotReload.new(ctx, @app, theme: theme, watcher: watcher, mode: mode, ignore_filter: ignore_filter)
38
41
  stopped = false
39
42
  address = "http://#{host}:#{port}"
40
43
 
@@ -81,7 +84,9 @@ module ShopifyCLI
81
84
  ShopifyCLI::API::APIRequestUnauthorizedError
82
85
  raise ShopifyCLI::Abort, @ctx.message("theme.serve.ensure_user", theme.shop)
83
86
  rescue Errno::EADDRINUSE
84
- abort_address_already_in_use(address)
87
+ error_message = @ctx.message("theme.serve.address_already_in_use", address)
88
+ help_message = @ctx.message("theme.serve.try_port_option")
89
+ @ctx.abort(error_message, help_message)
85
90
  rescue Errno::EADDRNOTAVAIL
86
91
  raise AddressBindingError, "Error binding to the address #{host}."
87
92
  end
@@ -92,24 +97,6 @@ module ShopifyCLI
92
97
  @syncer.shutdown
93
98
  WebServer.shutdown
94
99
  end
95
-
96
- private
97
-
98
- def abort_address_already_in_use(address)
99
- open_frame(@ctx.message("theme.serve.already_in_use_error"), color: :red) do
100
- @ctx.puts(@ctx.message("theme.serve.address_already_in_use", address))
101
- end
102
-
103
- open_frame(@ctx.message("theme.serve.try_this"), color: :green) do
104
- @ctx.puts(@ctx.message("theme.serve.try_port_option"))
105
- end
106
-
107
- raise ShopifyCLI::AbortSilent
108
- end
109
-
110
- def open_frame(title, color:, &block)
111
- CLI::UI::Frame.open(title, color: CLI::UI.resolve_color(color), timing: false, &block)
112
- end
113
100
  end
114
101
  end
115
102
  end
@@ -173,15 +173,37 @@ module ShopifyCLI
173
173
  end
174
174
 
175
175
  def live(ctx, root: nil)
176
- _status, body = fetch_themes(ctx)
176
+ find(ctx, root) { |attrs| attrs["role"] == "main" }
177
+ end
177
178
 
178
- body["themes"]
179
- .find { |theme_attrs| theme_attrs["role"] == "main" }
180
- .tap { |theme_attrs| break new(ctx, root: root, **allowed_attrs(theme_attrs)) }
179
+ def development(ctx, root: nil)
180
+ find(ctx, root) { |attrs| attrs["role"] == "development" }
181
+ end
182
+
183
+ # Finds a Theme by its identifier
184
+ #
185
+ # #### Parameters
186
+ # * `ctx` - current running context of your command
187
+ # * `root` - theme root
188
+ # * `identifier` - theme ID or theme name
189
+ def find_by_identifier(ctx, root: nil, identifier:)
190
+ find(ctx, root) do |attrs|
191
+ attrs.slice("name", "id").values.map(&:to_s).include?(identifier)
192
+ end
181
193
  end
182
194
 
183
195
  private
184
196
 
197
+ def find(ctx, root, &block)
198
+ _status, body = fetch_themes(ctx)
199
+
200
+ body["themes"]
201
+ .find(&block)
202
+ .tap do |attrs|
203
+ break new(ctx, root: root, **allowed_attrs(attrs)) if attrs
204
+ end
205
+ end
206
+
185
207
  def allowed_attrs(attrs)
186
208
  attrs.slice("id", "name", "role").transform_keys(&:to_sym)
187
209
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ShopifyCLI
4
+ class ThreadPool
5
+ class Job
6
+ attr_reader :error
7
+
8
+ def perform!
9
+ raise "`#{self.class.name}#perform!` must be defined"
10
+ end
11
+
12
+ def call
13
+ perform!
14
+ rescue StandardError => error
15
+ @error = error
16
+ end
17
+
18
+ def success?
19
+ !@error
20
+ end
21
+
22
+ def error?
23
+ !!@error
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ShopifyCLI
4
+ class ThreadPool
5
+ attr_reader :errors
6
+
7
+ def initialize(pool_size: 10)
8
+ @jobs = Queue.new
9
+ @pool = Array.new(pool_size) { spawn_thread }
10
+ end
11
+
12
+ def schedule(job)
13
+ @jobs << job
14
+ end
15
+
16
+ def shutdown
17
+ @pool.size.times do
18
+ schedule(-> { throw(:stop_thread) })
19
+ end
20
+ @pool.map(&:join)
21
+ ensure
22
+ @jobs.close
23
+ end
24
+
25
+ private
26
+
27
+ def spawn_thread
28
+ Thread.new do
29
+ catch(:stop_thread) do
30
+ loop do
31
+ @jobs.pop.call
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -21,6 +21,7 @@ module ShopifyCLI
21
21
  # mapping for supported operating systems for where to download ngrok from.
22
22
  DOWNLOAD_URLS = {
23
23
  mac: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip",
24
+ mac_m1: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-arm64.zip",
24
25
  linux: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip",
25
26
  windows: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip",
26
27
  }
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.7.2"
2
+ VERSION = "2.9.0"
3
3
  end
data/lib/shopify_cli.rb CHANGED
@@ -139,6 +139,10 @@ module ShopifyCLI
139
139
  require "shopify_cli/messages/messages"
140
140
  Context.load_messages(ShopifyCLI::Messages::MESSAGES)
141
141
 
142
+ # cli-ui utilities for capturing the output close the stream while capturing.
143
+ # By setting the value here we persist the tty value for the whole lifetime of the process.
144
+ Environment.interactive = $stdin.tty?
145
+
142
146
  def self.cache_dir
143
147
  cache_dir = if Environment.test?
144
148
  TEMP_DIR
data/shopify-cli.gemspec CHANGED
@@ -41,5 +41,5 @@ Gem::Specification.new do |spec|
41
41
 
42
42
  spec.add_dependency("bugsnag", "~> 6.22")
43
43
  spec.add_dependency("listen", "~> 3.7.0")
44
- spec.add_dependency("theme-check", "~> 1.8.0")
44
+ spec.add_dependency("theme-check", "~> 1.9.0")
45
45
  end
@@ -114,7 +114,9 @@ module CLI
114
114
  end
115
115
 
116
116
  def print_error_message(e)
117
- $stderr.puts(format_error_message(e.message))
117
+ CLI::UI::Frame.open("Error", color: :red, timing: false) do
118
+ $stderr.puts(format_error_message(e.message))
119
+ end
118
120
  end
119
121
  end
120
122
  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.7.2
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-30 00:00:00.000000000 Z
11
+ date: 2022-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 1.8.0
95
+ version: 1.9.0
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 1.8.0
102
+ version: 1.9.0
103
103
  description: |
104
104
  Shopify CLI helps you build Shopify apps faster. It quickly scaffolds Node.js
105
105
  and Ruby on Rails embedded apps. It also automates many common tasks in the
@@ -150,6 +150,10 @@ files:
150
150
  - docs/contributors/testing.md
151
151
  - docs/users/installation.md
152
152
  - docs/users/migrate-from-themekit.md
153
+ - ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256
154
+ - ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256
155
+ - ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256
156
+ - ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256
153
157
  - ext/javy/javy.rb
154
158
  - ext/javy/version
155
159
  - ext/shopify-extensions/extconf.rb
@@ -161,7 +165,6 @@ files:
161
165
  - lib/graphql/admin_introspection.graphql
162
166
  - lib/graphql/all_organizations.graphql
163
167
  - lib/graphql/all_orgs_with_apps.graphql
164
- - lib/graphql/all_orgs_with_extensions.graphql
165
168
  - lib/graphql/api_versions.graphql
166
169
  - lib/graphql/convert_dev_to_test_store.graphql
167
170
  - lib/graphql/create_app.graphql
@@ -174,6 +177,7 @@ files:
174
177
  - lib/graphql/find_organization.graphql
175
178
  - lib/graphql/get_app_by_api_key.graphql
176
179
  - lib/graphql/get_app_urls.graphql
180
+ - lib/graphql/get_extension_registrations.graphql
177
181
  - lib/graphql/get_variant_id.graphql
178
182
  - lib/graphql/update_dashboard_urls.graphql
179
183
  - lib/project_types/extension/cli.rb
@@ -209,6 +213,8 @@ files:
209
213
  - lib/project_types/extension/forms/questions/ask_registration.rb
210
214
  - lib/project_types/extension/forms/questions/ask_template.rb
211
215
  - lib/project_types/extension/forms/questions/ask_type.rb
216
+ - lib/project_types/extension/loaders/project.rb
217
+ - lib/project_types/extension/loaders/specification_handler.rb
212
218
  - lib/project_types/extension/messages/message_loading.rb
213
219
  - lib/project_types/extension/messages/messages.rb
214
220
  - lib/project_types/extension/models/app.rb
@@ -246,6 +252,10 @@ files:
246
252
  - lib/project_types/extension/tasks/converters/version_converter.rb
247
253
  - lib/project_types/extension/tasks/create_extension.rb
248
254
  - lib/project_types/extension/tasks/ensure_resource_url.rb
255
+ - lib/project_types/extension/tasks/execute_commands/base.rb
256
+ - lib/project_types/extension/tasks/execute_commands/build.rb
257
+ - lib/project_types/extension/tasks/execute_commands/create.rb
258
+ - lib/project_types/extension/tasks/execute_commands/serve.rb
249
259
  - lib/project_types/extension/tasks/fetch_specifications.rb
250
260
  - lib/project_types/extension/tasks/find_npm_packages.rb
251
261
  - lib/project_types/extension/tasks/find_package_from_json.rb
@@ -254,7 +264,6 @@ files:
254
264
  - lib/project_types/extension/tasks/get_extensions.rb
255
265
  - lib/project_types/extension/tasks/get_product.rb
256
266
  - lib/project_types/extension/tasks/merge_server_config.rb
257
- - lib/project_types/extension/tasks/run_extension_command.rb
258
267
  - lib/project_types/extension/tasks/update_draft.rb
259
268
  - lib/project_types/extension/tasks/user_errors.rb
260
269
  - lib/project_types/node/cli.rb
@@ -270,6 +279,7 @@ files:
270
279
  - lib/project_types/rails/messages/messages.rb
271
280
  - lib/project_types/rails/ruby.rb
272
281
  - lib/project_types/script/cli.rb
282
+ - lib/project_types/script/commands/connect.rb
273
283
  - lib/project_types/script/commands/create.rb
274
284
  - lib/project_types/script/commands/javy.rb
275
285
  - lib/project_types/script/commands/push.rb
@@ -294,7 +304,7 @@ files:
294
304
  - lib/project_types/script/layers/domain/extension_point.rb
295
305
  - lib/project_types/script/layers/domain/metadata.rb
296
306
  - lib/project_types/script/layers/domain/push_package.rb
297
- - lib/project_types/script/layers/domain/script_json.rb
307
+ - lib/project_types/script/layers/domain/script_config.rb
298
308
  - lib/project_types/script/layers/domain/script_project.rb
299
309
  - lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb
300
310
  - lib/project_types/script/layers/infrastructure/api_clients/script_service_api_client.rb
@@ -312,6 +322,8 @@ files:
312
322
  - lib/project_types/script/layers/infrastructure/script_service.rb
313
323
  - lib/project_types/script/layers/infrastructure/script_uploader.rb
314
324
  - lib/project_types/script/layers/infrastructure/service_locator.rb
325
+ - lib/project_types/script/loaders/project.rb
326
+ - lib/project_types/script/loaders/specification_handler.rb
315
327
  - lib/project_types/script/messages/messages.rb
316
328
  - lib/project_types/script/ui/error_handler.rb
317
329
  - lib/project_types/script/ui/printing_spinner.rb
@@ -403,6 +415,8 @@ files:
403
415
  - lib/shopify_cli/options.rb
404
416
  - lib/shopify_cli/packager.rb
405
417
  - lib/shopify_cli/partners_api.rb
418
+ - lib/shopify_cli/partners_api/app_extensions.rb
419
+ - lib/shopify_cli/partners_api/app_extensions/job.rb
406
420
  - lib/shopify_cli/partners_api/organizations.rb
407
421
  - lib/shopify_cli/php_deps.rb
408
422
  - lib/shopify_cli/process_supervision.rb
@@ -444,12 +458,15 @@ files:
444
458
  - lib/shopify_cli/tasks/select_org_and_shop.rb
445
459
  - lib/shopify_cli/tasks/update_dashboard_urls.rb
446
460
  - lib/shopify_cli/theme/dev_server.rb
461
+ - lib/shopify_cli/theme/dev_server/cdn_fonts.rb
447
462
  - lib/shopify_cli/theme/dev_server/certificate_manager.rb
448
463
  - lib/shopify_cli/theme/dev_server/header_hash.rb
449
464
  - lib/shopify_cli/theme/dev_server/hot-reload.js
450
465
  - lib/shopify_cli/theme/dev_server/hot_reload.rb
451
466
  - lib/shopify_cli/theme/dev_server/local_assets.rb
452
467
  - lib/shopify_cli/theme/dev_server/proxy.rb
468
+ - lib/shopify_cli/theme/dev_server/proxy/template_param_builder.rb
469
+ - lib/shopify_cli/theme/dev_server/reload_mode.rb
453
470
  - lib/shopify_cli/theme/dev_server/sse.rb
454
471
  - lib/shopify_cli/theme/dev_server/watcher.rb
455
472
  - lib/shopify_cli/theme/dev_server/web_server.rb
@@ -462,6 +479,8 @@ files:
462
479
  - lib/shopify_cli/theme/syncer/operation.rb
463
480
  - lib/shopify_cli/theme/syncer/standard_reporter.rb
464
481
  - lib/shopify_cli/theme/theme.rb
482
+ - lib/shopify_cli/thread_pool.rb
483
+ - lib/shopify_cli/thread_pool/job.rb
465
484
  - lib/shopify_cli/transform_data_structure.rb
466
485
  - lib/shopify_cli/tunnel.rb
467
486
  - lib/shopify_cli/version.rb
@@ -1,37 +0,0 @@
1
- query AllOrgs ($type: String) {
2
- organizations {
3
- nodes {
4
- id
5
- businessName
6
- website
7
- apps(first: 500) {
8
- nodes {
9
- id
10
- title
11
- apiKey
12
- apiSecretKeys{
13
- secret
14
- }
15
- appType
16
- extensionRegistrations(specificationIdentifier: $type) {
17
- id
18
- type
19
- uuid
20
- title
21
- draftVersion {
22
- registrationId
23
- context
24
- lastUserInteractionAt
25
- location
26
- validationErrors { field message }
27
-
28
- id
29
- uuid
30
- versionTag
31
- }
32
- }
33
- }
34
- }
35
- }
36
- }
37
- }
@@ -1,82 +0,0 @@
1
-
2
- # frozen_string_literal: true
3
- require "shopify_cli"
4
-
5
- module Extension
6
- module Tasks
7
- class RunExtensionCommand < ShopifyCLI::Task
8
- include SmartProperties
9
-
10
- SUPPORTED_COMMANDS = [
11
- "create",
12
- "build",
13
- "serve",
14
- ]
15
-
16
- property! :command, accepts: SUPPORTED_COMMANDS
17
- property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
18
- property! :context, accepts: ShopifyCLI::Context
19
- property :config_file_name, accepts: String
20
- property :port, accepts: Integer, default: 39351
21
- property :resource_url, accepts: String
22
- property :root_dir, accepts: String
23
- property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES
24
- property :tunnel_url, accepts: String
25
-
26
- def call
27
- ShopifyCLI::Result.success(config_file_exists?)
28
- .then(&method(:load_or_build_server_config))
29
- .then(&method(:run_command))
30
- .unwrap do |error|
31
- raise error unless error.nil?
32
- end
33
- end
34
-
35
- private
36
-
37
- def config_file_exists?
38
- return false if config_file_name.nil?
39
- project = ExtensionProject.current
40
- File.exist?(File.join(project.directory, config_file_name))
41
- end
42
-
43
- def load_or_build_server_config(config_file_exists)
44
- return merge_server_config if config_file_exists
45
- build_server_config
46
- end
47
-
48
- def merge_server_config
49
- Tasks::MergeServerConfig.call(
50
- context: context,
51
- file_name: config_file_name,
52
- resource_url: resource_url,
53
- tunnel_url: tunnel_url,
54
- type: type
55
- )
56
- end
57
-
58
- def build_server_config
59
- extension = Models::ServerConfig::Extension.build(
60
- template: template,
61
- type: type,
62
- root_dir: root_dir,
63
- )
64
-
65
- Models::ServerConfig::Root.new(port: port, extensions: [extension])
66
- end
67
-
68
- def run_command(server_config)
69
- case command
70
- when "create"
71
- Models::DevelopmentServer.new.create(server_config)
72
- when "build"
73
- Models::DevelopmentServer.new.build(server_config)
74
- when "serve"
75
- Models::DevelopmentServer.new.serve(context, server_config)
76
- else
77
- raise NotImplementedError
78
- end
79
- end
80
- end
81
- end
82
- end