shopify-cli 2.17.0 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3acc31975c1b9d6478fe3f5d39ebf4ca0550b5956dc22dd4710103ae77bb0b4
4
- data.tar.gz: 2cbf01bd46b9d3d175b6b4f534f28b52ce69972125169a243788d922a68bf19a
3
+ metadata.gz: 7dc113806552b27305be696850c04b292d7ba8feb0e5a60c0755bdb93b193535
4
+ data.tar.gz: 7fd46f5612eda607b0e2b2f01ea8662ce1d6d4803475b4e7d3bde98155ed06db
5
5
  SHA512:
6
- metadata.gz: 7999265576034095a1114c3a29a2ab9bbaee62bac8c29b26b79d2c724b8be1dbc045e0da7c94a1863e465545bd7be32851f2f36ae1b020a269346d4417c0008c
7
- data.tar.gz: e5affc3532841d156305192ad2aa775065a9571a7bbf8ee6ab7b56d7f5d62c7a30407cf25e658bb99283d8429eb1b009ff406651fa7915c9e2a07508923be993
6
+ metadata.gz: d1553e12053b6666755dde7c4381fce2018da1d73ab2f85cc456f6ad97fd58db89360a4fe02beb7b40d3a6d0010e2c8f15b68ff6246ff25426796f39f451aafc
7
+ data.tar.gz: 5a9f020586bfaf2b828aed9bb1ae4040bc0deab133e71181fe49c5710fd9a5a3b3cc71faf653f0311054038b76d749303947e0af6d902b7096cf84c2c610a3bf
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@ 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.18.0 - 2022-05-30
6
+
7
+ ### Added
8
+ * [#2336](https://github.com/Shopify/shopify-cli/pull/2336): Add `--theme/-t` flag support to the `theme serve` command
9
+ * [#2325](https://github.com/Shopify/shopify-cli/pull/2325): Add `-e/--editor` flag to open theme editor in the `theme open` command
10
+ * [#2330](https://github.com/Shopify/shopify-cli/pull/2330): Add remote file deleted warning flow to `theme serve --theme-editor-sync`
11
+
12
+ ### Fixed
13
+ * [#2352](https://github.com/Shopify/shopify-cli/pull/2352): Provide better DX when dealing with empty theme selection
14
+ * [#2347](https://github.com/Shopify/shopify-cli/pull/2347): Fix #2346 Heroku CLI installation for Apple silicon
15
+
5
16
  ## Version 2.17.0 - 2022-05-12
6
17
 
7
18
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.17.0)
4
+ shopify-cli (2.18.0)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.10.1)
@@ -101,7 +101,7 @@ GEM
101
101
  mocha (1.13.0)
102
102
  multi_test (0.1.2)
103
103
  multipart-post (2.1.1)
104
- nokogiri (1.13.4)
104
+ nokogiri (1.13.6)
105
105
  mini_portile2 (~> 2.8.0)
106
106
  racc (~> 1.4)
107
107
  octokit (4.22.0)
@@ -118,7 +118,7 @@ GEM
118
118
  pry (~> 0.13.0)
119
119
  public_suffix (4.0.6)
120
120
  racc (1.6.0)
121
- rack (2.2.3)
121
+ rack (2.2.3.1)
122
122
  rainbow (3.1.1)
123
123
  rake (13.0.6)
124
124
  rb-fsevent (0.11.1)
@@ -1 +1 @@
1
- v0.4.0
1
+ v0.12.0
@@ -26,6 +26,8 @@ module Extension
26
26
  new(name: "@shopify/post-purchase-ui-extensions", version: "^0.13.2")
27
27
  when "pos_ui_extension"
28
28
  new(name: "@shopify/retail-ui-extensions", version: "^0.1.0")
29
+ when "beacon_extension"
30
+ nil
29
31
  else
30
32
  raise ArgumentError, "Unknown extension type: #{type}"
31
33
  end
@@ -30,7 +30,7 @@ module Extension
30
30
  renderer = Models::ServerConfig::DevelopmentRenderer.find(type)
31
31
  extension = Models::ServerConfig::Extension.new(
32
32
  uuid: registration_uuid,
33
- type: type.upcase,
33
+ type: type,
34
34
  user: Models::ServerConfig::User.new,
35
35
  development: Models::ServerConfig::Development.new(
36
36
  build_dir: hash.dig("development", "build_dir") || DEFAULT_BUILD_DIR,
@@ -9,35 +9,25 @@ payment_methods:
9
9
  repo: "https://github.com/Shopify/scripts-apis-examples"
10
10
  rust:
11
11
  repo: "https://github.com/Shopify/scripts-apis-examples"
12
- shipping_methods:
12
+ payment_customization:
13
+ beta: true
13
14
  domain: 'checkout'
14
15
  libraries:
15
- typescript:
16
- beta: true
17
- package: "@shopify/scripts-checkout-apis"
18
- repo: "https://github.com/Shopify/scripts-apis-examples"
19
16
  wasm:
20
17
  repo: "https://github.com/Shopify/scripts-apis-examples"
21
- merchandise_discount_types:
22
- beta: true
23
- domain: 'discounts'
24
- libraries:
25
- typescript:
26
- beta: true
27
- package: "@shopify/scripts-discounts-apis"
28
- repo: "https://github.com/Shopify/scripts-apis-examples"
29
- wasm:
18
+ rust:
30
19
  repo: "https://github.com/Shopify/scripts-apis-examples"
31
- delivery_discount_types:
32
- beta: true
33
- domain: 'discounts'
20
+ shipping_methods:
21
+ domain: 'checkout'
34
22
  libraries:
35
23
  typescript:
36
24
  beta: true
37
- package: "@shopify/scripts-discounts-apis"
25
+ package: "@shopify/scripts-checkout-apis"
38
26
  repo: "https://github.com/Shopify/scripts-apis-examples"
39
27
  wasm:
40
28
  repo: "https://github.com/Shopify/scripts-apis-examples"
29
+ rust:
30
+ repo: "https://github.com/Shopify/scripts-apis-examples"
41
31
  product_discounts:
42
32
  beta: true
43
33
  domain: 'discounts'
@@ -194,6 +194,17 @@ module Script
194
194
  messages.join("\n")
195
195
  end
196
196
  end
197
+
198
+ class InvalidAppBridgePathError < ScriptProjectError
199
+ def initialize(path_type)
200
+ @path_type = path_type
201
+ super()
202
+ end
203
+
204
+ def path_key
205
+ "app_bridge_#{@path_type}_path"
206
+ end
207
+ end
197
208
  end
198
209
  end
199
210
  end
@@ -92,6 +92,10 @@ module Script
92
92
  raise Errors::InvalidInputQueryErrors, errors.map { |err| err["message"] }
93
93
  elsif user_errors.find { |err| %w(not_use_msgpack_error schema_version_argument_error).include?(err["tag"]) }
94
94
  raise Domain::Errors::MetadataValidationError
95
+ elsif user_errors.find { |err| err["tag"] == "invalid_app_bridge_create_path" }
96
+ raise Errors::InvalidAppBridgePathError, "create"
97
+ elsif user_errors.find { |err| err["tag"] == "invalid_app_bridge_details_path" }
98
+ raise Errors::InvalidAppBridgePathError, "details"
95
99
  else
96
100
  raise Errors::GraphqlError, user_errors
97
101
  end
@@ -164,6 +164,9 @@ module Script
164
164
  missing_env_file_variables: "The following are missing in the .env file: %s. ",
165
165
  missing_env_file_variables_solution: "To add it, connect your script with " \
166
166
  "{{command:%1$s script connect}} ",
167
+
168
+ invalid_app_bridge_path_cause: "The script couldn't be pushed because the App Bridge path is incorrect in .shopify-cli.yml.",
169
+ invalid_app_bridge_path_help: "The %{path_key} needs to be set to a path that starts with {{command:/}}.",
167
170
  },
168
171
 
169
172
  create: {
@@ -316,6 +316,14 @@ module Script
316
316
  ),
317
317
  help_suggestion: ShopifyCLI::Context.message("script.error.language_library_for_api_not_found_help"),
318
318
  }
319
+ when Layers::Infrastructure::Errors::InvalidAppBridgePathError
320
+ {
321
+ cause_of_error: ShopifyCLI::Context.message("script.error.invalid_app_bridge_path_cause"),
322
+ help_suggestion: ShopifyCLI::Context.message(
323
+ "script.error.invalid_app_bridge_path_help",
324
+ path_key: e.path_key,
325
+ ),
326
+ }
319
327
  end
320
328
  end
321
329
  end
@@ -25,6 +25,7 @@ module Theme
25
25
  title: @ctx.message("theme.delete.select"),
26
26
  exclude_roles: ["live"],
27
27
  include_foreign_developments: options.flags[:show_all],
28
+ cmd: :delete
28
29
  )
29
30
  return unless form
30
31
  [form.theme]
@@ -12,13 +12,18 @@ module Theme
12
12
  parser.on("-t", "--theme=NAME_OR_ID") { |theme| flags[:theme] = theme }
13
13
  parser.on("-l", "--live") { flags[:live] = true }
14
14
  parser.on("-d", "--development") { flags[:development] = true }
15
+ parser.on("-e", "--editor") { flags[:editor] = true }
15
16
  end
16
17
 
17
18
  def call(_args, _name)
18
19
  theme = find_theme(**options.flags)
19
20
 
20
21
  @ctx.puts(@ctx.message("theme.open.details", theme.name, theme.preview_url, theme.editor_url))
21
- @ctx.open_browser_url!(theme.preview_url)
22
+ if options.flags[:editor]
23
+ @ctx.open_browser_url!(theme.editor_url)
24
+ else
25
+ @ctx.open_browser_url!(theme.preview_url)
26
+ end
22
27
  end
23
28
 
24
29
  def self.help
@@ -19,6 +19,7 @@ module Theme
19
19
  [],
20
20
  title: @ctx.message("theme.publish.select"),
21
21
  exclude_roles: ["live", "development", "demo"],
22
+ cmd: :publish
22
23
  )
23
24
  return unless form
24
25
  form.theme
@@ -17,6 +17,7 @@ module Theme
17
17
  parser.on("--poll") { flags[:poll] = true }
18
18
  parser.on("--live-reload=MODE") { |mode| flags[:mode] = as_reload_mode(mode) }
19
19
  parser.on("--theme-editor-sync") { flags[:editor_sync] = true }
20
+ parser.on("-t", "--theme=NAME_OR_ID") { |theme| flags[:theme] = theme }
20
21
  end
21
22
 
22
23
  def call(_args, name)
@@ -6,7 +6,7 @@ module Theme
6
6
  module Forms
7
7
  class Select < ShopifyCLI::Form
8
8
  attr_accessor :theme
9
- flag_arguments :root, :title, :exclude_roles, :include_foreign_developments
9
+ flag_arguments :root, :title, :exclude_roles, :include_foreign_developments, :cmd
10
10
 
11
11
  def ask
12
12
  self.theme = CLI::UI::Prompt.ask(title, allow_empty: false) do |handler|
@@ -18,6 +18,9 @@ module Theme
18
18
 
19
19
  handler.option(presenter.to_s(:short)) { theme }
20
20
  end
21
+ if handler.options.empty? && cmd
22
+ @ctx.abort(@ctx.message("theme.#{cmd}.no_themes_error"), @ctx.message("theme.#{cmd}.no_themes_resolution"))
23
+ end
21
24
  end
22
25
  end
23
26
 
@@ -42,6 +42,8 @@ module Theme
42
42
  HELP
43
43
  done: "Your theme is now live at %s",
44
44
  not_found: "Theme #%s does not exist",
45
+ no_themes_error: "You don't have any theme to be published.",
46
+ no_themes_resolution: "Try to create an unpublished theme with {{command:theme push -u -t <theme_name>}}.",
45
47
  select: "Select theme to push to",
46
48
  confirm: "Are you sure you want to make %s the new live theme on %s?",
47
49
  },
@@ -101,6 +103,7 @@ module Theme
101
103
  name: "Theme name",
102
104
  },
103
105
  serve: {
106
+ theme_not_found: "Theme \"%s\" doesn't exist",
104
107
  help: <<~HELP,
105
108
  Uploads the current theme as a development theme to the connected store, then prints theme editor and preview URLs to your terminal. While running, changes will push to the store in real time.
106
109
 
@@ -139,14 +142,14 @@ module Theme
139
142
  syncer: {
140
143
  forms: {
141
144
  apply_to_all: {
142
- title: "Would like apply this to all the other %s files?",
145
+ title: "Would you like to apply this to all the other %s files?",
143
146
  yes: "Yes",
144
147
  no: "No",
145
148
  },
146
149
  update_strategy: {
147
150
  title_context: <<~TITLE,
148
151
 
149
- The local file {{command:%s}} is different from the remote version in the development theme."
152
+ The local file {{command:%s}} is different from the remote version in the development theme.
150
153
  TITLE
151
154
  title_question: "What would you like to do?",
152
155
  keep_remote: "Keep the remote version",
@@ -154,10 +157,21 @@ module Theme
154
157
  union_merge: "Merge files (it may break the local file)",
155
158
  exit: "Exit",
156
159
  },
160
+ update_remote_deleted_strategy: {
161
+ title_context: <<~TITLE,
162
+
163
+ The local file {{command:%s}} doesn’t exist in the remote version of the development theme.
164
+ TITLE
165
+ title_question: "What would you like to do?",
166
+ keep_remote: "Keep the remote version (and remove it locally)",
167
+ keep_local: "Keep the local version (and restore it remotely)",
168
+ union_merge: "Merge files (it may break the local file)",
169
+ exit: "Exit",
170
+ },
157
171
  delete_strategy: {
158
172
  title_context: <<~TITLE,
159
173
 
160
- The local file {{command:%s}} has been recently removed, but it's present on your remote development theme.",
174
+ The local file {{command:%s}} has been recently removed, but it's present on your remote development theme.
161
175
  TITLE
162
176
  title_question: "What would you like to do?",
163
177
  delete: "Delete permanently",
@@ -222,6 +236,8 @@ module Theme
222
236
  HELP
223
237
  select: "Select theme to delete",
224
238
  done: "%s theme(s) deleted",
239
+ no_themes_error: "You don't have any theme to be deleted.",
240
+ no_themes_resolution: "Try to create an unpublished theme with {{command:theme push -u -t <theme_name>}}.",
225
241
  not_found: "{{x}} Theme #%s does not exist",
226
242
  live: "{{x}} Theme #%s is your live theme. You can't delete it.",
227
243
  confirm: "Are you sure you want to delete %s on %s?",
@@ -293,6 +309,7 @@ module Theme
293
309
  {{command:-t, --theme=NAME_OR_ID}} Theme ID or name of your theme.
294
310
  {{command:-l, --live}} Open your live theme.
295
311
  {{command:-d, --development}} Open your development theme.
312
+ {{command:-e, --editor}} Open the editor to the specified/selected theme.
296
313
  HELP
297
314
  },
298
315
  list: {
@@ -6,7 +6,7 @@ require "rbconfig"
6
6
  module ShopifyCLI
7
7
  module Core
8
8
  module Monorail
9
- ENDPOINT_URI = URI.parse("https://monorail-edge.shopifycloud.com/v1/produce")
9
+ ENDPOINT_URI = URI.parse("https://monorail-edge.shopifysvc.com/v1/produce")
10
10
  INVOCATIONS_SCHEMA = "app_cli_command/5.0"
11
11
 
12
12
  # Extra hash of data that will be sent in the payload
@@ -4,6 +4,7 @@ module ShopifyCLI
4
4
  linux: "https://cli-assets.heroku.com/heroku-linux-x64.tar.gz",
5
5
  mac: "https://cli-assets.heroku.com/heroku-darwin-x64.tar.gz",
6
6
  windows: "https://cli-assets.heroku.com/heroku-x64.exe",
7
+ mac_m1: "https://cli-assets.heroku.com/heroku-darwin-x64.tar.gz",
7
8
  }
8
9
 
9
10
  def initialize(ctx)
@@ -97,15 +98,16 @@ module ShopifyCLI
97
98
  if File.exist?(local_path)
98
99
  local_path
99
100
  elsif @ctx.windows?
100
- # Check if Heroku exists in the Windows registry and run it from there
101
- require "win32/registry"
102
101
  begin
102
+ # Check if Heroku exists in the Windows registry and run it from there
103
+ require "win32/registry"
104
+
103
105
  windows_path = Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\heroku') do |reg|
104
106
  reg[""] # This reads the 'Default' registry key
105
107
  end
106
108
 
107
109
  File.join(windows_path, "bin", "heroku").to_s
108
- rescue
110
+ rescue StandardError, LoadError
109
111
  "heroku"
110
112
  end
111
113
  else
@@ -8,7 +8,6 @@ module ShopifyCLI
8
8
  class Release
9
9
  def initialize(new_version, github_access_token)
10
10
  @new_version = new_version
11
- @changelog = ShopifyCLI::Changelog.new
12
11
  @github = Octokit::Client.new(access_token: github_access_token)
13
12
  end
14
13
 
@@ -32,7 +31,7 @@ module ShopifyCLI
32
31
 
33
32
  private
34
33
 
35
- attr_reader :new_version, :changelog, :github
34
+ attr_reader :new_version, :github
36
35
 
37
36
  def ensure_updated_main
38
37
  # We can't be sure what is the correct action to take if changes have been
@@ -190,5 +189,9 @@ module ShopifyCLI
190
189
  def system_or_fail(command, action)
191
190
  raise "Failed to #{action}!" unless system(command)
192
191
  end
192
+
193
+ def changelog
194
+ @changelog ||= ShopifyCLI::Changelog.new
195
+ end
193
196
  end
194
197
  end
@@ -27,9 +27,10 @@ module ShopifyCLI
27
27
  class << self
28
28
  attr_accessor :ctx
29
29
 
30
- def start(ctx, root, host: "127.0.0.1", port: 9292, poll: false, editor_sync: false, mode: ReloadMode.default)
30
+ def start(ctx, root, host: "127.0.0.1", theme: nil, port: 9292, poll: false, editor_sync: false,
31
+ mode: ReloadMode.default)
31
32
  @ctx = ctx
32
- theme = DevelopmentTheme.find_or_create!(ctx, root: root)
33
+ theme = find_theme(root, theme)
33
34
  ignore_filter = IgnoreFilter.from_path(root)
34
35
  @syncer = Syncer.new(ctx, theme: theme, ignore_filter: ignore_filter, overwrite_json: !editor_sync)
35
36
  watcher = Watcher.new(ctx, theme: theme, ignore_filter: ignore_filter, syncer: @syncer, poll: poll)
@@ -108,6 +109,22 @@ module ShopifyCLI
108
109
  @syncer.shutdown
109
110
  WebServer.shutdown
110
111
  end
112
+
113
+ private
114
+
115
+ def find_theme(root, identifier)
116
+ return theme_by_identifier(root, identifier) if identifier
117
+ DevelopmentTheme.find_or_create!(@ctx, root: root)
118
+ end
119
+
120
+ def theme_by_identifier(root, identifier)
121
+ theme = ShopifyCLI::Theme::Theme.find_by_identifier(@ctx, root: root, identifier: identifier)
122
+ theme || not_found_error(identifier)
123
+ end
124
+
125
+ def not_found_error(identifier)
126
+ @ctx.abort(@ctx.message("theme.serve.theme_not_found", identifier))
127
+ end
111
128
  end
112
129
  end
113
130
  end
@@ -7,7 +7,7 @@ module ShopifyCLI
7
7
  class Syncer
8
8
  module Forms
9
9
  class SelectUpdateStrategy < BaseStrategyForm
10
- flag_arguments :file
10
+ flag_arguments :file, :exists_remotely
11
11
 
12
12
  def strategies
13
13
  %i[
@@ -19,7 +19,7 @@ module ShopifyCLI
19
19
  end
20
20
 
21
21
  def prefix
22
- "theme.serve.syncer.forms.update_strategy"
22
+ "theme.serve.syncer.forms.#{exists_remotely ? "update_strategy" : "update_remote_deleted_strategy"}"
23
23
  end
24
24
  end
25
25
  end
@@ -74,7 +74,7 @@ module ShopifyCLI
74
74
  end
75
75
 
76
76
  def ask_update_strategy(file)
77
- Forms::SelectUpdateStrategy.ask(@ctx, [], file: file).strategy
77
+ Forms::SelectUpdateStrategy.ask(@ctx, [], file: file, exists_remotely: file_exist_remotely?(file)).strategy
78
78
  end
79
79
  end
80
80
  end
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.17.0"
2
+ VERSION = "2.18.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.17.0
4
+ version: 2.18.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-05-12 00:00:00.000000000 Z
11
+ date: 2022-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler