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.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +9 -0
- data/README.md +39 -7
- data/Rakefile +2 -0
- data/dev.yml +2 -2
- data/docs/_config.yml +1 -18
- data/docs/app/node/commands/index.md +2 -80
- data/docs/app/node/index.md +2 -33
- data/docs/app/rails/commands/index.md +2 -78
- data/docs/app/rails/index.md +2 -34
- data/docs/core/index.md +2 -84
- data/docs/getting-started/index.md +2 -25
- data/docs/getting-started/install/index.md +1 -118
- data/docs/getting-started/migrate/index.md +2 -94
- data/docs/getting-started/uninstall/index.md +2 -35
- data/docs/getting-started/upgrade/index.md +2 -39
- data/docs/help/start-app/index.md +2 -4
- data/docs/index.md +2 -24
- data/install.sh +1 -1
- data/lib/project_types/extension/cli.rb +19 -10
- data/lib/project_types/extension/commands/extension_command.rb +2 -2
- data/lib/project_types/extension/features/argo.rb +117 -0
- data/lib/project_types/extension/forms/create.rb +2 -2
- data/lib/project_types/extension/models/specification.rb +35 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
- data/lib/project_types/extension/models/specifications.rb +77 -0
- data/lib/project_types/extension/tasks/configure_features.rb +52 -0
- data/lib/project_types/extension/tasks/fetch_specifications.rb +38 -0
- data/lib/project_types/node/commands/create.rb +3 -1
- data/lib/project_types/node/commands/generate.rb +2 -11
- data/lib/project_types/node/messages/messages.rb +9 -44
- data/lib/project_types/rails/commands/create.rb +8 -9
- data/lib/project_types/rails/forms/create.rb +1 -1
- data/lib/project_types/rails/gem.rb +1 -1
- data/lib/project_types/rails/messages/messages.rb +1 -1
- data/lib/project_types/script/cli.rb +7 -4
- data/lib/project_types/script/commands/create.rb +6 -4
- data/lib/project_types/script/commands/push.rb +5 -13
- data/lib/project_types/script/config/extension_points.yml +9 -5
- data/lib/project_types/script/errors.rb +17 -0
- data/lib/project_types/script/forms/create.rb +26 -2
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +10 -1
- data/lib/project_types/script/layers/application/build_script.rb +9 -4
- data/lib/project_types/script/layers/application/create_script.rb +12 -10
- data/lib/project_types/script/layers/application/extension_points.rb +24 -0
- data/lib/project_types/script/layers/application/push_script.rb +18 -16
- data/lib/project_types/script/layers/domain/errors.rb +4 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +62 -6
- data/lib/project_types/script/layers/domain/metadata.rb +55 -0
- data/lib/project_types/script/layers/domain/push_package.rb +25 -6
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +6 -6
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +16 -6
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +10 -4
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +25 -13
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -1
- data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
- data/lib/project_types/script/messages/messages.rb +39 -8
- data/lib/project_types/script/script_project.rb +25 -16
- data/lib/project_types/script/ui/error_handler.rb +34 -1
- data/lib/project_types/theme/cli.rb +40 -0
- data/lib/project_types/theme/commands/connect.rb +54 -0
- data/lib/project_types/theme/commands/create.rb +48 -0
- data/lib/project_types/theme/commands/deploy.rb +38 -0
- data/lib/project_types/theme/commands/generate.rb +20 -0
- data/lib/project_types/theme/commands/generate/env.rb +79 -0
- data/lib/project_types/theme/commands/push.rb +55 -0
- data/lib/project_types/theme/commands/serve.rb +31 -0
- data/lib/project_types/theme/forms/connect.rb +34 -0
- data/lib/project_types/theme/forms/create.rb +22 -0
- data/lib/project_types/theme/messages/messages.rb +147 -0
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
- data/lib/project_types/theme/themekit.rb +113 -0
- data/lib/shopify-cli/admin_api.rb +42 -2
- data/lib/shopify-cli/api.rb +27 -24
- data/lib/shopify-cli/commands/system.rb +1 -1
- data/lib/shopify-cli/context.rb +23 -2
- data/lib/shopify-cli/feature.rb +0 -2
- data/lib/shopify-cli/http_request.rb +20 -8
- data/lib/shopify-cli/messages/messages.rb +6 -3
- data/lib/shopify-cli/method_object.rb +104 -0
- data/lib/shopify-cli/partners_api.rb +8 -2
- data/lib/shopify-cli/project_type.rb +1 -1
- data/lib/shopify-cli/resolve_constant.rb +25 -0
- data/lib/shopify-cli/result.rb +432 -0
- data/lib/shopify-cli/shopifolk.rb +3 -2
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +6 -5
- data/lib/shopify-cli/tunnel.rb +7 -1
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +4 -1
- data/shopify.fish +1 -1
- data/shopify.sh +1 -1
- data/vendor/deps/cli-kit/REVISION +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
- data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
- data/vendor/deps/webrick/.gitignore +9 -0
- data/vendor/deps/webrick/Gemfile +3 -0
- data/vendor/deps/webrick/LICENSE.txt +22 -0
- data/vendor/deps/webrick/README.md +61 -0
- data/vendor/deps/webrick/Rakefile +10 -0
- data/vendor/deps/webrick/lib/webrick.rb +232 -0
- data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
- data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
- data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
- data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
- data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
- data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
- data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
- data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
- data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
- data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
- data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
- data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
- data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
- data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
- data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
- data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
- data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
- data/vendor/deps/webrick/webrick.gemspec +74 -0
- metadata +70 -26
- data/docs/Gemfile +0 -5
- data/docs/Gemfile.lock +0 -258
- data/docs/_data/nav.yml +0 -35
- data/docs/_includes/footer.html +0 -15
- data/docs/_includes/head.html +0 -19
- data/docs/_includes/sidebar_nav.html +0 -22
- data/docs/_includes/toc.html +0 -112
- data/docs/_layouts/default.html +0 -79
- data/docs/css/docs.css +0 -157
- data/docs/images/header.png +0 -0
- data/docs/installing-ruby.md +0 -28
- data/lib/project_types/extension/features/argo/admin.rb +0 -20
- data/lib/project_types/extension/features/argo/base.rb +0 -129
- data/lib/project_types/extension/features/argo/checkout.rb +0 -20
- data/lib/project_types/extension/models/type.rb +0 -81
- data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
- data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
- data/lib/project_types/node/commands/generate/billing.rb +0 -39
- data/lib/project_types/node/commands/generate/page.rb +0 -59
- data/lib/project_types/node/commands/generate/webhook.rb +0 -37
- data/lib/project_types/script/layers/domain/script.rb +0 -18
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -47
- data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
- data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
data/docs/images/header.png
DELETED
Binary file
|
data/docs/installing-ruby.md
DELETED
@@ -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, 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
|