shopify-cli 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +9 -0
  5. data/README.md +39 -7
  6. data/Rakefile +2 -0
  7. data/dev.yml +2 -2
  8. data/docs/_config.yml +1 -18
  9. data/docs/app/node/commands/index.md +2 -80
  10. data/docs/app/node/index.md +2 -33
  11. data/docs/app/rails/commands/index.md +2 -78
  12. data/docs/app/rails/index.md +2 -34
  13. data/docs/core/index.md +2 -84
  14. data/docs/getting-started/index.md +2 -25
  15. data/docs/getting-started/install/index.md +1 -118
  16. data/docs/getting-started/migrate/index.md +2 -94
  17. data/docs/getting-started/uninstall/index.md +2 -35
  18. data/docs/getting-started/upgrade/index.md +2 -39
  19. data/docs/help/start-app/index.md +2 -4
  20. data/docs/index.md +2 -24
  21. data/install.sh +1 -1
  22. data/lib/project_types/extension/cli.rb +19 -10
  23. data/lib/project_types/extension/commands/extension_command.rb +2 -2
  24. data/lib/project_types/extension/features/argo.rb +117 -0
  25. data/lib/project_types/extension/forms/create.rb +2 -2
  26. data/lib/project_types/extension/models/specification.rb +35 -0
  27. data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
  28. data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
  29. data/lib/project_types/extension/models/specifications.rb +77 -0
  30. data/lib/project_types/extension/tasks/configure_features.rb +52 -0
  31. data/lib/project_types/extension/tasks/fetch_specifications.rb +38 -0
  32. data/lib/project_types/node/commands/create.rb +3 -1
  33. data/lib/project_types/node/commands/generate.rb +2 -11
  34. data/lib/project_types/node/messages/messages.rb +9 -44
  35. data/lib/project_types/rails/commands/create.rb +8 -9
  36. data/lib/project_types/rails/forms/create.rb +1 -1
  37. data/lib/project_types/rails/gem.rb +1 -1
  38. data/lib/project_types/rails/messages/messages.rb +1 -1
  39. data/lib/project_types/script/cli.rb +7 -4
  40. data/lib/project_types/script/commands/create.rb +6 -4
  41. data/lib/project_types/script/commands/push.rb +5 -13
  42. data/lib/project_types/script/config/extension_points.yml +9 -5
  43. data/lib/project_types/script/errors.rb +17 -0
  44. data/lib/project_types/script/forms/create.rb +26 -2
  45. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +10 -1
  46. data/lib/project_types/script/layers/application/build_script.rb +9 -4
  47. data/lib/project_types/script/layers/application/create_script.rb +12 -10
  48. data/lib/project_types/script/layers/application/extension_points.rb +24 -0
  49. data/lib/project_types/script/layers/application/push_script.rb +18 -16
  50. data/lib/project_types/script/layers/domain/errors.rb +4 -0
  51. data/lib/project_types/script/layers/domain/extension_point.rb +62 -6
  52. data/lib/project_types/script/layers/domain/metadata.rb +55 -0
  53. data/lib/project_types/script/layers/domain/push_package.rb +25 -6
  54. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +6 -6
  55. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +16 -6
  56. data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +10 -4
  57. data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
  58. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +25 -13
  59. data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
  60. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
  61. data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -1
  62. data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
  63. data/lib/project_types/script/messages/messages.rb +39 -8
  64. data/lib/project_types/script/script_project.rb +25 -16
  65. data/lib/project_types/script/ui/error_handler.rb +34 -1
  66. data/lib/project_types/theme/cli.rb +40 -0
  67. data/lib/project_types/theme/commands/connect.rb +54 -0
  68. data/lib/project_types/theme/commands/create.rb +48 -0
  69. data/lib/project_types/theme/commands/deploy.rb +38 -0
  70. data/lib/project_types/theme/commands/generate.rb +20 -0
  71. data/lib/project_types/theme/commands/generate/env.rb +79 -0
  72. data/lib/project_types/theme/commands/push.rb +55 -0
  73. data/lib/project_types/theme/commands/serve.rb +31 -0
  74. data/lib/project_types/theme/forms/connect.rb +34 -0
  75. data/lib/project_types/theme/forms/create.rb +22 -0
  76. data/lib/project_types/theme/messages/messages.rb +147 -0
  77. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
  78. data/lib/project_types/theme/themekit.rb +113 -0
  79. data/lib/shopify-cli/admin_api.rb +42 -2
  80. data/lib/shopify-cli/api.rb +27 -24
  81. data/lib/shopify-cli/commands/system.rb +1 -1
  82. data/lib/shopify-cli/context.rb +23 -2
  83. data/lib/shopify-cli/feature.rb +0 -2
  84. data/lib/shopify-cli/http_request.rb +20 -8
  85. data/lib/shopify-cli/messages/messages.rb +6 -3
  86. data/lib/shopify-cli/method_object.rb +104 -0
  87. data/lib/shopify-cli/partners_api.rb +8 -2
  88. data/lib/shopify-cli/project_type.rb +1 -1
  89. data/lib/shopify-cli/resolve_constant.rb +25 -0
  90. data/lib/shopify-cli/result.rb +432 -0
  91. data/lib/shopify-cli/shopifolk.rb +3 -2
  92. data/lib/shopify-cli/tasks/select_org_and_shop.rb +6 -5
  93. data/lib/shopify-cli/tunnel.rb +7 -1
  94. data/lib/shopify-cli/version.rb +1 -1
  95. data/lib/shopify_cli.rb +4 -1
  96. data/shopify.fish +1 -1
  97. data/shopify.sh +1 -1
  98. data/vendor/deps/cli-kit/REVISION +1 -1
  99. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
  100. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
  101. data/vendor/deps/cli-ui/REVISION +1 -1
  102. data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
  103. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
  104. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
  105. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
  106. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
  107. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
  108. data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
  109. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
  110. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
  111. data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
  112. data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
  113. data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
  114. data/vendor/deps/webrick/.gitignore +9 -0
  115. data/vendor/deps/webrick/Gemfile +3 -0
  116. data/vendor/deps/webrick/LICENSE.txt +22 -0
  117. data/vendor/deps/webrick/README.md +61 -0
  118. data/vendor/deps/webrick/Rakefile +10 -0
  119. data/vendor/deps/webrick/lib/webrick.rb +232 -0
  120. data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
  121. data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
  122. data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
  123. data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
  124. data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
  125. data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
  126. data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
  127. data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
  128. data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
  129. data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
  130. data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
  131. data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
  132. data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
  133. data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
  134. data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
  135. data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
  136. data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
  137. data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
  138. data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
  139. data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
  140. data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
  141. data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  142. data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
  143. data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
  144. data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
  145. data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
  146. data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
  147. data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
  148. data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
  149. data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
  150. data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
  151. data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
  152. data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
  153. data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
  154. data/vendor/deps/webrick/webrick.gemspec +74 -0
  155. metadata +70 -26
  156. data/docs/Gemfile +0 -5
  157. data/docs/Gemfile.lock +0 -258
  158. data/docs/_data/nav.yml +0 -35
  159. data/docs/_includes/footer.html +0 -15
  160. data/docs/_includes/head.html +0 -19
  161. data/docs/_includes/sidebar_nav.html +0 -22
  162. data/docs/_includes/toc.html +0 -112
  163. data/docs/_layouts/default.html +0 -79
  164. data/docs/css/docs.css +0 -157
  165. data/docs/images/header.png +0 -0
  166. data/docs/installing-ruby.md +0 -28
  167. data/lib/project_types/extension/features/argo/admin.rb +0 -20
  168. data/lib/project_types/extension/features/argo/base.rb +0 -129
  169. data/lib/project_types/extension/features/argo/checkout.rb +0 -20
  170. data/lib/project_types/extension/models/type.rb +0 -81
  171. data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
  172. data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
  173. data/lib/project_types/node/commands/generate/billing.rb +0 -39
  174. data/lib/project_types/node/commands/generate/page.rb +0 -59
  175. data/lib/project_types/node/commands/generate/webhook.rb +0 -37
  176. data/lib/project_types/script/layers/domain/script.rb +0 -18
  177. data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -47
  178. data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
  179. data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
@@ -0,0 +1,117 @@
1
+ # frozen_string_literal: true
2
+ require 'base64'
3
+ require 'shopify_cli'
4
+ require 'semantic/semantic'
5
+
6
+ module Extension
7
+ module Features
8
+ class Argo
9
+ include SmartProperties
10
+
11
+ property! :git_template, converts: :to_str
12
+ property! :renderer_package_name, converts: :to_str
13
+
14
+ SCRIPT_PATH = %w(build main.js).freeze
15
+
16
+ NPM_LIST_COMMAND = %w(list).freeze
17
+ YARN_LIST_COMMAND = %w(list --pattern).freeze
18
+ NPM_LIST_PARAMETERS = %w(--prod).freeze
19
+ YARN_LIST_PARAMETERS = %w(--production).freeze
20
+ private_constant :NPM_LIST_COMMAND, :YARN_LIST_COMMAND, :NPM_LIST_PARAMETERS, :YARN_LIST_PARAMETERS
21
+
22
+ YARN_INSTALL_COMMAND = %w(install).freeze
23
+ YARN_INSTALL_PARAMETERS = %w(--silent).freeze
24
+ YARN_RUN_COMMAND = %w(run).freeze
25
+ YARN_RUN_SCRIPT_NAME = %w(build).freeze
26
+ private_constant :YARN_INSTALL_COMMAND, :YARN_INSTALL_PARAMETERS, :YARN_RUN_COMMAND, :YARN_RUN_SCRIPT_NAME
27
+
28
+ def create(directory_name, identifier, context)
29
+ Features::ArgoSetup.new(git_template: git_template).call(directory_name, identifier, context)
30
+ end
31
+
32
+ def config(context)
33
+ js_system = ShopifyCli::JsSystem.new(ctx: context)
34
+ if js_system.package_manager == 'yarn'
35
+ run_yarn_install(context, js_system)
36
+ run_yarn_run_script(context, js_system)
37
+ end
38
+ filepath = File.join(context.root, SCRIPT_PATH)
39
+ context.abort(context.message('features.argo.missing_file_error')) unless File.exist?(filepath)
40
+ begin
41
+ {
42
+ renderer_version: extract_argo_renderer_version(context),
43
+ serialized_script: Base64.strict_encode64(File.read(filepath).chomp),
44
+ }
45
+ rescue StandardError
46
+ context.abort(context.message('features.argo.script_prepare_error'))
47
+ end
48
+ end
49
+
50
+ private
51
+
52
+ def extract_argo_renderer_version(context)
53
+ result = run_list_command(context)
54
+ found_version = find_version_number(context, result)
55
+ context.abort(
56
+ context.message('features.argo.dependencies.argo_renderer_package_invalid_version_error')
57
+ ) if found_version.nil?
58
+ ::Semantic::Version.new(found_version).to_s
59
+ rescue ArgumentError
60
+ context.abort(
61
+ context.message('features.argo.dependencies.argo_renderer_package_invalid_version_error')
62
+ )
63
+ end
64
+
65
+ def find_version_number(context, result)
66
+ packages = result.to_json.split('\n')
67
+ found_package = packages.find do |package|
68
+ package.match(/#{renderer_package_name}@/)
69
+ end
70
+ if found_package.nil?
71
+ error = "'#{renderer_package_name}' not found."
72
+ context.abort(
73
+ context.message('features.argo.dependencies.argo_missing_renderer_package_error', error)
74
+ )
75
+ end
76
+ found_package.split('@')[2]&.strip
77
+ end
78
+
79
+ def run_list_command(context)
80
+ js_system = ShopifyCli::JsSystem.new(ctx: context)
81
+ result, error, status = js_system.call(
82
+ yarn: YARN_LIST_COMMAND + [renderer_package_name] + YARN_LIST_PARAMETERS,
83
+ npm: NPM_LIST_COMMAND + [renderer_package_name] + NPM_LIST_PARAMETERS,
84
+ capture_response: true
85
+ )
86
+ context.abort(
87
+ context.message('features.argo.dependencies.argo_missing_renderer_package_error', error)
88
+ ) unless status.success?
89
+ result
90
+ end
91
+
92
+ def run_yarn_install(context, js_system)
93
+ _result, error, status = js_system.call(
94
+ yarn: YARN_INSTALL_COMMAND + YARN_INSTALL_PARAMETERS,
95
+ npm: [],
96
+ capture_response: true
97
+ )
98
+
99
+ context.abort(
100
+ context.message('features.argo.dependencies.yarn_install_error', error)
101
+ ) unless status.success?
102
+ end
103
+
104
+ def run_yarn_run_script(context, js_system)
105
+ _result, error, status = js_system.call(
106
+ yarn: YARN_RUN_COMMAND + YARN_RUN_SCRIPT_NAME,
107
+ npm: [],
108
+ capture_response: true
109
+ )
110
+
111
+ context.abort(
112
+ context.message('features.argo.dependencies.yarn_run_script_error', error)
113
+ ) unless status.success?
114
+ end
115
+ end
116
+ end
117
+ end
@@ -26,11 +26,11 @@ module Extension
26
26
  end
27
27
 
28
28
  def ask_type
29
- return Models::Type.load_type(type) if Models::Type.valid?(type)
29
+ return Extension.specifications[type] if Extension.specifications.valid?(type)
30
30
  ctx.puts(ctx.message('create.invalid_type')) unless type.nil?
31
31
 
32
32
  CLI::UI::Prompt.ask(ctx.message('create.ask_type')) do |handler|
33
- Models::Type.repository.values.each do |type|
33
+ Extension.specifications.each do |type|
34
34
  handler.option("#{type.name} #{type.tagline}") { type }
35
35
  end
36
36
  end
@@ -0,0 +1,35 @@
1
+ module Extension
2
+ module Models
3
+ class Specification
4
+ include SmartProperties
5
+
6
+ module Features
7
+ class Argo
8
+ include SmartProperties
9
+
10
+ property! :surface_area, converts: :to_str
11
+ property! :renderer_package_name, converts: :to_str
12
+ property! :git_template, converts: :to_str
13
+ end
14
+
15
+ def self.build(feature_set_attributes)
16
+ feature_set_attributes.each_with_object(OpenStruct.new) do |(identifier, feature_attributes), feature_set|
17
+ feature_set[identifier] = ShopifyCli::ResolveConstant
18
+ .call(identifier, namespace: Features)
19
+ .rescue { OpenStruct }
20
+ .then { |c| c.new(**feature_attributes) }
21
+ .unwrap { |error| raise error }
22
+ end
23
+ end
24
+ end
25
+
26
+ property! :identifier
27
+ property :graphql_identifier, converts: :to_str
28
+ property! :features, converts: Features.method(:build), default: -> { [] }
29
+
30
+ def graphql_identifier
31
+ super || identifier
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ require 'base64'
3
+
4
+ module Extension
5
+ module Models
6
+ module SpecificationHandlers
7
+ class CheckoutPostPurchase < Default
8
+ PERMITTED_CONFIG_KEYS = [:metafields]
9
+
10
+ def config(context)
11
+ {
12
+ **Features::ArgoConfig.parse_yaml(context, PERMITTED_CONFIG_KEYS),
13
+ **argo.config(context),
14
+ }
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Extension
4
+ module Models
5
+ module SpecificationHandlers
6
+ class Default
7
+ attr_reader :specification
8
+
9
+ def initialize(specification)
10
+ @specification = specification
11
+ end
12
+
13
+ def identifier
14
+ specification.identifier.to_s.upcase
15
+ end
16
+
17
+ def graphql_identifier
18
+ specification.graphql_identifier.to_s.upcase
19
+ end
20
+
21
+ def name
22
+ message('name')
23
+ end
24
+
25
+ def tagline
26
+ message('tagline') || ""
27
+ end
28
+
29
+ def config(context)
30
+ argo.config(context)
31
+ end
32
+
33
+ def create(directory_name, context)
34
+ argo.create(directory_name, identifier, context)
35
+ end
36
+
37
+ def extension_context(_context)
38
+ nil
39
+ end
40
+
41
+ def valid_extension_contexts
42
+ []
43
+ end
44
+
45
+ protected
46
+
47
+ def argo
48
+ Features::Argo.new(
49
+ git_template: specification.features.argo.git_template,
50
+ renderer_package_name: specification.features.argo.renderer_package_name,
51
+ )
52
+ end
53
+
54
+ private
55
+
56
+ def message(key, *params)
57
+ return unless messages.key?(key.to_sym)
58
+ messages[key.to_sym] % params
59
+ end
60
+
61
+ def messages
62
+ @messages ||= Messages::TYPES[identifier.downcase.to_sym] || {}
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,77 @@
1
+ module Extension
2
+ module Models
3
+ class Specifications
4
+ include SmartProperties
5
+
6
+ property! :custom_handler_root,
7
+ accepts: ->(d) { File.directory?(d) },
8
+ default: -> { File.expand_path('lib/project_types/extension/models/specification_handlers', ShopifyCli::ROOT) }
9
+
10
+ property! :custom_handler_namespace,
11
+ accepts: ->(m) { m.respond_to?(:const_get) },
12
+ default: -> { ::Extension::Models::SpecificationHandlers }
13
+
14
+ property! :fetch_specifications,
15
+ accepts: ->(p) { p.respond_to?(:to_proc) }
16
+
17
+ def [](identifier)
18
+ handlers[identifier]
19
+ end
20
+
21
+ def valid?(identifier)
22
+ handlers.key?(identifier)
23
+ end
24
+
25
+ def each(&block)
26
+ handlers.values.each(&block)
27
+ end
28
+
29
+ protected
30
+
31
+ def handlers
32
+ @handlers ||= fetch_specifications_and_build_handlers
33
+ end
34
+
35
+ private
36
+
37
+ def fetch_specifications_and_build_handlers
38
+ ShopifyCli::Result
39
+ .call(&fetch_specifications)
40
+ .then(&Tasks::ConfigureFeatures)
41
+ .then(&method(:ensure_legacy_compatibility))
42
+ .then(&method(:build_specifications))
43
+ .then(&method(:require_handler_implementations))
44
+ .then(&method(:instantiate_specification_handlers))
45
+ .unwrap { |err| raise err }
46
+ end
47
+
48
+ def require_handler_implementations(specifications)
49
+ specifications.each do |s|
50
+ implementation_file = File.join(custom_handler_root, "#{s.identifier}.rb")
51
+ require(implementation_file) if File.file?(implementation_file)
52
+ end
53
+ end
54
+
55
+ def instantiate_specification_handlers(specifications)
56
+ specifications.each_with_object({}) do |specification, handlers|
57
+ ShopifyCli::ResolveConstant.call(specification.identifier, namespace: custom_handler_namespace)
58
+ .rescue { |error| error.is_a?(NameError) ? SpecificationHandlers::Default : raise(error) }
59
+ .then { |handler_class| handler_class.new(specification) }
60
+ .unwrap { |error| raise error }
61
+ .yield_self { |handler| handlers[handler.identifier] = handler }
62
+ end
63
+ end
64
+
65
+ def ensure_legacy_compatibility(specification_attribute_sets)
66
+ specification_attribute_sets.each do |attributes|
67
+ next unless attributes.fetch(:identifier) == 'product_subscription'
68
+ attributes[:graphql_identifier] = 'SUBSCRIPTION_MANAGEMENT'
69
+ end
70
+ end
71
+
72
+ def build_specifications(specification_attribute_sets)
73
+ specification_attribute_sets.map { |attributes| Models::Specification.new(**attributes) }
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,52 @@
1
+ module Extension
2
+ module Tasks
3
+ class ConfigureFeatures
4
+ include ShopifyCli::MethodObject
5
+
6
+ class Error < RuntimeError; end
7
+ class UnknownSurfaceArea < Error; end
8
+ class UnspecifiedSurfaceArea < Error; end
9
+
10
+ def call(specification_attribute_sets)
11
+ specification_attribute_sets.each do |attributes|
12
+ argo_configuration = extract_argo_configuration(attributes)
13
+ next if argo_configuration.nil?
14
+ surface_area = extract_surface_area(argo_configuration)
15
+ surface_area_configuration = fetch_surface_area_configuration(surface_area)
16
+ argo_configuration.merge!(surface_area_configuration)
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def extract_argo_configuration(attributes)
23
+ attributes.dig(:features, :argo)
24
+ end
25
+
26
+ def extract_surface_area(argo_configuration)
27
+ argo_configuration.fetch(:surface_area) do
28
+ raise UnspecifiedSurfaceArea, "Argo configuration does not specify surface area"
29
+ end
30
+ end
31
+
32
+ def fetch_surface_area_configuration(surface_area)
33
+ surface_area_configurations.fetch(surface_area.to_sym) do
34
+ raise UnknownSurfaceArea, "Unknown surface area: #{surface_area}"
35
+ end
36
+ end
37
+
38
+ def surface_area_configurations
39
+ {
40
+ admin: {
41
+ git_template: 'https://github.com/Shopify/argo-admin-template.git',
42
+ renderer_package_name: '@shopify/argo-admin',
43
+ },
44
+ checkout: {
45
+ git_template: 'https://github.com/Shopify/argo-checkout-template.git',
46
+ renderer_package_name: '@shopify/argo-checkout',
47
+ },
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,38 @@
1
+ module Extension
2
+ module Tasks
3
+ class FetchSpecifications
4
+ include ShopifyCli::MethodObject
5
+
6
+ def call
7
+ [
8
+ product_subscription_specification,
9
+ checkout_post_purchase_specification,
10
+ ]
11
+ end
12
+
13
+ private
14
+
15
+ def product_subscription_specification
16
+ {
17
+ identifier: 'product_subscription',
18
+ features: {
19
+ argo: {
20
+ surface_area: 'admin',
21
+ },
22
+ },
23
+ }
24
+ end
25
+
26
+ def checkout_post_purchase_specification
27
+ {
28
+ identifier: 'checkout_post_purchase',
29
+ features: {
30
+ argo: {
31
+ surface_area: 'checkout',
32
+ },
33
+ },
34
+ }
35
+ end
36
+ end
37
+ end
38
+ end
@@ -44,7 +44,9 @@ module Node
44
44
 
45
45
  @ctx.puts(@ctx.message('apps.create.info.created', form.title, partners_url))
46
46
  @ctx.puts(@ctx.message('apps.create.info.serve', form.name, ShopifyCli::TOOL_NAME))
47
- @ctx.puts(@ctx.message('apps.create.info.install', partners_url, form.title))
47
+ unless ShopifyCli::Shopifolk.acting_as_shopify_organization?
48
+ @ctx.puts(@ctx.message('apps.create.info.install', partners_url, form.title))
49
+ end
48
50
  end
49
51
 
50
52
  def self.help
@@ -13,20 +13,11 @@ module Node
13
13
  end
14
14
 
15
15
  def self.help
16
- ShopifyCli::Context.message('node.generate.help', ShopifyCli::TOOL_NAME)
16
+ ShopifyCli::Context.message('node.generate.help')
17
17
  end
18
18
 
19
19
  def self.extended_help
20
- extended_help = "{{bold:Subcommands:}}\n"
21
- subcommand_registry.resolved_commands.sort.each do |name, klass|
22
- extended_help += " {{cyan:#{name}}}: "
23
-
24
- if (subcmd_help = klass.help)
25
- extended_help += subcmd_help.gsub("\n ", "\n ")
26
- end
27
- extended_help += "\n"
28
- end
29
- extended_help += ShopifyCli::Context.message('node.generate.extended_help', ShopifyCli::TOOL_NAME)
20
+ help
30
21
  end
31
22
 
32
23
  def self.run_generate(script, name, ctx)