shopify-cli 2.17.0 → 2.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile.lock +6 -6
  4. data/dev.yml +0 -1
  5. data/ext/shopify-extensions/version +1 -1
  6. data/lib/project_types/extension/forms/questions/ask_template.rb +3 -3
  7. data/lib/project_types/extension/messages/messages.rb +16 -0
  8. data/lib/project_types/extension/models/development_server_requirements.rb +2 -7
  9. data/lib/project_types/extension/models/server_config/development.rb +9 -0
  10. data/lib/project_types/extension/models/server_config/development_renderer.rb +2 -0
  11. data/lib/project_types/extension/models/specification_handlers/{beacon_extension.rb → web_pixel_extension.rb} +11 -10
  12. data/lib/project_types/extension/models/specification_handlers/{beacon_extension_utils → web_pixel_extension_utils}/script_config.rb +1 -1
  13. data/lib/project_types/extension/models/specification_handlers/{beacon_extension_utils → web_pixel_extension_utils}/script_config_repository.rb +2 -2
  14. data/lib/project_types/extension/tasks/configure_options.rb +1 -1
  15. data/lib/project_types/extension/tasks/convert_server_config.rb +1 -1
  16. data/lib/project_types/extension/tasks/execute_commands/outdated_extension_detection.rb +5 -1
  17. data/lib/project_types/script/commands/create.rb +1 -1
  18. data/lib/project_types/script/config/extension_points.yml +22 -32
  19. data/lib/project_types/script/forms/ask_app.rb +0 -5
  20. data/lib/project_types/script/layers/domain/metadata.rb +3 -5
  21. data/lib/project_types/script/layers/infrastructure/errors.rb +11 -0
  22. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +5 -3
  23. data/lib/project_types/script/layers/infrastructure/script_service.rb +5 -1
  24. data/lib/project_types/script/messages/messages.rb +4 -1
  25. data/lib/project_types/script/ui/error_handler.rb +8 -0
  26. data/lib/project_types/theme/commands/delete.rb +1 -0
  27. data/lib/project_types/theme/commands/open.rb +6 -1
  28. data/lib/project_types/theme/commands/publish.rb +1 -0
  29. data/lib/project_types/theme/commands/serve.rb +1 -0
  30. data/lib/project_types/theme/forms/select.rb +4 -1
  31. data/lib/project_types/theme/messages/messages.rb +20 -3
  32. data/lib/shopify_cli/core/monorail.rb +1 -1
  33. data/lib/shopify_cli/git.rb +7 -2
  34. data/lib/shopify_cli/heroku.rb +5 -3
  35. data/lib/shopify_cli/messages/messages.rb +1 -1
  36. data/lib/shopify_cli/release.rb +5 -2
  37. data/lib/shopify_cli/services/app/create/node_service.rb +1 -1
  38. data/lib/shopify_cli/services/app/create/php_service.rb +1 -1
  39. data/lib/shopify_cli/theme/dev_server.rb +19 -2
  40. data/lib/shopify_cli/theme/syncer/forms/select_update_strategy.rb +2 -2
  41. data/lib/shopify_cli/theme/syncer/json_update_handler.rb +1 -1
  42. data/lib/shopify_cli/version.rb +1 -1
  43. data/shopify-cli.gemspec +1 -1
  44. metadata +8 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3acc31975c1b9d6478fe3f5d39ebf4ca0550b5956dc22dd4710103ae77bb0b4
4
- data.tar.gz: 2cbf01bd46b9d3d175b6b4f534f28b52ce69972125169a243788d922a68bf19a
3
+ metadata.gz: 0b9c76cb4695f372d6c7466af04e48d99559d192a27b4dd5cc15b59e472cb373
4
+ data.tar.gz: 8157cfdb59c6028c981720d6612e6c93f09927eddb8555082b31338f6361c696
5
5
  SHA512:
6
- metadata.gz: 7999265576034095a1114c3a29a2ab9bbaee62bac8c29b26b79d2c724b8be1dbc045e0da7c94a1863e465545bd7be32851f2f36ae1b020a269346d4417c0008c
7
- data.tar.gz: e5affc3532841d156305192ad2aa775065a9571a7bbf8ee6ab7b56d7f5d62c7a30407cf25e658bb99283d8429eb1b009ff406651fa7915c9e2a07508923be993
6
+ metadata.gz: ced373c7de01d36a939bc99de89fabaab7aabd80126ed51d12d233f3b15579eb256dc0da84bf63af1778434e4e9b24828c71e83018bf016608174941add9e266
7
+ data.tar.gz: 49c1a0a1f55ac07d91d504aadf98131327124dcceaa0d07f957bbdceb7039c3b2e840c96c6d87a80327846f9a26c7af27202e5d92375c0a1ede40407114ab100
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,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.17.0)
4
+ shopify-cli (2.19.0)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
- theme-check (~> 1.10.1)
7
+ theme-check (~> 1.10.3)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -101,14 +101,14 @@ 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)
108
108
  faraday (>= 0.9)
109
109
  sawyer (~> 0.8.0, >= 0.5.3)
110
110
  parallel (1.21.0)
111
- parser (3.1.1.0)
111
+ parser (3.1.2.0)
112
112
  ast (~> 2.4.1)
113
113
  pry (0.13.1)
114
114
  coderay (~> 1.1)
@@ -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)
@@ -150,7 +150,7 @@ GEM
150
150
  faraday (> 0.8, < 2.0)
151
151
  sys-uname (1.2.2)
152
152
  ffi (~> 1.1)
153
- theme-check (1.10.2)
153
+ theme-check (1.10.3)
154
154
  liquid (>= 5.1.0)
155
155
  nokogiri (>= 1.12)
156
156
  parser (~> 3)
data/dev.yml CHANGED
@@ -13,7 +13,6 @@ up:
13
13
  - rpm:
14
14
  version: 4.17.0
15
15
  - bundler
16
- - docker
17
16
 
18
17
  test:
19
18
  desc: "Run tests."
@@ -1 +1 @@
1
- v0.4.0
1
+ v0.12.0
@@ -12,7 +12,7 @@ module Extension
12
12
 
13
13
  def call(project_details)
14
14
  if template_required?(project_details)
15
- project_details.template = template || choose_interactively
15
+ project_details.template = template || choose_interactively(project_details)
16
16
  end
17
17
  project_details
18
18
  end
@@ -24,9 +24,9 @@ module Extension
24
24
  Models::DevelopmentServerRequirements.supported?(type)
25
25
  end
26
26
 
27
- def choose_interactively
27
+ def choose_interactively(project_details)
28
28
  prompt.call(ctx.message("create.ask_template")) do |handler|
29
- Models::ServerConfig::Development::VALID_TEMPLATES.each do |template|
29
+ Models::ServerConfig::Development.find(project_details&.type&.identifier).each do |template|
30
30
  handler.option(template) { template }
31
31
  end
32
32
  end
@@ -216,6 +216,22 @@ module Extension
216
216
  * Add a develop script: shopify-cli-extensions develop
217
217
  * Change the build script to: shopify-cli-extensions build
218
218
  TEXT
219
+ product_subscription: <<~TEXT.strip,
220
+ Please update your package.json as follows:
221
+ * Replace the development dependency @shopify/admin-ui-extensions-run
222
+ with @shopify/shopify-cli-extensions
223
+ * Remove the start and server script
224
+ * Add a develop script: shopify-cli-extensions develop
225
+ * Change the build script to: shopify-cli-extensions build
226
+ TEXT
227
+ checkout_post_purchase: <<~TEXT.strip,
228
+ Please update your package.json as follows:
229
+ * Replace the development dependency @shopify/checkout-ui-extensions-run
230
+ with @shopify/shopify-cli-extensions
231
+ * Remove the start and server script
232
+ * Add a develop script: shopify-cli-extensions develop
233
+ * Change the build script to: shopify-cli-extensions build
234
+ TEXT
219
235
  },
220
236
  },
221
237
  warnings: {
@@ -9,13 +9,13 @@ module Extension
9
9
  "checkout_ui_extension",
10
10
  "checkout_post_purchase",
11
11
  "product_subscription",
12
- "beacon_extension",
12
+ "web_pixel_extension",
13
13
  "pos_ui_extension",
14
14
  ]
15
15
 
16
16
  class << self
17
17
  def supported?(type)
18
- if type_supported?(type) && type_enabled?(type)
18
+ if type_supported?(type) && beta_enabled?
19
19
  return true if binary_installed?
20
20
  warn_about_missing_binary
21
21
  end
@@ -31,11 +31,6 @@ module Extension
31
31
  SUPPORTED_EXTENSION_TYPES.include?(type.downcase)
32
32
  end
33
33
 
34
- # Some types are enabled unconditionally; others require beta_enabled
35
- def type_enabled?(type)
36
- beta_enabled? || "checkout_ui_extension" == type.downcase
37
- end
38
-
39
34
  private
40
35
 
41
36
  def binary_installed?
@@ -18,6 +18,15 @@ module Extension
18
18
  property :renderer, accepts: ServerConfig::DevelopmentRenderer
19
19
  property :entries, accepts: ServerConfig::DevelopmentEntries
20
20
  property :resource, accepts: ServerConfig::DevelopmentResource
21
+
22
+ def self.find(type)
23
+ case type.downcase
24
+ when "web_pixel_extension"
25
+ ["javascript"]
26
+ else
27
+ VALID_TEMPLATES
28
+ end
29
+ end
21
30
  end
22
31
  end
23
32
  end
@@ -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 "web_pixel_extension"
30
+ nil
29
31
  else
30
32
  raise ArgumentError, "Unknown extension type: #{type}"
31
33
  end
@@ -2,45 +2,46 @@
2
2
  require "base64"
3
3
  require "fileutils"
4
4
  require "json"
5
- require_relative "beacon_extension_utils/script_config"
6
- require_relative "beacon_extension_utils/script_config_repository"
5
+ require_relative "web_pixel_extension_utils/script_config"
6
+ require_relative "web_pixel_extension_utils/script_config_repository"
7
7
 
8
8
  module Extension
9
9
  module Models
10
10
  module SpecificationHandlers
11
- class BeaconExtension < Default
11
+ class WebPixelExtension < Default
12
12
  SCRIPT_FILE = "build/main.js"
13
13
 
14
14
  def name
15
- "Beacon Extension"
15
+ "Web Pixel Extension"
16
16
  end
17
17
 
18
18
  def read_configuration
19
19
  end
20
20
 
21
21
  def access_config_property(context, ext_config, key, &process_value)
22
- context.abort(context.message("core.extension.push.beacon_extension.error.missing_config_key_error",
22
+ context.abort(context.message("core.extension.push.web_pixel_extension.error.missing_config_key_error",
23
23
  key)) unless ext_config.key?(key)
24
24
 
25
25
  begin
26
26
  process_value.nil? ? ext_config[key] : process_value.call(ext_config[key])
27
27
  rescue StandardError
28
- context.abort(context.message("core.extension.push.beacon_extension.error.invalid_config_value_error", key))
28
+ context.abort(context.message("core.extension.push.web_pixel_extension.error.invalid_config_value_error",
29
+ key))
29
30
  end
30
31
  end
31
32
 
32
33
  def config(context)
33
34
  begin
34
- ext_config = BeaconExtensionUtils::ScriptConfigYmlRepository.new(ctx: context).get!.content
35
+ ext_config = WebPixelExtensionUtils::ScriptConfigYmlRepository.new(ctx: context).get!.content
35
36
  rescue StandardError
36
- context.abort(context.message("core.extension.push.beacon_extension.error.file_read_error",
37
- BeaconExtensionUtils::ScriptConfigYmlRepository.filename))
37
+ context.abort(context.message("core.extension.push.web_pixel_extension.error.file_read_error",
38
+ WebPixelExtensionUtils::ScriptConfigYmlRepository.filename))
38
39
  end
39
40
 
40
41
  begin
41
42
  script_contents = File.read(File.join(context.root, SCRIPT_FILE)).chomp
42
43
  rescue
43
- context.abort(context.message("core.extension.push.beacon_extension.error.file_read_error", SCRIPT_FILE))
44
+ context.abort(context.message("core.extension.push.web_pixel_extension.error.file_read_error", SCRIPT_FILE))
44
45
  end
45
46
  {
46
47
  runtime_context: access_config_property(context, ext_config, "runtime_context"),
@@ -3,7 +3,7 @@
3
3
  module Extension
4
4
  module Models
5
5
  module SpecificationHandlers
6
- module BeaconExtensionUtils
6
+ module WebPixelExtensionUtils
7
7
  class ScriptConfig
8
8
  attr_reader :content, :version, :configuration, :filename
9
9
 
@@ -2,7 +2,7 @@ require_relative "script_config"
2
2
  module Extension
3
3
  module Models
4
4
  module SpecificationHandlers
5
- module BeaconExtensionUtils
5
+ module WebPixelExtensionUtils
6
6
  class ScriptConfigRepository
7
7
  include SmartProperties
8
8
  property! :ctx, accepts: ShopifyCLI::Context
@@ -27,7 +27,7 @@ module Extension
27
27
  private
28
28
 
29
29
  def from_h(hash)
30
- Extension::Models::SpecificationHandlers::BeaconExtensionUtils::ScriptConfig.new(content: hash,
30
+ Extension::Models::SpecificationHandlers::WebPixelExtensionUtils::ScriptConfig.new(content: hash,
31
31
  filename: filename)
32
32
  end
33
33
 
@@ -14,7 +14,7 @@ module Extension
14
14
 
15
15
  def configure_skip_build(attributes)
16
16
  attributes[:options].merge!(skip_build: attributes[:identifier] == "theme_app_extension" ||
17
- attributes[:identifier] == "beacon_extension")
17
+ attributes[:identifier] == "web_pixel_extension")
18
18
  end
19
19
  end
20
20
  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,
@@ -20,6 +20,10 @@ module Extension
20
20
  case type
21
21
  when "checkout_ui_extension"
22
22
  context.message("errors.outdated_extensions.checkout_ui_extension")
23
+ when "product_subscription"
24
+ context.message("errors.outdated_extensions.product_subscription")
25
+ when "checkout_post_purchase"
26
+ context.message("errors.outdated_extensions.checkout_post_purchase")
23
27
  else
24
28
  context.message("errors.outdated_extensions.unknown")
25
29
  end
@@ -33,7 +37,7 @@ module Extension
33
37
 
34
38
  def valid?(package)
35
39
  case type
36
- when "checkout_ui_extension"
40
+ when "checkout_ui_extension", "product_subscription", "checkout_post_purchase"
37
41
  package.dev_dependency?("@shopify/shopify-cli-extensions") &&
38
42
  package.script?("build") &&
39
43
  package.script?("develop")
@@ -25,7 +25,7 @@ module Script
25
25
  project = Layers::Application::CreateScript.call(
26
26
  ctx: @ctx,
27
27
  language: options.flags[:language]&.downcase || "wasm",
28
- sparse_checkout_branch: options.flags[:branch] || "master",
28
+ sparse_checkout_branch: options.flags[:branch] || "main",
29
29
  title: form.title,
30
30
  extension_point_type: form.extension_point,
31
31
  )
@@ -4,67 +4,57 @@ payment_methods:
4
4
  typescript:
5
5
  beta: true
6
6
  package: "@shopify/scripts-checkout-apis"
7
- repo: "https://github.com/Shopify/scripts-apis-examples"
7
+ repo: "https://github.com/Shopify/function-examples"
8
8
  wasm:
9
- repo: "https://github.com/Shopify/scripts-apis-examples"
9
+ repo: "https://github.com/Shopify/function-examples"
10
10
  rust:
11
- repo: "https://github.com/Shopify/scripts-apis-examples"
12
- shipping_methods:
13
- domain: 'checkout'
14
- libraries:
15
- typescript:
16
- beta: true
17
- package: "@shopify/scripts-checkout-apis"
18
- repo: "https://github.com/Shopify/scripts-apis-examples"
19
- wasm:
20
- repo: "https://github.com/Shopify/scripts-apis-examples"
21
- merchandise_discount_types:
11
+ repo: "https://github.com/Shopify/function-examples"
12
+ payment_customization:
22
13
  beta: true
23
- domain: 'discounts'
14
+ domain: 'checkout'
24
15
  libraries:
25
- typescript:
26
- beta: true
27
- package: "@shopify/scripts-discounts-apis"
28
- repo: "https://github.com/Shopify/scripts-apis-examples"
29
16
  wasm:
30
- repo: "https://github.com/Shopify/scripts-apis-examples"
31
- delivery_discount_types:
32
- beta: true
33
- domain: 'discounts'
17
+ repo: "https://github.com/Shopify/function-examples"
18
+ rust:
19
+ repo: "https://github.com/Shopify/function-examples"
20
+ shipping_methods:
21
+ domain: 'checkout'
34
22
  libraries:
35
23
  typescript:
36
24
  beta: true
37
- package: "@shopify/scripts-discounts-apis"
38
- repo: "https://github.com/Shopify/scripts-apis-examples"
25
+ package: "@shopify/scripts-checkout-apis"
26
+ repo: "https://github.com/Shopify/function-examples"
39
27
  wasm:
40
- repo: "https://github.com/Shopify/scripts-apis-examples"
28
+ repo: "https://github.com/Shopify/function-examples"
29
+ rust:
30
+ repo: "https://github.com/Shopify/function-examples"
41
31
  product_discounts:
42
32
  beta: true
43
33
  domain: 'discounts'
44
34
  libraries:
45
35
  wasm:
46
- repo: "https://github.com/Shopify/scripts-apis-examples"
36
+ repo: "https://github.com/Shopify/function-examples"
47
37
  rust:
48
- repo: "https://github.com/Shopify/scripts-apis-examples"
38
+ repo: "https://github.com/Shopify/function-examples"
49
39
  order_discounts:
50
40
  beta: true
51
41
  domain: 'discounts'
52
42
  libraries:
53
43
  wasm:
54
- repo: "https://github.com/Shopify/scripts-apis-examples"
44
+ repo: "https://github.com/Shopify/function-examples"
55
45
  rust:
56
- repo: "https://github.com/Shopify/scripts-apis-examples"
46
+ repo: "https://github.com/Shopify/function-examples"
57
47
  shipping_discounts:
58
48
  beta: true
59
49
  domain: 'discounts'
60
50
  libraries:
61
51
  wasm:
62
- repo: "https://github.com/Shopify/scripts-apis-examples"
52
+ repo: "https://github.com/Shopify/function-examples"
63
53
  rust:
64
- repo: "https://github.com/Shopify/scripts-apis-examples"
54
+ repo: "https://github.com/Shopify/function-examples"
65
55
  shipping_rates_consolidation:
66
56
  beta: true
67
57
  domain: 'checkout'
68
58
  libraries:
69
59
  wasm:
70
- repo: "https://github.com/Shopify/scripts-apis-examples"
60
+ repo: "https://github.com/Shopify/function-examples"
@@ -7,11 +7,6 @@ module Script
7
7
 
8
8
  def ask
9
9
  apps = @xargs.fetch(:apps)
10
-
11
- unless @xargs[:acting_as_shopify_organization]
12
- apps = apps.select { |app| app["appType"] == "custom" }
13
- end
14
-
15
10
  raise Errors::NoExistingAppsError if apps.empty?
16
11
 
17
12
  @app =
@@ -4,12 +4,11 @@ module Script
4
4
  module Layers
5
5
  module Domain
6
6
  class Metadata
7
- attr_reader :schema_major_version, :schema_minor_version, :use_msgpack
7
+ attr_reader :schema_major_version, :schema_minor_version
8
8
 
9
- def initialize(schema_major_version, schema_minor_version, use_msgpack)
9
+ def initialize(schema_major_version, schema_minor_version)
10
10
  @schema_major_version = schema_major_version
11
11
  @schema_minor_version = schema_minor_version
12
- @use_msgpack = use_msgpack
13
12
  end
14
13
 
15
14
  class << self
@@ -17,7 +16,6 @@ module Script
17
16
  err_tag = nil
18
17
  metadata_hash = JSON.parse(metadata_json)
19
18
 
20
- use_msgpack = !!metadata_hash.dig("flags", "use_msgpack")
21
19
  schema_versions = metadata_hash["schemaVersions"] || {}
22
20
 
23
21
  version = schema_versions.values.first || {}
@@ -35,7 +33,7 @@ module Script
35
33
  err_tag = "script.error.metadata_schema_versions_missing_minor"
36
34
  end
37
35
 
38
- Metadata.new(schema_major_version, schema_minor_version, use_msgpack)
36
+ Metadata.new(schema_major_version, schema_minor_version)
39
37
  rescue JSON::ParserError
40
38
  err_tag = "script.error.metadata_validation_cause"
41
39
  ensure
@@ -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
@@ -37,7 +37,9 @@ module Script
37
37
  extension_point_type: extension_point_type,
38
38
  title: title,
39
39
  description: nil,
40
- language: language
40
+ language: language,
41
+ app_bridge_create_path: "/",
42
+ app_bridge_details_path: "/",
41
43
  )
42
44
 
43
45
  build_script_project(script_config: nil)
@@ -124,8 +126,8 @@ module Script
124
126
  end
125
127
 
126
128
  def app_bridge
127
- create_path = project_config_value("app_bridge_create_path") || "/"
128
- details_path = project_config_value("app_bridge_details_path") || "/"
129
+ create_path = project_config_value!("app_bridge_create_path")
130
+ details_path = project_config_value!("app_bridge_details_path")
129
131
 
130
132
  Domain::AppBridge.new(
131
133
  create_path: create_path,
@@ -90,8 +90,12 @@ module Script
90
90
  )
91
91
  elsif (errors = user_errors.filter { |err| err["tag"] == "input_query_validation_error" }).any?
92
92
  raise Errors::InvalidInputQueryErrors, errors.map { |err| err["message"] }
93
- elsif user_errors.find { |err| %w(not_use_msgpack_error schema_version_argument_error).include?(err["tag"]) }
93
+ elsif user_errors.find { |err| %w(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
@@ -24,7 +24,7 @@ module Script
24
24
  oauth_help: "Wait a few minutes and try again.",
25
25
 
26
26
  invalid_context_cause: "Your .shopify-cli.yml is formatted incorrectly. It's missing values for "\
27
- "extension_point_type or title.",
27
+ "extension_point_type, title, app_bridge_create_path or app_bridge_details_path.",
28
28
  invalid_context_help: "Add these values.",
29
29
 
30
30
  invalid_script_title_cause: "Script title contains unsupported characters.",
@@ -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
@@ -67,9 +67,14 @@ module ShopifyCLI
67
67
  if Dir.exist?(dest)
68
68
  ctx.abort(ctx.message("core.git.error.directory_exists"))
69
69
  else
70
+ repo, branch = repository.split("#")
70
71
  success_message = ctx.message("core.git.cloned", dest)
71
- CLI::UI::Frame.open(ctx.message("core.git.cloning", repository, dest), success_text: success_message) do
72
- clone_progress("clone", "--single-branch", repository, dest, ctx: ctx)
72
+ CLI::UI::Frame.open(ctx.message("core.git.cloning", repo, dest), success_text: success_message) do
73
+ if branch
74
+ clone_progress("clone", "--single-branch", "--branch", branch, repo, dest, ctx: ctx)
75
+ else
76
+ clone_progress("clone", "--single-branch", repo, dest, ctx: ctx)
77
+ end
73
78
  end
74
79
  end
75
80
  end
@@ -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
@@ -285,7 +285,7 @@ module ShopifyCLI
285
285
  },
286
286
  extension: {
287
287
  push: {
288
- beacon_extension: {
288
+ web_pixel_extension: {
289
289
  error: {
290
290
  file_read_error: "There was a problem reading %s",
291
291
  missing_config_key_error: "Configuration is missing key: %s",
@@ -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
@@ -117,7 +117,7 @@ module ShopifyCLI
117
117
  end
118
118
 
119
119
  def build(name)
120
- ShopifyCLI::Git.clone("https://github.com/Shopify/shopify-app-node.git", name)
120
+ ShopifyCLI::Git.clone("https://github.com/Shopify/shopify-app-template-node.git#cli_two", name)
121
121
 
122
122
  context.root = File.join(context.root, name)
123
123
 
@@ -74,7 +74,7 @@ module ShopifyCLI
74
74
  end
75
75
 
76
76
  def build(form)
77
- ShopifyCLI::Git.clone("https://github.com/Shopify/shopify-app-php.git", form.name)
77
+ ShopifyCLI::Git.clone("https://github.com/Shopify/shopify-app-template-php.git#cli_two", form.name)
78
78
 
79
79
  context.root = File.join(context.root, form.name)
80
80
  context.chdir(context.root)
@@ -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.19.0"
3
3
  end
data/shopify-cli.gemspec CHANGED
@@ -48,7 +48,7 @@ Gem::Specification.new do |spec|
48
48
  # Whereas if we were to have "~> 1.9", that version would still be satisfied and thus not upgraded.
49
49
  # Both shopify-cli and theme-check gems are owned and developed by Shopify.
50
50
  # These gems are currently being actively developed and it's easiest to update them together.
51
- spec.add_dependency("theme-check", "~> 1.10.1")
51
+ spec.add_dependency("theme-check", "~> 1.10.3")
52
52
 
53
53
  spec.extensions = ["ext/shopify-extensions/extconf.rb"]
54
54
  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.19.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-06-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.10.1
95
+ version: 1.10.3
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.10.1
102
+ version: 1.10.3
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
@@ -253,13 +253,13 @@ files:
253
253
  - lib/project_types/extension/models/server_config/root.rb
254
254
  - lib/project_types/extension/models/server_config/user.rb
255
255
  - lib/project_types/extension/models/specification.rb
256
- - lib/project_types/extension/models/specification_handlers/beacon_extension.rb
257
- - lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config.rb
258
- - lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config_repository.rb
259
256
  - lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb
260
257
  - lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
261
258
  - lib/project_types/extension/models/specification_handlers/default.rb
262
259
  - lib/project_types/extension/models/specification_handlers/theme_app_extension.rb
260
+ - lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb
261
+ - lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config.rb
262
+ - lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config_repository.rb
263
263
  - lib/project_types/extension/models/specifications.rb
264
264
  - lib/project_types/extension/models/validation_error.rb
265
265
  - lib/project_types/extension/models/version.rb
@@ -699,7 +699,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
699
699
  - !ruby/object:Gem::Version
700
700
  version: '0'
701
701
  requirements: []
702
- rubygems_version: 3.2.20
702
+ rubygems_version: 3.3.3
703
703
  signing_key:
704
704
  specification_version: 4
705
705
  summary: Shopify CLI helps you build Shopify apps faster.