shopify-cli 2.15.6 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +4 -4
  3. data/.github/workflows/shopify.yml +0 -33
  4. data/CHANGELOG.md +35 -1
  5. data/Gemfile.lock +4 -4
  6. data/Tests.dockerfile +1 -1
  7. data/ext/shopify-extensions/version +1 -1
  8. data/lib/graphql/find_organization_with_apps.graphql +20 -0
  9. data/lib/project_types/extension/cli.rb +3 -0
  10. data/lib/project_types/extension/commands/build.rb +0 -2
  11. data/lib/project_types/extension/commands/create.rb +6 -0
  12. data/lib/project_types/extension/commands/serve.rb +8 -3
  13. data/lib/project_types/extension/features/argo.rb +0 -31
  14. data/lib/project_types/extension/features/argo_config.rb +0 -1
  15. data/lib/project_types/extension/features/argo_serve.rb +1 -1
  16. data/lib/project_types/extension/messages/messages.rb +23 -0
  17. data/lib/project_types/extension/models/development_server.rb +2 -1
  18. data/lib/project_types/extension/models/development_server_requirements.rb +24 -4
  19. data/lib/project_types/extension/models/npm_package.rb +15 -3
  20. data/lib/project_types/extension/models/server_config/capabilities.rb +11 -0
  21. data/lib/project_types/extension/models/server_config/development_renderer.rb +6 -1
  22. data/lib/project_types/extension/models/server_config/extension.rb +10 -3
  23. data/lib/project_types/extension/models/server_config/root.rb +0 -2
  24. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +1 -1
  25. data/lib/project_types/extension/tasks/configure_features.rb +4 -0
  26. data/lib/project_types/extension/tasks/convert_server_config.rb +8 -4
  27. data/lib/project_types/extension/tasks/execute_commands/base.rb +2 -0
  28. data/lib/project_types/extension/tasks/execute_commands/build.rb +2 -1
  29. data/lib/project_types/extension/tasks/execute_commands/create.rb +0 -3
  30. data/lib/project_types/extension/tasks/execute_commands/outdated_extension_detection.rb +53 -0
  31. data/lib/project_types/extension/tasks/execute_commands/serve.rb +2 -1
  32. data/lib/project_types/extension/tasks/get_apps.rb +6 -9
  33. data/lib/project_types/extension/tasks/get_extensions.rb +12 -11
  34. data/lib/project_types/extension/tasks/merge_server_config.rb +4 -3
  35. data/lib/project_types/script/cli.rb +1 -0
  36. data/lib/project_types/script/config/extension_points.yml +17 -3
  37. data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
  38. data/lib/project_types/script/layers/application/connect_app.rb +1 -1
  39. data/lib/project_types/script/layers/application/push_script.rb +1 -0
  40. data/lib/project_types/script/layers/domain/app_bridge.rb +16 -0
  41. data/lib/project_types/script/layers/domain/script_project.rb +1 -0
  42. data/lib/project_types/script/layers/infrastructure/errors.rb +0 -3
  43. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +3 -2
  44. data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +2 -2
  45. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +12 -0
  46. data/lib/project_types/script/layers/infrastructure/script_service.rb +5 -0
  47. data/lib/project_types/theme/commands/serve.rb +27 -0
  48. data/lib/project_types/theme/messages/messages.rb +13 -0
  49. data/lib/shopify_cli/admin_api.rb +5 -2
  50. data/lib/shopify_cli/commands/login.rb +2 -2
  51. data/lib/shopify_cli/commands/logout.rb +1 -1
  52. data/lib/shopify_cli/constants.rb +2 -0
  53. data/lib/shopify_cli/context.rb +14 -9
  54. data/lib/shopify_cli/environment.rb +8 -0
  55. data/lib/shopify_cli/partners_api/app_extensions.rb +6 -6
  56. data/lib/shopify_cli/partners_api/organizations.rb +12 -4
  57. data/lib/shopify_cli/services/app/create/rails_service.rb +1 -1
  58. data/lib/shopify_cli/tasks/ensure_env.rb +1 -1
  59. data/lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb +5 -6
  60. data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
  61. data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -1
  62. data/lib/shopify_cli/theme/dev_server.rb +1 -1
  63. data/lib/shopify_cli/theme/development_theme.rb +11 -1
  64. data/lib/shopify_cli/theme/file.rb +9 -0
  65. data/lib/shopify_cli/theme/theme.rb +4 -0
  66. data/lib/shopify_cli/theme/theme_admin_api.rb +3 -1
  67. data/lib/shopify_cli/version.rb +1 -1
  68. data/{shipit.yml → shipit.rubygems.yml} +0 -0
  69. data/shopify-cli.gemspec +1 -1
  70. metadata +9 -5
@@ -14,13 +14,12 @@ module ShopifyCLI
14
14
 
15
15
  files.each do |file|
16
16
  section_hash(file).each do |key, value|
17
- name = key
18
- type = value&.dig("type")
19
-
20
- next if !name || !type
17
+ next unless key
18
+ next unless value.is_a?(Hash)
19
+ next unless (type = value&.dig("type"))
21
20
 
22
21
  index[type] = [] unless index[type]
23
- index[type] << name
22
+ index[type] << key
24
23
  end
25
24
  end
26
25
 
@@ -42,7 +41,7 @@ module ShopifyCLI
42
41
  end
43
42
 
44
43
  def files
45
- @theme.json_files
44
+ @theme.json_files.filter(&:template?)
46
45
  end
47
46
  end
48
47
  end
@@ -44,7 +44,7 @@ module ShopifyCLI
44
44
 
45
45
  def serve_file(path_info)
46
46
  path = @theme.root.join(path_info[1..-1])
47
- if path.file? && path.readable? && @theme.theme_file?(path)
47
+ if path.file? && path.readable? && @theme.static_asset_file?(path)
48
48
  [
49
49
  200,
50
50
  {
@@ -14,7 +14,8 @@ module ShopifyCLI
14
14
  @theme = theme
15
15
  @syncer = syncer
16
16
  @ignore_filter = ignore_filter
17
- @listener = Listen.to(@theme.root, force_polling: poll) do |modified, added, removed|
17
+ @listener = Listen.to(@theme.root, force_polling: poll,
18
+ ignore: @ignore_filter&.regexes) do |modified, added, removed|
18
19
  changed
19
20
  notify_observers(modified, added, removed)
20
21
  end
@@ -32,7 +32,7 @@ module ShopifyCLI
32
32
  theme = DevelopmentTheme.find_or_create!(ctx, root: root)
33
33
  ignore_filter = IgnoreFilter.from_path(root)
34
34
  @syncer = Syncer.new(ctx, theme: theme, ignore_filter: ignore_filter, overwrite_json: !editor_sync)
35
- watcher = Watcher.new(ctx, theme: theme, syncer: @syncer, poll: poll)
35
+ watcher = Watcher.new(ctx, theme: theme, ignore_filter: ignore_filter, syncer: @syncer, poll: poll)
36
36
  remote_watcher = RemoteWatcher.to(theme: theme, syncer: @syncer)
37
37
 
38
38
  # Setup the middleware stack. Mimics Rack::Builder / config.ru, but in reverse order
@@ -79,13 +79,23 @@ module ShopifyCLI
79
79
 
80
80
  theme_name = "Development ()"
81
81
  hostname_character_limit = API_NAME_LIMIT - theme_name.length - hash.length - 1
82
- identifier = "#{hash}-#{hostname[0, hostname_character_limit]}"
82
+ identifier = encode_identifier("#{hash}-#{hostname[0, hostname_character_limit]}")
83
83
  theme_name = "Development (#{identifier})"
84
84
 
85
85
  ShopifyCLI::DB.set(development_theme_name: theme_name)
86
86
 
87
87
  theme_name
88
88
  end
89
+
90
+ ##
91
+ # In some cases, the identifier string encoding may be obfuscated by the hostname,
92
+ # which may be an ASCII string.
93
+ #
94
+ # This method ensures the result identifier is a UTF-8 valid string.
95
+ #
96
+ def encode_identifier(identifier)
97
+ identifier.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "-")
98
+ end
89
99
  end
90
100
  end
91
101
  end
@@ -30,6 +30,15 @@ module ShopifyCLI
30
30
  else
31
31
  path.write(content, 0, mode: "wb")
32
32
  end
33
+ rescue Encoding::UndefinedConversionError
34
+ ##
35
+ # The CLI tries to write the file and normalize EOL characters to avoid
36
+ # errors on Windows when files are shared across different operational systems.
37
+ #
38
+ # The CLI fallbacks any error during the conversion by writing the file
39
+ # in binary mode when the normalization fails (e.g., ASCII files), so no data is lost.
40
+ #
41
+ path.write(content, 0, mode: "wb")
33
42
  end
34
43
 
35
44
  def delete
@@ -47,6 +47,10 @@ module ShopifyCLI
47
47
  theme_files.include?(self[file])
48
48
  end
49
49
 
50
+ def static_asset_file?(file)
51
+ static_asset_files.include?(self[file])
52
+ end
53
+
50
54
  def static_asset_paths
51
55
  static_asset_files.map(&:relative_path)
52
56
  end
@@ -53,8 +53,10 @@ module ShopifyCLI
53
53
  # * when an asset operation cannot be performed:
54
54
  # - <APIRequestForbiddenError: 403 {"message":"templates/gift_card.liquid could not be deleted"}>
55
55
  #
56
- if empty_response?(error) || unauthorized_response?(error)
56
+ if empty_response?(error)
57
57
  return permission_error
58
+ elsif unauthorized_response?(error)
59
+ raise ShopifyCLI::Abort, @ctx.message("theme.unauthorized_error", @shop)
58
60
  end
59
61
 
60
62
  raise error
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.15.6"
2
+ VERSION = "2.17.0"
3
3
  end
File without changes
data/shopify-cli.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.require_paths = ["lib", "vendor"]
36
36
  spec.executables << "shopify"
37
37
 
38
- spec.add_development_dependency("bundler", "~> 2.3.8")
38
+ spec.add_development_dependency("bundler", "~> 2.3.11")
39
39
  spec.add_development_dependency("rake", "~> 12.3", ">= 12.3.3")
40
40
  spec.add_development_dependency("minitest", "~> 5.0")
41
41
 
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.6
4
+ version: 2.17.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-04-12 00:00:00.000000000 Z
11
+ date: 2022-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.3.8
19
+ version: 2.3.11
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.3.8
26
+ version: 2.3.11
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +192,7 @@ files:
192
192
  - lib/graphql/extension_update_draft.graphql
193
193
  - lib/graphql/fetch_specifications.graphql
194
194
  - lib/graphql/find_organization.graphql
195
+ - lib/graphql/find_organization_with_apps.graphql
195
196
  - lib/graphql/get_app_by_api_key.graphql
196
197
  - lib/graphql/get_app_urls.graphql
197
198
  - lib/graphql/get_extension_registrations.graphql
@@ -243,6 +244,7 @@ files:
243
244
  - lib/project_types/extension/models/registration.rb
244
245
  - lib/project_types/extension/models/server_config/app.rb
245
246
  - lib/project_types/extension/models/server_config/base.rb
247
+ - lib/project_types/extension/models/server_config/capabilities.rb
246
248
  - lib/project_types/extension/models/server_config/development.rb
247
249
  - lib/project_types/extension/models/server_config/development_entries.rb
248
250
  - lib/project_types/extension/models/server_config/development_renderer.rb
@@ -275,6 +277,7 @@ files:
275
277
  - lib/project_types/extension/tasks/execute_commands/base.rb
276
278
  - lib/project_types/extension/tasks/execute_commands/build.rb
277
279
  - lib/project_types/extension/tasks/execute_commands/create.rb
280
+ - lib/project_types/extension/tasks/execute_commands/outdated_extension_detection.rb
278
281
  - lib/project_types/extension/tasks/execute_commands/serve.rb
279
282
  - lib/project_types/extension/tasks/fetch_specifications.rb
280
283
  - lib/project_types/extension/tasks/find_npm_packages.rb
@@ -318,6 +321,7 @@ files:
318
321
  - lib/project_types/script/layers/application/extension_points.rb
319
322
  - lib/project_types/script/layers/application/project_dependencies.rb
320
323
  - lib/project_types/script/layers/application/push_script.rb
324
+ - lib/project_types/script/layers/domain/app_bridge.rb
321
325
  - lib/project_types/script/layers/domain/errors.rb
322
326
  - lib/project_types/script/layers/domain/extension_point.rb
323
327
  - lib/project_types/script/layers/domain/metadata.rb
@@ -538,7 +542,7 @@ files:
538
542
  - lib/shopify_cli/tunnel.rb
539
543
  - lib/shopify_cli/utilities.rb
540
544
  - lib/shopify_cli/version.rb
541
- - shipit.yml
545
+ - shipit.rubygems.yml
542
546
  - shopify-cli.gemspec
543
547
  - shopify-dev
544
548
  - utilities/constants.rb