shopify-cli 1.3.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +2 -2
  3. data/.github/CONTRIBUTING.md +9 -1
  4. data/.github/PULL_REQUEST_TEMPLATE.md +10 -1
  5. data/.github/workflows/release.yml +61 -0
  6. data/.github/workflows/triage.yml +22 -0
  7. data/.gitignore +0 -1
  8. data/.rubocop.yml +61 -8
  9. data/.rubocop_todo.yml +11 -0
  10. data/.travis.yml +1 -0
  11. data/CHANGELOG.md +30 -0
  12. data/Gemfile +3 -2
  13. data/Gemfile.lock +39 -37
  14. data/README.md +39 -7
  15. data/RELEASING.md +19 -29
  16. data/Rakefile +2 -0
  17. data/dev.yml +2 -2
  18. data/docs/_config.yml +1 -18
  19. data/docs/app/node/commands/index.md +2 -80
  20. data/docs/app/node/index.md +2 -33
  21. data/docs/app/rails/commands/index.md +2 -78
  22. data/docs/app/rails/index.md +2 -34
  23. data/docs/core/index.md +2 -84
  24. data/docs/getting-started/index.md +2 -25
  25. data/docs/getting-started/install/index.md +1 -118
  26. data/docs/getting-started/migrate/index.md +2 -94
  27. data/docs/getting-started/uninstall/index.md +2 -35
  28. data/docs/getting-started/upgrade/index.md +2 -39
  29. data/docs/help/start-app/index.md +2 -4
  30. data/docs/index.md +2 -24
  31. data/install.sh +1 -1
  32. data/lib/project_types/extension/cli.rb +21 -11
  33. data/lib/project_types/extension/commands/extension_command.rb +2 -2
  34. data/lib/project_types/extension/features/argo.rb +117 -0
  35. data/lib/project_types/extension/forms/create.rb +2 -2
  36. data/lib/project_types/extension/models/specification.rb +35 -0
  37. data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
  38. data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
  39. data/lib/project_types/extension/models/specifications.rb +77 -0
  40. data/lib/project_types/extension/tasks/configure_features.rb +52 -0
  41. data/lib/project_types/extension/tasks/fetch_specifications.rb +38 -0
  42. data/lib/project_types/node/cli.rb +4 -1
  43. data/lib/project_types/node/commands/connect.rb +15 -0
  44. data/lib/project_types/node/commands/create.rb +10 -4
  45. data/lib/project_types/node/commands/generate.rb +2 -11
  46. data/lib/project_types/node/messages/messages.rb +16 -50
  47. data/lib/project_types/rails/cli.rb +4 -1
  48. data/lib/project_types/rails/commands/connect.rb +15 -0
  49. data/lib/project_types/rails/commands/create.rb +15 -12
  50. data/lib/project_types/rails/forms/create.rb +1 -1
  51. data/lib/project_types/rails/gem.rb +1 -1
  52. data/lib/project_types/rails/messages/messages.rb +8 -5
  53. data/lib/project_types/script/cli.rb +9 -5
  54. data/lib/project_types/script/commands/create.rb +6 -4
  55. data/lib/project_types/script/commands/enable.rb +12 -4
  56. data/lib/project_types/script/commands/push.rb +5 -13
  57. data/lib/project_types/script/config/extension_points.yml +17 -12
  58. data/lib/project_types/script/errors.rb +21 -0
  59. data/lib/project_types/script/forms/create.rb +26 -2
  60. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +10 -1
  61. data/lib/project_types/script/layers/application/build_script.rb +18 -17
  62. data/lib/project_types/script/layers/application/create_script.rb +12 -10
  63. data/lib/project_types/script/layers/application/extension_points.rb +24 -0
  64. data/lib/project_types/script/layers/application/push_script.rb +18 -16
  65. data/lib/project_types/script/layers/domain/errors.rb +7 -0
  66. data/lib/project_types/script/layers/domain/extension_point.rb +62 -7
  67. data/lib/project_types/script/layers/domain/metadata.rb +55 -0
  68. data/lib/project_types/script/layers/domain/push_package.rb +25 -6
  69. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +17 -52
  70. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +42 -11
  71. data/lib/project_types/script/layers/infrastructure/errors.rb +16 -0
  72. data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +10 -4
  73. data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
  74. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +25 -13
  75. data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
  76. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
  77. data/lib/project_types/script/layers/infrastructure/script_service.rb +9 -1
  78. data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
  79. data/lib/project_types/script/messages/messages.rb +55 -4
  80. data/lib/project_types/script/script_project.rb +25 -16
  81. data/lib/project_types/script/ui/error_handler.rb +59 -1
  82. data/lib/project_types/theme/cli.rb +40 -0
  83. data/lib/project_types/theme/commands/connect.rb +54 -0
  84. data/lib/project_types/theme/commands/create.rb +48 -0
  85. data/lib/project_types/theme/commands/deploy.rb +38 -0
  86. data/lib/project_types/theme/commands/generate.rb +20 -0
  87. data/lib/project_types/theme/commands/generate/env.rb +79 -0
  88. data/lib/project_types/theme/commands/push.rb +55 -0
  89. data/lib/project_types/theme/commands/serve.rb +31 -0
  90. data/lib/project_types/theme/forms/connect.rb +34 -0
  91. data/lib/project_types/theme/forms/create.rb +22 -0
  92. data/lib/project_types/theme/messages/messages.rb +147 -0
  93. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
  94. data/lib/project_types/theme/themekit.rb +113 -0
  95. data/lib/shopify-cli/admin_api.rb +42 -2
  96. data/lib/shopify-cli/api.rb +34 -33
  97. data/lib/shopify-cli/commands/config.rb +24 -0
  98. data/lib/shopify-cli/commands/connect.rb +32 -15
  99. data/lib/shopify-cli/commands/system.rb +10 -1
  100. data/lib/shopify-cli/context.rb +23 -2
  101. data/lib/shopify-cli/core/entry_point.rb +1 -1
  102. data/lib/shopify-cli/core/monorail.rb +6 -4
  103. data/lib/shopify-cli/feature.rb +0 -2
  104. data/lib/shopify-cli/http_request.rb +27 -0
  105. data/lib/shopify-cli/js_deps.rb +1 -1
  106. data/lib/shopify-cli/messages/messages.rb +31 -7
  107. data/lib/shopify-cli/method_object.rb +104 -0
  108. data/lib/shopify-cli/partners_api.rb +25 -3
  109. data/lib/shopify-cli/process_supervision.rb +1 -1
  110. data/lib/shopify-cli/project.rb +12 -8
  111. data/lib/shopify-cli/project_type.rb +18 -2
  112. data/lib/shopify-cli/resolve_constant.rb +25 -0
  113. data/lib/shopify-cli/result.rb +432 -0
  114. data/lib/shopify-cli/shopifolk.rb +87 -0
  115. data/lib/shopify-cli/task.rb +8 -0
  116. data/lib/shopify-cli/tasks/create_api_client.rb +13 -2
  117. data/lib/shopify-cli/tasks/ensure_env.rb +3 -0
  118. data/lib/shopify-cli/tasks/select_org_and_shop.rb +10 -5
  119. data/lib/shopify-cli/tunnel.rb +8 -2
  120. data/lib/shopify-cli/version.rb +1 -1
  121. data/lib/shopify_cli.rb +5 -1
  122. data/shopify.fish +1 -1
  123. data/shopify.sh +1 -1
  124. data/vendor/deps/cli-kit/REVISION +1 -1
  125. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
  126. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
  127. data/vendor/deps/cli-ui/REVISION +1 -1
  128. data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
  129. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
  130. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
  131. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
  132. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
  133. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
  134. data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
  135. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
  136. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
  137. data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
  138. data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
  139. data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
  140. data/vendor/deps/webrick/.gitignore +9 -0
  141. data/vendor/deps/webrick/Gemfile +3 -0
  142. data/vendor/deps/webrick/LICENSE.txt +22 -0
  143. data/vendor/deps/webrick/README.md +61 -0
  144. data/vendor/deps/webrick/Rakefile +10 -0
  145. data/vendor/deps/webrick/lib/webrick.rb +232 -0
  146. data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
  147. data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
  148. data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
  149. data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
  150. data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
  151. data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
  152. data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
  153. data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
  154. data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
  155. data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
  156. data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
  157. data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
  158. data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
  159. data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
  160. data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
  161. data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
  162. data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
  163. data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
  164. data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
  165. data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
  166. data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
  167. data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  168. data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
  169. data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
  170. data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
  171. data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
  172. data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
  173. data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
  174. data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
  175. data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
  176. data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
  177. data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
  178. data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
  179. data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
  180. data/vendor/deps/webrick/webrick.gemspec +74 -0
  181. metadata +77 -27
  182. data/docs/Gemfile +0 -5
  183. data/docs/Gemfile.lock +0 -258
  184. data/docs/_data/nav.yml +0 -35
  185. data/docs/_includes/footer.html +0 -15
  186. data/docs/_includes/head.html +0 -19
  187. data/docs/_includes/sidebar_nav.html +0 -22
  188. data/docs/_includes/toc.html +0 -112
  189. data/docs/_layouts/default.html +0 -79
  190. data/docs/css/docs.css +0 -157
  191. data/docs/images/header.png +0 -0
  192. data/docs/installing-ruby.md +0 -28
  193. data/lib/project_types/extension/features/argo/admin.rb +0 -20
  194. data/lib/project_types/extension/features/argo/base.rb +0 -129
  195. data/lib/project_types/extension/features/argo/checkout.rb +0 -20
  196. data/lib/project_types/extension/models/type.rb +0 -81
  197. data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
  198. data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
  199. data/lib/project_types/node/commands/generate/billing.rb +0 -39
  200. data/lib/project_types/node/commands/generate/page.rb +0 -59
  201. data/lib/project_types/node/commands/generate/webhook.rb +0 -37
  202. data/lib/project_types/script/layers/domain/script.rb +0 -18
  203. data/lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb +0 -38
  204. data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -59
  205. data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
  206. data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
Binary file
@@ -1,28 +0,0 @@
1
- # Installing Ruby
2
-
3
- ## Mac OS
4
-
5
- We recommend using [`ruby-install`][ruby-install] and [`chruby`][chruby] from Homebrew to manage ruby versions.
6
-
7
- 1. Install [Homebrew][brew]
8
- 1. Install `ruby-install` and `chruby`. Be sure to follow the instructions for adding the chruby shell hook to your ~/.bash_profile or ~/.zshrc file.
9
-
10
- brew install ruby-install chruby
11
-
12
- 1. Install ruby 2.5.1:
13
-
14
- ruby-install ruby-2.5.1
15
-
16
- 1. **Open a new terminal window** and activate ruby 2.5.1:
17
-
18
- chruby ruby-2.5.1
19
-
20
- 1. Run your Shopify App CLI command.
21
-
22
- ## Linux
23
-
24
- Ruby 2.5 is available for most recent versions of Ubuntu, including Trusty and Xenial, installable with `apt-get install ruby-2.5`. Look for it in your distributions package manager.
25
-
26
- [brew]:https://brew.sh
27
- [chruby]:https://github.com/postmodern/chruby
28
- [ruby-install]:https://github.com/postmodern/ruby-install
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
- module Extension
3
- module Features
4
- module Argo
5
- class Admin < Base
6
- GIT_TEMPLATE = 'https://github.com/Shopify/argo-admin-template.git'
7
- RENDERER_PACKAGE = '@shopify/argo-admin'
8
- private_constant :GIT_TEMPLATE, :RENDERER_PACKAGE
9
-
10
- def git_template
11
- GIT_TEMPLATE
12
- end
13
-
14
- def renderer_package_name
15
- RENDERER_PACKAGE
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,129 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'base64'
3
- require 'shopify_cli'
4
- require 'semantic/semantic'
5
-
6
- module Extension
7
- module Features
8
- module Argo
9
- class Base
10
- include SmartProperties
11
-
12
- SCRIPT_PATH = %w(build main.js).freeze
13
-
14
- NPM_LIST_COMMAND = %w(list).freeze
15
- YARN_LIST_COMMAND = %w(list --pattern).freeze
16
- NPM_LIST_PARAMETERS = %w(--prod).freeze
17
- YARN_LIST_PARAMETERS = %w(--production).freeze
18
- private_constant :NPM_LIST_COMMAND, :YARN_LIST_COMMAND, :NPM_LIST_PARAMETERS, :YARN_LIST_PARAMETERS
19
-
20
- YARN_INSTALL_COMMAND = %w(install).freeze
21
- YARN_INSTALL_PARAMETERS = %w(--silent).freeze
22
- YARN_RUN_COMMAND = %w(run).freeze
23
- YARN_RUN_SCRIPT_NAME = %w(build).freeze
24
- private_constant :YARN_INSTALL_COMMAND, :YARN_INSTALL_PARAMETERS, :YARN_RUN_COMMAND, :YARN_RUN_SCRIPT_NAME
25
-
26
- def create(directory_name, identifier, context)
27
- Features::ArgoSetup.new(git_template: git_template).call(directory_name, identifier, context)
28
- end
29
-
30
- def config(context)
31
- js_system = ShopifyCli::JsSystem.new(ctx: context)
32
- if js_system.package_manager == 'yarn'
33
- run_yarn_install(context, js_system)
34
- run_yarn_run_script(context, js_system)
35
- end
36
- filepath = File.join(context.root, SCRIPT_PATH)
37
- context.abort(context.message('features.argo.missing_file_error')) unless File.exist?(filepath)
38
- begin
39
- {
40
- renderer_version: extract_argo_renderer_version(context),
41
- serialized_script: Base64.strict_encode64(File.read(filepath).chomp),
42
- }
43
- rescue StandardError
44
- context.abort(context.message('features.argo.script_prepare_error'))
45
- end
46
- end
47
-
48
- def git_template
49
- raise NotImplementedError, "'#{__method__}' must be implemented for #{self.class}"
50
- end
51
-
52
- def renderer_package_name
53
- # The renderer_package_name is used as a regex pattern to
54
- # find a match in the output of yarn or npm list command.
55
- # Use the full package name as it appears in the template without targeting a version.
56
- # Examples: "@shopify/some-renderer-package", "argo-renderer-package"
57
-
58
- raise NotImplementedError, "'#{__method__}' must be implemented for #{self.class}"
59
- end
60
-
61
- private
62
-
63
- def extract_argo_renderer_version(context)
64
- result = run_list_command(context)
65
- found_version = find_version_number(context, result)
66
- context.abort(
67
- context.message('features.argo.dependencies.argo_renderer_package_invalid_version_error')
68
- ) if found_version.nil?
69
- ::Semantic::Version.new(found_version).to_s
70
- rescue ArgumentError
71
- context.abort(
72
- context.message('features.argo.dependencies.argo_renderer_package_invalid_version_error')
73
- )
74
- end
75
-
76
- def find_version_number(context, result)
77
- packages = result.to_json.split('\n')
78
- found_package = packages.find do |package|
79
- package.match(/#{renderer_package_name}@/)
80
- end
81
- if found_package.nil?
82
- error = "'#{renderer_package_name}' not found."
83
- context.abort(
84
- context.message('features.argo.dependencies.argo_missing_renderer_package_error', error)
85
- )
86
- end
87
- found_package.split('@')[2]&.strip
88
- end
89
-
90
- def run_list_command(context)
91
- js_system = ShopifyCli::JsSystem.new(ctx: context)
92
- result, error, status = js_system.call(
93
- yarn: YARN_LIST_COMMAND + [renderer_package_name] + YARN_LIST_PARAMETERS,
94
- npm: NPM_LIST_COMMAND + [renderer_package_name] + NPM_LIST_PARAMETERS,
95
- capture_response: true
96
- )
97
- context.abort(
98
- context.message('features.argo.dependencies.argo_missing_renderer_package_error', error)
99
- ) unless status.success?
100
- result
101
- end
102
-
103
- def run_yarn_install(context, js_system)
104
- _result, error, status = js_system.call(
105
- yarn: YARN_INSTALL_COMMAND + YARN_INSTALL_PARAMETERS,
106
- npm: [],
107
- capture_response: true
108
- )
109
-
110
- context.abort(
111
- context.message('features.argo.dependencies.yarn_install_error', error)
112
- ) unless status.success?
113
- end
114
-
115
- def run_yarn_run_script(context, js_system)
116
- _result, error, status = js_system.call(
117
- yarn: YARN_RUN_COMMAND + YARN_RUN_SCRIPT_NAME,
118
- npm: [],
119
- capture_response: true
120
- )
121
-
122
- context.abort(
123
- context.message('features.argo.dependencies.yarn_run_script_error', error)
124
- ) unless status.success?
125
- end
126
- end
127
- end
128
- end
129
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
- module Extension
3
- module Features
4
- module Argo
5
- class Checkout < Base
6
- GIT_TEMPLATE = 'https://github.com/Shopify/argo-checkout-template.git'
7
- RENDERER_PACKAGE = '@shopify/argo-checkout'
8
- private_constant :GIT_TEMPLATE, :RENDERER_PACKAGE
9
-
10
- def git_template
11
- GIT_TEMPLATE
12
- end
13
-
14
- def renderer_package_name
15
- RENDERER_PACKAGE
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,81 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Extension
4
- module Models
5
- class Type
6
- TYPES_PATH = %w(lib project_types extension models types *.rb)
7
-
8
- class << self
9
- def load_all
10
- return unless @all_extension_types.nil? || @all_extension_types.empty?
11
- Dir.glob(File.join(ShopifyCli::ROOT, TYPES_PATH)).map { |file_path| load(file_path) }
12
- end
13
-
14
- def inherited(klass)
15
- super
16
- @all_extension_types ||= []
17
- @all_extension_types << klass
18
- end
19
-
20
- def valid?(identifier)
21
- repository.key?(identifier)
22
- end
23
-
24
- def repository
25
- load_all if @all_extension_types.empty?
26
-
27
- @repository ||= @all_extension_types.map(&:new).each_with_object({}) do |type, hash|
28
- hash[type.identifier] = type
29
- end
30
- end
31
-
32
- def load_type(identifier)
33
- repository[identifier]
34
- end
35
- end
36
-
37
- def identifier
38
- self.class::IDENTIFIER
39
- end
40
-
41
- def graphql_identifier
42
- identifier
43
- end
44
-
45
- def name
46
- message('name')
47
- end
48
-
49
- def tagline
50
- message('tagline') || ""
51
- end
52
-
53
- def config(_context)
54
- raise NotImplementedError, "'#{__method__}' must be implemented for #{self.class}"
55
- end
56
-
57
- def create(_directory_name, _context)
58
- raise NotImplementedError, "'#{__method__}' must be implemented for #{self.class}"
59
- end
60
-
61
- def extension_context(_context)
62
- nil
63
- end
64
-
65
- def valid_extension_contexts
66
- []
67
- end
68
-
69
- private
70
-
71
- def message(key, *params)
72
- return unless messages.key?(key.to_sym)
73
- messages[key.to_sym] % params
74
- end
75
-
76
- def messages
77
- @messages ||= Messages::TYPES[identifier.downcase.to_sym] || {}
78
- end
79
- end
80
- end
81
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'base64'
3
-
4
- module Extension
5
- module Models
6
- module Types
7
- class CheckoutPostPurchase < Models::Type
8
- IDENTIFIER = 'CHECKOUT_POST_PURCHASE'
9
- PERMITTED_CONFIG_KEYS = [:metafields]
10
- def create(directory_name, context)
11
- Features::Argo::Checkout.new.create(directory_name, IDENTIFIER, context)
12
- end
13
-
14
- def config(context)
15
- {
16
- **Features::ArgoConfig.parse_yaml(context, PERMITTED_CONFIG_KEYS),
17
- **Features::Argo::Checkout.new.config(context),
18
- }
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'base64'
3
-
4
- module Extension
5
- module Models
6
- module Types
7
- class ProductSubscription < Models::Type
8
- IDENTIFIER = 'PRODUCT_SUBSCRIPTION'
9
-
10
- def graphql_identifier
11
- 'SUBSCRIPTION_MANAGEMENT'
12
- end
13
-
14
- def create(directory_name, context)
15
- Features::Argo::Admin.new.create(directory_name, graphql_identifier, context)
16
- end
17
-
18
- def config(context)
19
- Features::Argo::Admin.new.config(context)
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,39 +0,0 @@
1
- require 'shopify_cli'
2
-
3
- module Node
4
- module Commands
5
- class Generate
6
- class Billing < ShopifyCli::SubCommand
7
- BILLING_TYPES = {
8
- 'recurring-billing' => ['./node_modules/.bin/generate-node-app', 'recurring-billing'],
9
- 'one-time-billing' => ['./node_modules/.bin/generate-node-app', 'one-time-billing'],
10
- }
11
- def call(args, _name)
12
- selected_type = BILLING_TYPES[args[1]]
13
- unless selected_type
14
- selected_type = CLI::UI::Prompt.ask(@ctx.message('node.generate.billing.type_select')) do |handler|
15
- BILLING_TYPES.each do |key, value|
16
- handler.option(key) { value }
17
- end
18
- end
19
- end
20
- billing_type_name = BILLING_TYPES.key(selected_type)
21
- selected_type[0] = File.join(ShopifyCli::Project.current.directory, selected_type[0])
22
- selected_type[0] = "\"#{selected_type[0]}\""
23
- selected_type = selected_type.join(' ')
24
-
25
- spin_group = CLI::UI::SpinGroup.new
26
- spin_group.add(@ctx.message('node.generate.billing.generating', billing_type_name)) do |spinner|
27
- Node::Commands::Generate.run_generate(selected_type, billing_type_name, @ctx)
28
- spinner.update_title(@ctx.message('node.generate.billing.generated', billing_type_name))
29
- end
30
- spin_group.wait
31
- end
32
-
33
- def self.help
34
- ShopifyCli::Context.message('node.generate.billing.help', ShopifyCli::TOOL_NAME)
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,59 +0,0 @@
1
- require 'shopify_cli'
2
-
3
- module Node
4
- module Commands
5
- class Generate
6
- class Page < ShopifyCli::SubCommand
7
- PAGE_TYPES = {
8
- 'empty-state' => ['./node_modules/.bin/generate-node-app', 'empty-state-page'],
9
- 'two-column' => ['./node_modules/.bin/generate-node-app', 'two-column-page'],
10
- 'annotated' => ['./node_modules/.bin/generate-node-app', 'settings-page'],
11
- 'list' => ['./node_modules/.bin/generate-node-app', 'list-page'],
12
- }
13
-
14
- options do |parser, flags|
15
- parser.on('--type=TYPE') do |t|
16
- flags[:type] = t.downcase
17
- end
18
- end
19
-
20
- def call(args, _name)
21
- name = args.first
22
- flag = options.flags[:type]
23
- unless name
24
- @ctx.puts(self.class.help)
25
- return
26
- end
27
-
28
- selected_type = if flag
29
- unless PAGE_TYPES.key?(flag)
30
- @ctx.abort(@ctx.message('node.generate.page.error.invalid_page_type'))
31
- end
32
- PAGE_TYPES[flag]
33
- else
34
- CLI::UI::Prompt.ask(@ctx.message('node.generate.page.type_select')) do |handler|
35
- PAGE_TYPES.each do |key, value|
36
- handler.option(key) { value }
37
- end
38
- end
39
- end
40
- page_type_name = PAGE_TYPES.key(selected_type)
41
- selected_type[0] = File.join(ShopifyCli::Project.current.directory, selected_type[0])
42
- selected_type[0] = "\"#{selected_type[0]}\""
43
- selected_type = selected_type.join(' ')
44
-
45
- spin_group = CLI::UI::SpinGroup.new
46
- spin_group.add(@ctx.message('node.generate.page.generating', page_type_name)) do |spinner|
47
- Node::Commands::Generate.run_generate("#{selected_type} #{name}", name, @ctx)
48
- spinner.update_title(@ctx.message('node.generate.page.generated', name, name))
49
- end
50
- spin_group.wait
51
- end
52
-
53
- def self.help
54
- ShopifyCli::Context.message('node.generate.page.help', ShopifyCli::TOOL_NAME)
55
- end
56
- end
57
- end
58
- end
59
- end
@@ -1,37 +0,0 @@
1
- require 'shopify_cli'
2
- require 'json'
3
- module Node
4
- module Commands
5
- class Generate
6
- class Webhook < ShopifyCli::SubCommand
7
- def call(args, _name)
8
- selected_type = args.first
9
- schema = ShopifyCli::AdminAPI::Schema.get(@ctx)
10
- webhooks = schema.get_names_from_type('WebhookSubscriptionTopic')
11
- unless selected_type && webhooks.include?(selected_type)
12
- selected_type = CLI::UI::Prompt.ask(@ctx.message('node.generate.webhook.type_select')) do |handler|
13
- webhooks.each do |type|
14
- handler.option(type) { type }
15
- end
16
- end
17
- end
18
-
19
- generate_path = File.join(ShopifyCli::Project.current.directory, "node_modules/.bin/generate-node-app")
20
- generate_path = "\"#{generate_path}\""
21
-
22
- spin_group = CLI::UI::SpinGroup.new
23
- spin_group.add(@ctx.message('node.generate.webhook.generating', selected_type)) do |spinner|
24
- Node::Commands::Generate.run_generate("#{generate_path} webhook #{selected_type}",
25
- selected_type, @ctx)
26
- spinner.update_title(@ctx.message('node.generate.webhook.generated', selected_type))
27
- end
28
- spin_group.wait
29
- end
30
-
31
- def self.help
32
- ShopifyCli::Context.message('node.generate.webhook.help', ShopifyCli::TOOL_NAME)
33
- end
34
- end
35
- end
36
- end
37
- end