shopify-cli 2.26.0 → 2.28.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1947b9e99b60efb4eb548badb8f41ee520f17ed0025a2666ec58a62594964abc
4
- data.tar.gz: b7b7714ce470469573282c561c335103cb8471319785fd327a7f7e8442eb71d2
3
+ metadata.gz: e9563000eff4fb285eefdc448c66f51c45cb40b7119870a17994d87e0c037160
4
+ data.tar.gz: 6cb8dbe46c0b825679e8a301206869d6cd523c4881235e220d966a753f477d5e
5
5
  SHA512:
6
- metadata.gz: 82a5eeb29ba45bf1e7eb407371c07922f14c3a7fe8ed0777b555ebbfa952a3dc35b303e0e477abe5c467bd01112e678ce31804051a52b92beb0bea2a323c5264
7
- data.tar.gz: e24d863f0a3649d729242bd6104403d5642a6e04c44fc52adb6856d98c55e20c06ff4b13e4ca553ba01299b726ad89193ee97bcd322709deb060f681bbfeae6d
6
+ metadata.gz: 6f67ca0fc39a81731a425e5e7a8bd848d50f7ed698b31f6529b18af0365ab7ca2a8072cada700b0e98028c0d42b3b3cbfcae7108bc30a038d265f85d18b06ed8
7
+ data.tar.gz: afc2b9be9d9b59eca388fe71946ed696ed1e7faf28833468217f0933af1f4fac9ea9f08613cf08ec2b379886b06702641703790762323b8f58e5a40fccff1cb1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@ 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
+ ## Version 2.28.0 - 2022-10-17
6
+
7
+ ### Fixed
8
+ * [#2646](https://github.com/Shopify/shopify-cli/pull/2646): Demo themes shouldn't appear in the `shopify theme pull/push/list/open` commands
9
+
10
+ ### Changed
11
+ * [#2648](https://github.com/Shopify/shopify-cli/pull/2648): Do not warn users when the CLI 2.x is running as a subprocess
12
+
13
+ ## Version 2.27.0 - 2022-10-10
14
+
15
+ ### Fixed
16
+ * [#2645](https://github.com/Shopify/shopify-cli/pull/2645): Fix issue that prevents the execution of `shopify extension serve` in some scenarios
17
+
5
18
  ## Version 2.26.0 - 2022-10-03
6
19
 
7
20
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.26.0)
4
+ shopify-cli (2.28.0)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.11.0)
@@ -8,7 +8,7 @@ module Extension
8
8
  return Messages::MESSAGES if type_specific_messages.nil?
9
9
 
10
10
  if type_specific_messages.key?(:overrides)
11
- deep_merge(Messages::MESSAGES, type_specific_messages[:overrides])
11
+ ShopifyCLI::Utilities.deep_merge(Messages::MESSAGES, type_specific_messages[:overrides])
12
12
  else
13
13
  Messages::MESSAGES
14
14
  end
@@ -29,11 +29,6 @@ module Extension
29
29
 
30
30
  TYPES[type_identifier_symbol]
31
31
  end
32
-
33
- def self.deep_merge(first, second)
34
- merger = proc { |_key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
35
- first.merge(second, &merger)
36
- end
37
32
  end
38
33
  end
39
34
  end
@@ -52,7 +52,12 @@ module Extension
52
52
  argo_runtime(context).supports?(:public_url)
53
53
  end
54
54
 
55
- def serve(context:, port:, tunnel_url:, resource_url:)
55
+ def serve(**options)
56
+ context = options[:context]
57
+ port = options[:port]
58
+ tunnel_url = options[:tunnel_url]
59
+ resource_url = options[:resource_url]
60
+
56
61
  Features::ArgoServe.new(
57
62
  specification_handler: self,
58
63
  argo_runtime: argo_runtime(context),
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Theme
3
4
  class Project < ShopifyCLI::ProjectType
4
5
  require Project.project_filepath("messages/messages")
5
- register_messages(Theme::Messages::MESSAGES)
6
+ register_messages(Theme::Messages.all)
6
7
  end
7
8
 
8
9
  class Command < ShopifyCLI::Command::ProjectCommand
@@ -77,7 +77,8 @@ module Theme
77
77
  end
78
78
 
79
79
  def storefront_renderer_token
80
- ShopifyCLI::DB.get(:storefront_renderer_production_exchange_token)
80
+ ShopifyCLI::Environment.storefront_renderer_auth_token ||
81
+ ShopifyCLI::DB.get(:storefront_renderer_production_exchange_token)
81
82
  end
82
83
  end
83
84
  end
@@ -145,7 +145,7 @@ module Theme
145
145
  It looks like you are using credentials that do not work with {{command:%s theme serve}}.
146
146
  ERROR_MESSAGE
147
147
  help_message: <<~HELP_MESSAGE,
148
- Run {{command:%s logout}} and {{command:%s login --password "" --store STORE}} to force the authentication thought your browser.
148
+ Run {{command:%s logout}} and {{command:%s login --password "" --store STORE}} to authenticate again.
149
149
  HELP_MESSAGE
150
150
  },
151
151
  operation: {
@@ -390,5 +390,31 @@ module Theme
390
390
  },
391
391
  },
392
392
  }.freeze
393
+
394
+ def self.all
395
+ # In order to support theme development inside CLI3, we spawn CLI2 as a
396
+ # subprocess. Whenever an error happens, we want to show the updated
397
+ # version of the commands for the user to try.
398
+ if ShopifyCLI::Environment.run_as_subprocess?
399
+ ShopifyCLI::Utilities.deep_merge(MESSAGES, {
400
+ theme: {
401
+ serve: {
402
+ auth: {
403
+ error_message: <<~ERROR_MESSAGE,
404
+ It looks like you are using credentials that do not work with {{command:%s theme dev}}.
405
+ ERROR_MESSAGE
406
+ help_message: <<~HELP_MESSAGE,
407
+ Run {{command:%s auth logout}} and {{command:%s theme dev --store STORE}} to authenticate again.
408
+ HELP_MESSAGE
409
+ },
410
+ binding_error: "Couldn't bind to localhost." \
411
+ " To serve your theme, set a different address with {{command:%s theme dev --host=<address>}}",
412
+ },
413
+ },
414
+ })
415
+ else
416
+ MESSAGES
417
+ end
418
+ end
393
419
  end
394
420
  end
@@ -5,7 +5,7 @@ require_relative "theme_presenter"
5
5
  module Theme
6
6
  module Presenters
7
7
  class ThemesPresenter
8
- ORDER_BY_ROLE = %w(live unpublished development)
8
+ SUPPORTED_ROLES = %w(live unpublished development)
9
9
 
10
10
  def initialize(ctx, root)
11
11
  @ctx = ctx
@@ -14,16 +14,13 @@ module Theme
14
14
 
15
15
  def all
16
16
  all_themes
17
- .sort_by { |theme| order_by_role(theme) }
17
+ .select { |theme| SUPPORTED_ROLES.include?(theme.role) }
18
+ .sort_by { |theme| SUPPORTED_ROLES.index(theme.role) }
18
19
  .map { |theme| ThemePresenter.new(theme) }
19
20
  end
20
21
 
21
22
  private
22
23
 
23
- def order_by_role(theme)
24
- ORDER_BY_ROLE.index(theme.role) || ORDER_BY_ROLE.size
25
- end
26
-
27
24
  def all_themes
28
25
  ShopifyCLI::Theme::Theme.all(@ctx, root: @root)
29
26
  end
@@ -117,7 +117,7 @@ module ShopifyCLI
117
117
  end
118
118
 
119
119
  def check_version(version, range:, runtime:, context: Context.new)
120
- return if Environment.test?
120
+ return if Environment.test? || Environment.run_as_subprocess?
121
121
  return if range.nil?
122
122
 
123
123
  version_without_pre_nor_build = Utilities.version_dropping_pre_and_build(version)
@@ -498,7 +498,7 @@ module ShopifyCLI
498
498
  "{{i}} Authentication required. Login to the URL below with your %s credentials to continue.",
499
499
 
500
500
  servlet: {
501
- success_response: "You've successfuly logged into the Shopify CLI!",
501
+ success_response: "You've successfully logged into the Shopify CLI!",
502
502
  invalid_request_response: "Invalid request: %s",
503
503
  invalid_state_response: "The anti-forgery state token does not match the initial request.",
504
504
  },
@@ -12,5 +12,10 @@ module ShopifyCLI
12
12
  curr = File.dirname(curr)
13
13
  end
14
14
  end
15
+
16
+ def self.deep_merge(first, second)
17
+ merger = proc { |_key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
18
+ first.merge(second, &merger)
19
+ end
15
20
  end
16
21
  end
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.26.0"
2
+ VERSION = "2.28.0"
3
3
  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.26.0
4
+ version: 2.28.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-10-03 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler