shopify-cli 2.15.6 → 2.17.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.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 756d40b258dafcaa9e3fd02305cbc3eb4bc1416b5711f22543c9b6221c4bd888
4
- data.tar.gz: 476eea5325f671f2e3a1337700356f895792c1e4b2568dc56e38c58b4d1e93d5
3
+ metadata.gz: e3acc31975c1b9d6478fe3f5d39ebf4ca0550b5956dc22dd4710103ae77bb0b4
4
+ data.tar.gz: 2cbf01bd46b9d3d175b6b4f534f28b52ce69972125169a243788d922a68bf19a
5
5
  SHA512:
6
- metadata.gz: 11bee20d53a3809978a2cf37a7f4ed3e759f0edd7d53ac8ec9e08dad76c1bd3ed8fcbf66262dc686d7bf929fec256685189facaf1255c2f51c2f566757b7ae29
7
- data.tar.gz: 8cb0d2cb3d2edf801f752b74ed8534816180e257d3a1afef8fb0b13ffa5a3a85388bd6bb71df04d0c42bf450cedd1008e473f36cf48722435eea912645dcb1e9
6
+ metadata.gz: 7999265576034095a1114c3a29a2ab9bbaee62bac8c29b26b79d2c724b8be1dbc045e0da7c94a1863e465545bd7be32851f2f36ae1b020a269346d4417c0008c
7
+ data.tar.gz: e5affc3532841d156305192ad2aa775065a9571a7bbf8ee6ab7b56d7f5d62c7a30407cf25e658bb99283d8429eb1b009ff406651fa7915c9e2a07508923be993
data/.github/CODEOWNERS CHANGED
@@ -4,7 +4,7 @@
4
4
  /lib/project_types/script/ @shopify/scripts-platform
5
5
  /test/project_types/script/ @shopify/scripts-platform
6
6
 
7
- /lib/project_types/theme/ @shopify/theme-platform-dev-experience
8
- /lib/shopify_cli/theme/ @shopify/theme-platform-dev-experience
9
- /test/project_types/theme/ @shopify/theme-platform-dev-experience
10
- /test/shopify-cli/theme/ @shopify/theme-platform-dev-experience
7
+ /lib/project_types/theme/ @shopify/theme-developer-tools
8
+ /lib/shopify_cli/theme/ @shopify/theme-developer-tools
9
+ /test/project_types/theme/ @shopify/theme-developer-tools
10
+ /test/shopify-cli/theme/ @shopify/theme-developer-tools
@@ -44,39 +44,6 @@ jobs:
44
44
 
45
45
  - name: Run Tests
46
46
  run: bundle exec rake test
47
- acceptance_tests:
48
- name: Acceptance Tests
49
- runs-on: ${{ matrix.os }}
50
- strategy:
51
- matrix:
52
- version:
53
- - 3.0.2
54
- os:
55
- - ubuntu-20.04
56
- steps:
57
- - uses: actions/checkout@v2
58
- - name: Set Git configuration
59
- run: |
60
- git config --global user.email "development-lifecycle@shopify.com"
61
- git config --global user.name "Development Lifecycle"
62
-
63
- - name: Set up Ruby ${{ matrix.version }}
64
- uses: ruby/setup-ruby@v1
65
- with:
66
- ruby-version: ${{ matrix.version }}
67
- bundler-cache: true
68
-
69
- - uses: actions/setup-node@v2
70
- with:
71
- node-version: "14.9.0"
72
-
73
- - uses: docker-practice/actions-setup-docker@master
74
-
75
- - name: Install Dependencies
76
- run: bundle install
77
-
78
- - name: Run Tests
79
- run: bundle exec cucumber
80
47
  rubocop:
81
48
  name: Rubocop
82
49
  runs-on: ${{ matrix.os }}
data/CHANGELOG.md CHANGED
@@ -2,10 +2,44 @@ 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.17.0 - 2022-05-12
6
+
7
+ ### Added
8
+ * [#2262](https://github.com/Shopify/shopify-cli/pull/2262): Add `capabilities` permissions to checkout extensions config
9
+ * [#2292](https://github.com/Shopify/shopify-cli/pull/2292): Add support for App Bridge create/details URLs for scripts
10
+
11
+ ### Fixed
12
+ * [#2287](https://github.com/Shopify/shopify-cli/pull/2287): Fix `Encoding::UndefinedConversionError` on `theme serve` and `theme pull`
13
+ * [#2310](https://github.com/Shopify/shopify-cli/pull/2310): Fix live-reload to be resilient and no longer raise an error when a locale file is invalid
14
+ * [#2297](https://github.com/Shopify/shopify-cli/pull/2297): Only show update message when the new version is higher
15
+ * [#2270](https://github.com/Shopify/shopify-cli/pull/2270): Use ignore filter regex in watcher class
16
+
17
+ ### Changed
18
+ * [#2299](https://github.com/Shopify/shopify-cli/pull/2299): Improve the unauthorized API errors when doing theme development
19
+
20
+ ## Version 2.16.1 - 2022-04-26
21
+
22
+ ### Fixed
23
+ * [#2279](https://github.com/Shopify/shopify-cli/pull/2279): Fix logout when there are theme permission issues
24
+ * [#2285](https://github.com/Shopify/shopify-cli/pull/2285): Fix extension loading for extension connect
25
+ * [#2284](https://github.com/Shopify/shopify-cli/pull/2284): Fix version check for Windows
26
+
27
+ ## Version 2.16.0 - 2022-04-25
28
+
29
+ ### Fixed
30
+ * [#2274](https://github.com/Shopify/shopify-cli/pull/2274): Fix broken `shopify extension register` and `shopify extension push`
31
+
32
+ ### Added
33
+ * [#2189](https://github.com/Shopify/shopify-cli/pull/2189): Retrieve latest CLI version in the background
34
+ * [#2263](https://github.com/Shopify/shopify-cli/pull/2263): Add `POS UI Extension` to support third party developers to extend POS smart grid functionality using native retail components.
35
+
36
+ ### Changed
37
+ * [#2272](https://github.com/Shopify/shopify-cli/pull/2272): Changed interactive apps list scope for extension create|register|connect commands
38
+
5
39
  ## Version 2.15.6 - 2022-04-12
6
40
 
7
41
  ### Fixed
8
- * [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
42
+ * [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
9
43
 
10
44
  ## Version 2.15.5 - 2022-04-08
11
45
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.15.6)
4
+ shopify-cli (2.17.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.3)
104
+ nokogiri (1.13.4)
105
105
  mini_portile2 (~> 2.8.0)
106
106
  racc (~> 1.4)
107
107
  octokit (4.22.0)
@@ -165,7 +165,7 @@ PLATFORMS
165
165
  ruby
166
166
 
167
167
  DEPENDENCIES
168
- bundler (~> 2.3.8)
168
+ bundler (~> 2.3.11)
169
169
  byebug
170
170
  colorize (~> 0.8.1)
171
171
  cucumber (~> 7.0)
@@ -187,4 +187,4 @@ DEPENDENCIES
187
187
  webmock
188
188
 
189
189
  BUNDLED WITH
190
- 2.3.8
190
+ 2.3.11
data/Tests.dockerfile CHANGED
@@ -6,7 +6,7 @@ FROM cimg/ruby:2.7.5
6
6
  RUN git config --global user.email "development-lifecycle@shopify.com"
7
7
  RUN git config --global user.name "Development Lifecycle"
8
8
 
9
- RUN gem update bundler
9
+ RUN gem install bundler -v 2.3.11
10
10
 
11
11
  WORKDIR /usr/src/app
12
12
 
@@ -1 +1 @@
1
- v0.3.0
1
+ v0.4.0
@@ -0,0 +1,20 @@
1
+ query FindOrg($id: ID!) {
2
+ organizations(id: $id, first: 1) {
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
+ }
17
+ }
18
+ }
19
+ }
20
+ }
@@ -63,6 +63,8 @@ module Extension
63
63
  autoload :Build, Project.project_filepath("tasks/execute_commands/build")
64
64
  autoload :Create, Project.project_filepath("tasks/execute_commands/create")
65
65
  autoload :Serve, Project.project_filepath("tasks/execute_commands/serve")
66
+ autoload :OutdatedExtensionDetection,
67
+ Project.project_filepath("tasks/execute_commands/outdated_extension_detection")
66
68
 
67
69
  class << self
68
70
  def build(*args)
@@ -120,6 +122,7 @@ module Extension
120
122
  module ServerConfig
121
123
  autoload :Base, Project.project_filepath("models/server_config/base")
122
124
  autoload :App, Project.project_filepath("models/server_config/app")
125
+ autoload :Capabilities, Project.project_filepath("models/server_config/capabilities")
123
126
  autoload :Development, Project.project_filepath("models/server_config/development")
124
127
  autoload :DevelopmentEntries, Project.project_filepath("models/server_config/development_entries")
125
128
  autoload :DevelopmentRenderer, Project.project_filepath("models/server_config/development_renderer")
@@ -4,8 +4,6 @@ require "shopify_cli"
4
4
  module Extension
5
5
  class Command
6
6
  class Build < ExtensionCommand
7
- hidden_feature
8
-
9
7
  prerequisite_task ensure_project_type: :extension
10
8
 
11
9
  YARN_BUILD_COMMAND = %w(build)
@@ -59,7 +59,13 @@ module Extension
59
59
  root_dir: form.directory_name,
60
60
  template: form.template,
61
61
  type: form.type.identifier.downcase,
62
+ context: @ctx,
62
63
  )
64
+ .then { |output| @ctx.puts(output) }
65
+ .unwrap do |error|
66
+ raise ShopifyCLI::Abort, error.message unless error.nil?
67
+ end
68
+
63
69
  @ctx.chdir(form.directory_name)
64
70
  write_env_file(form)
65
71
  rescue => error
@@ -14,6 +14,9 @@ module Extension
14
14
  parser.on("--resourceUrl=RESOURCE_URL", "Provide a resource URL") do |resource_url|
15
15
  flags[:resource_url] = resource_url
16
16
  end
17
+ parser.on("-p", "--port=PORT", "Specify the port to use") do |port|
18
+ flags[:port] = port.to_i
19
+ end
17
20
  end
18
21
 
19
22
  class RuntimeConfiguration
@@ -22,13 +25,14 @@ module Extension
22
25
  property :tunnel_url, accepts: String, default: nil
23
26
  property :resource_url, accepts: String, default: nil
24
27
  property! :tunnel_requested, accepts: [true, false], reader: :tunnel_requested?, default: true
25
- property! :port, accepts: (1...(2**16)), default: DEFAULT_PORT
28
+ property :port, accepts: (1...(2**16))
26
29
  end
27
30
 
28
31
  def call(_args, _command_name)
29
32
  config = RuntimeConfiguration.new(
30
33
  tunnel_requested: tunnel_requested?,
31
- resource_url: options.flags[:resource_url]
34
+ resource_url: options.flags[:resource_url],
35
+ port: options.flags[:port]
32
36
  )
33
37
 
34
38
  ShopifyCLI::Result
@@ -51,10 +55,11 @@ module Extension
51
55
  end
52
56
 
53
57
  def find_available_port(runtime_configuration)
58
+ return runtime_configuration unless runtime_configuration.port.nil?
54
59
  return runtime_configuration unless specification_handler.choose_port?(@ctx)
55
60
 
56
61
  chosen_port = Tasks::ChooseNextAvailablePort
57
- .call(from: runtime_configuration.port)
62
+ .call(from: DEFAULT_PORT)
58
63
  .unwrap { |_error| @ctx.abort(@ctx.message("serve.no_available_ports_found")) }
59
64
  runtime_configuration.tap { |c| c.port = chosen_port }
60
65
  end
@@ -24,11 +24,6 @@ module Extension
24
24
  end
25
25
 
26
26
  def config(context, include_renderer_version: true)
27
- js_system = ShopifyCLI::JsSystem.new(ctx: context)
28
- if js_system.package_manager == "yarn"
29
- run_yarn_install(context, js_system)
30
- run_yarn_run_script(context, js_system)
31
- end
32
27
  filepath = File.join(context.root, SCRIPT_PATH)
33
28
  context.abort(context.message("features.argo.missing_file_error")) unless File.exist?(filepath)
34
29
 
@@ -50,32 +45,6 @@ module Extension
50
45
  def renderer_package(context)
51
46
  Tasks::FindPackageFromJson.call(renderer_package_name, context: context)
52
47
  end
53
-
54
- private
55
-
56
- def run_yarn_install(context, js_system)
57
- _result, error, status = js_system.call(
58
- yarn: YARN_INSTALL_COMMAND + YARN_INSTALL_PARAMETERS,
59
- npm: [],
60
- capture_response: true
61
- )
62
-
63
- context.abort(
64
- context.message("features.argo.dependencies.yarn_install_error", error)
65
- ) unless status.success?
66
- end
67
-
68
- def run_yarn_run_script(context, js_system)
69
- _result, error, status = js_system.call(
70
- yarn: YARN_RUN_COMMAND + YARN_RUN_SCRIPT_NAME,
71
- npm: [],
72
- capture_response: true
73
- )
74
-
75
- context.abort(
76
- context.message("features.argo.dependencies.yarn_run_script_error", error)
77
- ) unless status.success?
78
- end
79
48
  end
80
49
  end
81
50
  end
@@ -11,7 +11,6 @@ module Extension
11
11
 
12
12
  return {} unless File.size?(file_name)
13
13
 
14
- require "yaml" # takes 20ms, so deferred as late as possible.
15
14
  begin
16
15
  config = YAML.load_file(file_name)
17
16
 
@@ -9,7 +9,7 @@ module Extension
9
9
  property! :specification_handler, accepts: Extension::Models::SpecificationHandlers::Default
10
10
  property :argo_runtime, accepts: -> (runtime) { runtime.class < Features::Runtimes::Base }
11
11
  property! :context, accepts: ShopifyCLI::Context
12
- property! :port, accepts: Integer, default: ShopifyCLI::Constants::Extension::DEFAULT_PORT
12
+ property! :port, accepts: Integer
13
13
  property :tunnel_url, accepts: String, default: nil
14
14
  property! :js_system, accepts: ->(jss) { jss.respond_to?(:call) }, default: ShopifyCLI::JsSystem
15
15
  property :resource_url, accepts: String, default: nil
@@ -194,6 +194,29 @@ module Extension
194
194
  "{{command:%1$s extension connect}} " \
195
195
  "or run {{command:%1$s extension register}} to register a new extension.",
196
196
  module_not_found: "Unable to find module %s. Ensure your dependencies are up-to-date and try again.",
197
+ development_server_binary_not_found: {
198
+ title: "Development Server Binary Missing",
199
+ message: <<~ERROR,
200
+ The extension development server binary could not be found!
201
+
202
+ If you're running a development version of the CLI, please run `rake extensions:install` to install it.
203
+ Otherwise, please file a bug report via https://github.com/Shopify/shopify-cli/issues/new.
204
+ ERROR
205
+ },
206
+ outdated_extensions: {
207
+ unknown: <<~TEXT.strip,
208
+ Please refer to the documentation for more information on how to upgrade your extension:
209
+ https://shopify.dev/apps/app-extensions
210
+ TEXT
211
+ checkout_ui_extension: <<~TEXT.strip,
212
+ Please update your package.json as follows:
213
+ * Replace the development dependency @shopify/checkout-ui-extensions-run
214
+ with @shopify/shopify-cli-extensions
215
+ * Remove the start and server script
216
+ * Add a develop script: shopify-cli-extensions develop
217
+ * Change the build script to: shopify-cli-extensions build
218
+ TEXT
219
+ },
197
220
  },
198
221
  warnings: {
199
222
  resource_url_auto_generation_failed: "{{*}} {{yellow:Warning:}} Unable to auto generate " \
@@ -27,7 +27,8 @@ module Extension
27
27
  end
28
28
 
29
29
  def create(server_config)
30
- CLI::Kit::System.capture3(executable, "create", "-", stdin_data: server_config.to_yaml)
30
+ output, _ = CLI::Kit::System.capture2e(executable, "create", "-", stdin_data: server_config.to_yaml)
31
+ output
31
32
  rescue StandardError => error
32
33
  raise error
33
34
  end
@@ -10,11 +10,17 @@ module Extension
10
10
  "checkout_post_purchase",
11
11
  "product_subscription",
12
12
  "beacon_extension",
13
+ "pos_ui_extension",
13
14
  ]
14
15
 
15
16
  class << self
16
17
  def supported?(type)
17
- binary_installed? && type_supported?(type) && type_enabled?(type)
18
+ if type_supported?(type) && type_enabled?(type)
19
+ return true if binary_installed?
20
+ warn_about_missing_binary
21
+ end
22
+
23
+ false
18
24
  end
19
25
 
20
26
  def beta_enabled?
@@ -25,15 +31,29 @@ module Extension
25
31
  SUPPORTED_EXTENSION_TYPES.include?(type.downcase)
26
32
  end
27
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
+
28
39
  private
29
40
 
30
41
  def binary_installed?
31
42
  Models::DevelopmentServer.new.executable_installed?
32
43
  end
33
44
 
34
- # Some types are enabled unconditionally; others require beta_enabled
35
- def type_enabled?(type)
36
- beta_enabled? || "checkout_ui_extension" == type.downcase
45
+ def warn_about_missing_binary
46
+ CLI::UI::Frame.open(message("errors.development_server_binary_not_found.title"), color: :yellow) do
47
+ context.puts(message("errors.development_server_binary_not_found.message"))
48
+ end
49
+ end
50
+
51
+ def message(key)
52
+ context.message(key)
53
+ end
54
+
55
+ def context
56
+ @context ||= ShopifyCLI::Context.new
37
57
  end
38
58
  end
39
59
  end
@@ -8,9 +8,9 @@ module Extension
8
8
 
9
9
  property :name
10
10
  property :version
11
- property :scripts, accepts: Hash
12
- property :dependencies, accepts: Hash
13
- property :dev_dependencies, accepts: Hash
11
+ property :scripts, accepts: Hash, default: -> { {} }
12
+ property :dependencies, accepts: Hash, default: -> { {} }
13
+ property :dev_dependencies, accepts: Hash, default: -> { {} }
14
14
 
15
15
  def initialize(**config)
16
16
  super(**config.select { |property_name, _| self.class.properties.key?(property_name) })
@@ -27,6 +27,18 @@ module Extension
27
27
  return nil unless name == other.name
28
28
  Semantic::Version.new(version) <=> Semantic::Version.new(other.version)
29
29
  end
30
+
31
+ def script?(name)
32
+ scripts.key?(name)
33
+ end
34
+
35
+ def dependency?(name)
36
+ dependencies.key?(name)
37
+ end
38
+
39
+ def dev_dependency?(name)
40
+ dev_dependencies.key?(name)
41
+ end
30
42
  end
31
43
  end
32
44
  end
@@ -0,0 +1,11 @@
1
+ module Extension
2
+ module Models
3
+ module ServerConfig
4
+ class Capabilities < Base
5
+ include SmartProperties
6
+
7
+ property :network_access, accepts: [true, false], default: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -10,6 +10,7 @@ module Extension
10
10
  "@shopify/admin-ui-extensions",
11
11
  "@shopify/post-purchase-ui-extensions",
12
12
  "@shopify/checkout-ui-extensions",
13
+ "@shopify/retail-ui-extensions",
13
14
  ]
14
15
 
15
16
  property! :name, accepts: VALID_RENDERERS
@@ -20,9 +21,13 @@ module Extension
20
21
  when "product_subscription"
21
22
  new(name: "@shopify/admin-ui-extensions", version: "^1.0.1")
22
23
  when "checkout_ui_extension"
23
- new(name: "@shopify/checkout-ui-extensions", version: "^0.14.0")
24
+ new(name: "@shopify/checkout-ui-extensions", version: "^0.15.0")
24
25
  when "checkout_post_purchase"
25
26
  new(name: "@shopify/post-purchase-ui-extensions", version: "^0.13.2")
27
+ when "pos_ui_extension"
28
+ new(name: "@shopify/retail-ui-extensions", version: "^0.1.0")
29
+ else
30
+ raise ArgumentError, "Unknown extension type: #{type}"
26
31
  end
27
32
  end
28
33
  end
@@ -10,11 +10,14 @@ module Extension
10
10
  property! :type, accepts: String
11
11
  property! :user, accepts: ServerConfig::User
12
12
  property! :development, accepts: ServerConfig::Development
13
+ property :capabilities, accepts: ServerConfig::Capabilities
13
14
  property :extension_points, accepts: Array
14
- property :version, accepts: String
15
15
  property :title, accepts: String
16
+ property :description, accepts: String
17
+ property :version, accepts: String
18
+ property :metafields, accepts: Array
16
19
 
17
- def self.build(uuid: "", template:, type:, root_dir:)
20
+ def self.build(uuid: "", template:, type:, root_dir:, **args)
18
21
  renderer = ServerConfig::DevelopmentRenderer.find(type)
19
22
  entry = ServerConfig::DevelopmentEntries.find(template)
20
23
  new(
@@ -26,7 +29,11 @@ module Extension
26
29
  template: template,
27
30
  renderer: renderer,
28
31
  entries: entry
29
- )
32
+ ),
33
+ capabilities: ServerConfig::Capabilities.new(
34
+ network_access: false
35
+ ),
36
+ metafields: args.delete(:metafields)
30
37
  )
31
38
  end
32
39
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "yaml"
4
-
5
3
  module Extension
6
4
  module Models
7
5
  module ServerConfig
@@ -15,7 +15,7 @@ module Extension
15
15
  (?<region>[a-zA-Z]{2}) # Optional region subtag
16
16
  )?
17
17
  \z}x
18
- PERMITTED_CONFIG_KEYS = [:extension_points, :metafields, :name]
18
+ PERMITTED_CONFIG_KEYS = [:extension_points, :metafields, :name, :capabilities]
19
19
 
20
20
  def config(context)
21
21
  {
@@ -62,6 +62,10 @@ module Extension
62
62
  required_fields: [:shop],
63
63
  cli_package_name: "@shopify/checkout-ui-extensions-run",
64
64
  },
65
+ point_of_sale: {
66
+ git_template: "",
67
+ renderer_package_name: "@shopify/retail-ui-extensions",
68
+ },
65
69
  }
66
70
  end
67
71
  end
@@ -9,13 +9,14 @@ module Extension
9
9
  property! :api_key, accepts: String
10
10
  property! :context, accepts: ShopifyCLI::Context
11
11
  property! :hash, accepts: Hash
12
- property :port, accepts: Integer, default: ShopifyCLI::Constants::Extension::DEFAULT_PORT
12
+ property! :port, accepts: Integer
13
13
  property! :registration_uuid, accepts: String
14
14
  property :resource_url, accepts: String
15
15
  property! :store, accepts: String
16
16
  property! :title, accepts: String
17
17
  property :tunnel_url, accepts: String
18
18
  property! :type, accepts: String
19
+ property :metafields, accepts: Array
19
20
 
20
21
  DEFAULT_BUILD_DIR = "build"
21
22
 
@@ -27,7 +28,6 @@ module Extension
27
28
  context.abort(context.message("tasks.errors.parse_error")) if hash.nil?
28
29
 
29
30
  renderer = Models::ServerConfig::DevelopmentRenderer.find(type)
30
-
31
31
  extension = Models::ServerConfig::Extension.new(
32
32
  uuid: registration_uuid,
33
33
  type: type.upcase,
@@ -40,8 +40,12 @@ module Extension
40
40
  )
41
41
  ),
42
42
  extension_points: hash.dig("extension_points"),
43
- version: version(renderer.name, context),
44
- title: title
43
+ capabilities: Models::ServerConfig::Capabilities.new(
44
+ network_access: hash.dig("capabilities", "network_access") || false
45
+ ),
46
+ version: renderer ? version(renderer.name, context) : nil,
47
+ title: title,
48
+ metafields: metafields
45
49
  )
46
50
 
47
51
  unless resource_url.nil?
@@ -6,7 +6,9 @@ module Extension
6
6
  module ExecuteCommands
7
7
  class Base
8
8
  include SmartProperties
9
+
9
10
  property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
11
+ property! :context, accepts: ShopifyCLI::Context
10
12
  end
11
13
  end
12
14
  end
@@ -5,7 +5,8 @@ module Extension
5
5
  module Tasks
6
6
  module ExecuteCommands
7
7
  class Build < Base
8
- property! :context, accepts: ShopifyCLI::Context
8
+ prepend OutdatedExtensionDetection
9
+
9
10
  property! :config_file_path, accepts: String
10
11
 
11
12
  def call
@@ -11,9 +11,6 @@ module Extension
11
11
  def call
12
12
  ShopifyCLI::Result.success(generate_config)
13
13
  .then { |server_config| Models::DevelopmentServer.new.create(server_config) }
14
- .unwrap do |error|
15
- raise error unless error.nil?
16
- end
17
14
  end
18
15
 
19
16
  private