shopify-cli 2.6.3 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer.json +5 -0
- data/.github/DESIGN.md +1 -1
- data/.github/ISSUE_TEMPLATE.md +7 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +15 -4
- data/.github/workflows/shopify.yml +3 -6
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +9 -0
- data/CHANGELOG.md +98 -104
- data/CONTRIBUTING.md +1 -21
- data/Codespace.dockerfile +35 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +9 -5
- data/README.md +20 -99
- data/RELEASING.md +17 -30
- data/Rakefile +0 -5
- data/Tests.dockerfile +35 -0
- data/assets/logo.png +0 -0
- data/dev.yml +0 -3
- data/docs/README.md +13 -0
- data/docs/contributors/testing.md +27 -0
- data/docs/users/installation.md +46 -0
- data/{THEMEKIT_MIGRATION.md → docs/users/migrate-from-themekit.md} +1 -1
- data/lib/project_types/extension/cli.rb +7 -3
- data/lib/project_types/extension/commands/create.rb +6 -6
- data/lib/project_types/extension/commands/extension_command.rb +1 -1
- data/lib/project_types/extension/features/argo.rb +9 -10
- data/lib/project_types/extension/features/argo_serve.rb +9 -23
- data/lib/project_types/extension/forms/create.rb +1 -1
- data/lib/project_types/extension/forms/questions/ask_template.rb +3 -6
- data/lib/project_types/extension/messages/messages.rb +1 -0
- data/lib/project_types/extension/models/development_server_requirements.rb +2 -3
- data/lib/project_types/extension/models/server_config/app.rb +13 -0
- data/lib/project_types/extension/models/server_config/development.rb +5 -4
- data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
- data/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
- data/lib/project_types/extension/models/server_config/extension.rb +4 -0
- data/lib/project_types/extension/models/server_config/root.rb +4 -1
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
- data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +1 -1
- data/lib/project_types/extension/tasks/convert_server_config.rb +65 -0
- data/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
- data/lib/project_types/extension/tasks/find_package_from_json.rb +37 -0
- data/lib/project_types/extension/tasks/merge_server_config.rb +32 -0
- data/lib/project_types/extension/tasks/run_extension_command.rb +10 -9
- data/lib/project_types/node/cli.rb +0 -16
- data/lib/project_types/node/forms/create.rb +5 -5
- data/lib/project_types/node/messages/messages.rb +2 -149
- data/lib/project_types/php/cli.rb +0 -11
- data/lib/project_types/php/forms/create.rb +5 -6
- data/lib/project_types/php/messages/messages.rb +2 -164
- data/lib/project_types/rails/cli.rb +0 -16
- data/lib/project_types/rails/commands/create.rb +46 -17
- data/lib/project_types/rails/forms/create.rb +5 -7
- data/lib/project_types/rails/messages/messages.rb +6 -154
- data/lib/project_types/script/cli.rb +1 -1
- data/lib/project_types/script/commands/create.rb +5 -6
- data/lib/project_types/script/commands/push.rb +1 -1
- data/lib/project_types/script/config/extension_points.yml +10 -0
- data/lib/project_types/script/errors.rb +0 -18
- data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
- data/lib/project_types/script/layers/application/build_script.rb +2 -1
- data/lib/project_types/script/layers/application/create_script.rb +2 -2
- data/lib/project_types/script/layers/application/push_script.rb +15 -1
- data/lib/project_types/script/layers/domain/push_package.rb +5 -2
- data/lib/project_types/script/layers/domain/script_json.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb +0 -4
- data/lib/project_types/script/layers/infrastructure/errors.rb +17 -2
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +29 -13
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +29 -13
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +4 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +3 -4
- data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -2
- data/lib/project_types/script/messages/messages.rb +9 -22
- data/lib/project_types/script/ui/error_handler.rb +16 -26
- data/lib/project_types/theme/cli.rb +1 -1
- data/lib/project_types/theme/commands/check.rb +1 -1
- data/lib/project_types/theme/commands/delete.rb +1 -1
- data/lib/project_types/theme/commands/init.rb +1 -1
- data/lib/project_types/theme/commands/language_server.rb +1 -1
- data/lib/project_types/theme/commands/package.rb +1 -1
- data/lib/project_types/theme/commands/publish.rb +1 -1
- data/lib/project_types/theme/commands/pull.rb +1 -1
- data/lib/project_types/theme/commands/push.rb +1 -1
- data/lib/project_types/theme/commands/serve.rb +10 -2
- data/lib/project_types/theme/messages/messages.rb +10 -0
- data/lib/shopify_cli/admin_api/populate_resource_command.rb +1 -1
- data/lib/shopify_cli/api.rb +7 -2
- data/lib/shopify_cli/app_type_detector.rb +36 -0
- data/lib/shopify_cli/command/app_sub_command.rb +10 -0
- data/lib/shopify_cli/command/project_command.rb +18 -0
- data/lib/shopify_cli/command/sub_command.rb +19 -0
- data/lib/shopify_cli/command.rb +13 -3
- data/lib/shopify_cli/command_options/command_serve_options.rb +43 -0
- data/lib/shopify_cli/command_options.rb +7 -0
- data/lib/shopify_cli/commands/app/connect.rb +22 -0
- data/lib/shopify_cli/commands/app/create/node.rb +38 -0
- data/lib/shopify_cli/commands/app/create/php.rb +36 -0
- data/lib/shopify_cli/commands/app/create/rails.rb +40 -0
- data/lib/shopify_cli/commands/app/create.rb +28 -0
- data/lib/shopify_cli/commands/app/deploy.rb +49 -0
- data/lib/shopify_cli/commands/app/open.rb +19 -0
- data/lib/shopify_cli/commands/app/serve.rb +49 -0
- data/lib/shopify_cli/commands/app/tunnel.rb +43 -0
- data/lib/shopify_cli/commands/app.rb +29 -0
- data/lib/shopify_cli/commands/config.rb +2 -2
- data/lib/shopify_cli/commands/login.rb +3 -3
- data/lib/shopify_cli/commands/reporting.rb +38 -0
- data/lib/shopify_cli/commands/switch.rb +1 -1
- data/lib/shopify_cli/commands.rb +2 -0
- data/lib/shopify_cli/constants.rb +11 -3
- data/lib/shopify_cli/core/monorail.rb +9 -20
- data/lib/shopify_cli/environment.rb +15 -1
- data/lib/shopify_cli/exception_reporter.rb +29 -16
- data/lib/shopify_cli/git.rb +12 -1
- data/lib/shopify_cli/github/issue_url_generator.rb +19 -0
- data/lib/shopify_cli/github.rb +5 -0
- data/lib/shopify_cli/messages/messages.rb +295 -22
- data/lib/shopify_cli/migrator/migration.rb +1 -1
- data/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +1 -1
- data/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +41 -0
- data/lib/shopify_cli/migrator.rb +9 -11
- data/lib/shopify_cli/project.rb +5 -1
- data/lib/shopify_cli/project_commands.rb +1 -1
- data/lib/shopify_cli/reporting_configuration_controller.rb +64 -0
- data/lib/shopify_cli/services/app/connect_service.rb +25 -0
- data/lib/shopify_cli/services/app/create/node_service.rb +153 -0
- data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
- data/lib/shopify_cli/services/app/create/rails_service.rb +213 -0
- data/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
- data/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
- data/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
- data/lib/shopify_cli/services/app/open_service.rb +19 -0
- data/lib/shopify_cli/services/app/serve/node_service.rb +42 -0
- data/lib/shopify_cli/services/app/serve/php_service.rb +46 -0
- data/lib/shopify_cli/services/app/serve/rails_service.rb +48 -0
- data/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
- data/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
- data/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
- data/lib/shopify_cli/services/base_service.rb +13 -0
- data/lib/shopify_cli/services/reporting_service.rb +16 -0
- data/lib/shopify_cli/services.rb +37 -0
- data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -2
- data/lib/shopify_cli/theme/dev_server.rb +9 -2
- data/lib/shopify_cli/version.rb +1 -1
- data/lib/shopify_cli.rb +5 -2
- data/shopify-cli.gemspec +2 -13
- data/shopify-dev +18 -0
- data/utilities/constants.rb +7 -0
- data/utilities/docker/container.rb +104 -0
- data/utilities/docker.rb +45 -3
- data/utilities/utilities.rb +1 -0
- metadata +63 -54
- data/Dockerfile +0 -17
- data/docs/_config.yml +0 -2
- data/docs/app/node/commands/index.md +0 -4
- data/docs/app/node/index.md +0 -4
- data/docs/app/rails/commands/index.md +0 -4
- data/docs/app/rails/index.md +0 -4
- data/docs/core/index.md +0 -4
- data/docs/getting-started/index.md +0 -4
- data/docs/getting-started/install/index.md +0 -4
- data/docs/getting-started/migrate/index.md +0 -4
- data/docs/getting-started/uninstall/index.md +0 -4
- data/docs/getting-started/upgrade/index.md +0 -4
- data/docs/help/start-app/index.md +0 -4
- data/docs/index.md +0 -4
- data/ext/shopify-cli/extconf.rb +0 -60
- data/install.sh +0 -7
- data/lib/project_types/extension/tasks/converters/server_config_converter.rb +0 -31
- data/lib/project_types/extension/tasks/load_server_config.rb +0 -23
- data/lib/project_types/node/commands/connect.rb +0 -21
- data/lib/project_types/node/commands/create.rb +0 -125
- data/lib/project_types/node/commands/deploy/heroku.rb +0 -96
- data/lib/project_types/node/commands/deploy.rb +0 -32
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/node/commands/open.rb +0 -18
- data/lib/project_types/node/commands/serve.rb +0 -54
- data/lib/project_types/node/commands/tunnel.rb +0 -41
- data/lib/project_types/php/commands/connect.rb +0 -19
- data/lib/project_types/php/commands/create.rb +0 -143
- data/lib/project_types/php/commands/deploy/heroku.rb +0 -129
- data/lib/project_types/php/commands/deploy.rb +0 -32
- data/lib/project_types/php/commands/open.rb +0 -16
- data/lib/project_types/php/commands/serve.rb +0 -51
- data/lib/project_types/php/commands/tunnel.rb +0 -37
- data/lib/project_types/rails/commands/connect.rb +0 -21
- data/lib/project_types/rails/commands/deploy/heroku.rb +0 -115
- data/lib/project_types/rails/commands/deploy.rb +0 -32
- data/lib/project_types/rails/commands/generate/webhook.rb +0 -42
- data/lib/project_types/rails/commands/generate.rb +0 -60
- data/lib/project_types/rails/commands/open.rb +0 -18
- data/lib/project_types/rails/commands/serve.rb +0 -52
- data/lib/project_types/rails/commands/tunnel.rb +0 -41
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +0 -0
- data/lib/shopify_cli/exception_reporter/permission_controller.rb +0 -54
- data/lib/shopify_cli/sub_command.rb +0 -17
- data/shopify.fish +0 -12
- data/shopify.sh +0 -11
@@ -88,10 +88,20 @@ module Theme
|
|
88
88
|
serve: {
|
89
89
|
help: <<~HELP,
|
90
90
|
Uploads the current theme as a development theme to the connected store, then prints theme editor and preview URLs to your terminal. While running, changes will push to the store in real time.
|
91
|
+
|
91
92
|
Usage: {{command:%s theme serve}}
|
93
|
+
|
94
|
+
Options:
|
95
|
+
{{command:--port=PORT}} Local port to serve theme preview from
|
96
|
+
{{command:--poll}} Force polling to detect file changes
|
97
|
+
{{command:--host=HOST}} Set which network interface the web server listens on. The default value is 127.0.0.1.
|
92
98
|
HELP
|
93
99
|
serve: "Viewing theme…",
|
94
100
|
open_fail: "Couldn't open the theme",
|
101
|
+
error: {
|
102
|
+
address_binding_error: "Couldn't bind to localhost."\
|
103
|
+
" To serve your theme, set a different address with {{command:%s theme serve --host=<address>}}",
|
104
|
+
},
|
95
105
|
},
|
96
106
|
check: {
|
97
107
|
help: <<~HELP,
|
data/lib/shopify_cli/api.rb
CHANGED
@@ -108,9 +108,14 @@ module ShopifyCLI
|
|
108
108
|
private
|
109
109
|
|
110
110
|
def default_headers
|
111
|
+
sha = ShopifyCLI.sha
|
112
|
+
user_agent = "Shopify CLI; v=#{ShopifyCLI::VERSION}"
|
113
|
+
sec_ch_ua = user_agent
|
114
|
+
sec_ch_ua += " sha=#{sha}" unless sha.nil?
|
115
|
+
|
111
116
|
{
|
112
|
-
"User-Agent" =>
|
113
|
-
"Sec-CH-UA" =>
|
117
|
+
"User-Agent" => user_agent,
|
118
|
+
"Sec-CH-UA" => sec_ch_ua,
|
114
119
|
"Sec-CH-UA-PLATFORM" => ctx.os.to_s,
|
115
120
|
"X-Request-Id" => SecureRandom.uuid,
|
116
121
|
}.tap do |headers|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module ShopifyCLI
|
4
|
+
class AppTypeDetector
|
5
|
+
Error = Class.new(StandardError)
|
6
|
+
MissingShopifyCLIYamlError = Class.new(Error)
|
7
|
+
TypeNotFoundError = Class.new(Error)
|
8
|
+
class InvalidTypeError < Error
|
9
|
+
attr_reader :project_type
|
10
|
+
def initialize(message, project_type:)
|
11
|
+
@project_type = project_type
|
12
|
+
super(message)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.detect(project_directory:)
|
17
|
+
require "yaml" # takes 20ms, so deferred as late as possible.
|
18
|
+
|
19
|
+
shopify_cli_yml_path = File.join(project_directory, Constants::Files::SHOPIFY_CLI_YML)
|
20
|
+
unless File.exist?(shopify_cli_yml_path)
|
21
|
+
raise MissingShopifyCLIYamlError,
|
22
|
+
"#{Constants::Files::SHOPIFY_CLI_YML} was not found in directory #{project_directory}"
|
23
|
+
end
|
24
|
+
shopify_cli = YAML.load_file(shopify_cli_yml_path)
|
25
|
+
case shopify_cli["project_type"]&.to_sym
|
26
|
+
when :node, :rails, :php
|
27
|
+
shopify_cli["project_type"].to_sym
|
28
|
+
when nil
|
29
|
+
raise TypeNotFoundError, "Couldn't detect the project type in directory: #{project_directory}"
|
30
|
+
else
|
31
|
+
raise InvalidTypeError.new("The project found '' is not supported",
|
32
|
+
project_type: shopify_cli["project_type"])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,6 +1,16 @@
|
|
1
1
|
module ShopifyCLI
|
2
2
|
class Command
|
3
3
|
class AppSubCommand < SubCommand
|
4
|
+
def detect_app(directory: Dir.pwd)
|
5
|
+
AppTypeDetector.detect(project_directory: directory)
|
6
|
+
rescue ShopifyCLI::AppTypeDetector::TypeNotFoundError
|
7
|
+
raise ShopifyCLI::Abort, @ctx.message("core.app.error.type_not_found", directory)
|
8
|
+
rescue ShopifyCLI::AppTypeDetector::MissingShopifyCLIYamlError
|
9
|
+
raise ShopifyCLI::Abort, @ctx.message("core.app.error.missing_shopify_cli_yml", directory)
|
10
|
+
rescue ShopifyCLI::AppTypeDetector::InvalidTypeError => error
|
11
|
+
raise ShopifyCLI::Abort, @ctx.message("core.app.error.invalid_project_type", error.project_type)
|
12
|
+
end
|
13
|
+
|
4
14
|
class << self
|
5
15
|
def call_help(*)
|
6
16
|
output = help
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
class Command
|
3
|
+
class ProjectCommand < Command
|
4
|
+
def call(*)
|
5
|
+
@ctx.puts(self.class.help)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.help
|
9
|
+
project_type = name.split("::")[0].downcase
|
10
|
+
ShopifyCLI::Context.message(
|
11
|
+
"#{project_type}.help",
|
12
|
+
ShopifyCLI::TOOL_NAME,
|
13
|
+
subcommand_registry.command_names.join(" | ")
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "shopify_cli"
|
3
|
+
|
4
|
+
module ShopifyCLI
|
5
|
+
class Command
|
6
|
+
class SubCommand < Command
|
7
|
+
class << self
|
8
|
+
def call(args, command_name, parent_command)
|
9
|
+
cmd = new(@ctx)
|
10
|
+
args = cmd.options.parse(@_options, args || [])
|
11
|
+
return call_help(parent_command, command_name) if cmd.options.help
|
12
|
+
run_prerequisites
|
13
|
+
|
14
|
+
cmd.call(args, command_name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/shopify_cli/command.rb
CHANGED
@@ -3,6 +3,10 @@ require "shopify_cli"
|
|
3
3
|
|
4
4
|
module ShopifyCLI
|
5
5
|
class Command < CLI::Kit::BaseCommand
|
6
|
+
autoload :SubCommand, "shopify_cli/command/sub_command"
|
7
|
+
autoload :AppSubCommand, "shopify_cli/command/app_sub_command"
|
8
|
+
autoload :ProjectCommand, "shopify_cli/command/project_command"
|
9
|
+
|
6
10
|
extend Feature::Set
|
7
11
|
|
8
12
|
attr_writer :ctx
|
@@ -11,12 +15,13 @@ module ShopifyCLI
|
|
11
15
|
class << self
|
12
16
|
attr_writer :ctx, :task_registry
|
13
17
|
|
14
|
-
def call(args, command_name)
|
18
|
+
def call(args, command_name, *)
|
15
19
|
subcommand, resolved_name = subcommand_registry.lookup_command(args.first)
|
16
20
|
if subcommand
|
17
21
|
subcommand.ctx = @ctx
|
18
22
|
subcommand.task_registry = @task_registry
|
19
|
-
|
23
|
+
|
24
|
+
subcommand.call(args.drop(1), resolved_name, command_name)
|
20
25
|
else
|
21
26
|
cmd = new(@ctx)
|
22
27
|
cmd.options.parse(@_options, args)
|
@@ -27,7 +32,12 @@ module ShopifyCLI
|
|
27
32
|
end
|
28
33
|
|
29
34
|
def options(&block)
|
30
|
-
|
35
|
+
existing_options = @_options
|
36
|
+
# We prevent new options calls to override existing blocks by nesting them.
|
37
|
+
@_options = ->(parser, flags) {
|
38
|
+
existing_options&.call(parser, flags)
|
39
|
+
block.call(parser, flags)
|
40
|
+
}
|
31
41
|
end
|
32
42
|
|
33
43
|
def subcommand(const, cmd, path = nil)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "shopify_cli"
|
2
|
+
|
3
|
+
module ShopifyCLI
|
4
|
+
module CommandOptions
|
5
|
+
module CommandServeOptions
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
base.class_eval do
|
9
|
+
def port
|
10
|
+
return ShopifyCLI::Tunnel::PORT.to_s unless options.flags.key?(:port)
|
11
|
+
port = options.flags[:port].to_i
|
12
|
+
@ctx.abort(@ctx.message("core.app.serve.error.invalid_port", options.flags[:port])) unless port > 0
|
13
|
+
port
|
14
|
+
end
|
15
|
+
|
16
|
+
def host
|
17
|
+
host = options.flags[:host]
|
18
|
+
unless host.nil?
|
19
|
+
@ctx.abort(@ctx.message("core.app.serve.error.host_must_be_https")) if host.match(/^https/i).nil?
|
20
|
+
end
|
21
|
+
host
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module ClassMethods
|
27
|
+
def parse_host_option
|
28
|
+
options do |parser, flags|
|
29
|
+
parser.on("--host=HOST") do |h|
|
30
|
+
flags[:host] = h.gsub('"', "")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def parse_port_option
|
36
|
+
options do |parser, flags|
|
37
|
+
parser.on("--port=PORT") { |port| flags[:port] = port }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Commands
|
3
|
+
class App
|
4
|
+
class Connect < ShopifyCLI::Command::AppSubCommand
|
5
|
+
def call(_args, _command_name, *)
|
6
|
+
app_type = detect_app(directory: Dir.pwd)
|
7
|
+
project = ShopifyCLI::Project.current
|
8
|
+
|
9
|
+
Services::App::ConnectService.call(
|
10
|
+
app_type: app_type,
|
11
|
+
project: project,
|
12
|
+
context: @ctx
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.help
|
17
|
+
ShopifyCLI::Context.message("core.app.connect.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Commands
|
3
|
+
class App
|
4
|
+
class Create
|
5
|
+
class Node < ShopifyCLI::Command::AppSubCommand
|
6
|
+
unless ShopifyCLI::Environment.acceptance_test?
|
7
|
+
prerequisite_task :ensure_authenticated
|
8
|
+
end
|
9
|
+
|
10
|
+
options do |parser, flags|
|
11
|
+
parser.on("--name=NAME") { |t| flags[:name] = t }
|
12
|
+
parser.on("--organization-id=ID") { |id| flags[:organization_id] = id }
|
13
|
+
parser.on("--store-domain=MYSHOPIFYDOMAIN") { |url| flags[:store_domain] = url }
|
14
|
+
parser.on("--type=APPTYPE") { |type| flags[:type] = type }
|
15
|
+
parser.on("--verbose") { flags[:verbose] = true }
|
16
|
+
end
|
17
|
+
|
18
|
+
def call(*)
|
19
|
+
Services::App::Create::NodeService.call(
|
20
|
+
name: options.flags[:name],
|
21
|
+
organization_id: options.flags[:organization_id],
|
22
|
+
store_domain: options.flags[:store_domain],
|
23
|
+
type: options.flags[:type],
|
24
|
+
verbose: !options.flags[:verbose].nil?,
|
25
|
+
context: @ctx
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
class << self
|
30
|
+
def help
|
31
|
+
ShopifyCLI::Context.message("core.app.create.node.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Commands
|
3
|
+
class App
|
4
|
+
class Create
|
5
|
+
class PHP < ShopifyCLI::Command::AppSubCommand
|
6
|
+
prerequisite_task :ensure_authenticated
|
7
|
+
|
8
|
+
options do |parser, flags|
|
9
|
+
parser.on("--name=NAME") { |name| flags[:name] = name }
|
10
|
+
parser.on("--organization-id=ID") { |organization_id| flags[:organization_id] = organization_id }
|
11
|
+
parser.on("--store-domain=MYSHOPIFYDOMAIN") { |url| flags[:store_domain] = url }
|
12
|
+
parser.on("--type=APPTYPE") { |type| flags[:type] = type }
|
13
|
+
parser.on("--verbose") { flags[:verbose] = true }
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(*)
|
17
|
+
Services::App::Create::PHPService.call(
|
18
|
+
name: options.flags[:name],
|
19
|
+
organization_id: options.flags[:organization_id],
|
20
|
+
store_domain: options.flags[:store_domain],
|
21
|
+
type: options.flags[:type],
|
22
|
+
verbose: !options.flags[:verbose].nil?,
|
23
|
+
context: @ctx
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def help
|
29
|
+
ShopifyCLI::Context.message("core.app.create.php.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Commands
|
3
|
+
class App
|
4
|
+
class Create
|
5
|
+
class Rails < ShopifyCLI::Command::AppSubCommand
|
6
|
+
unless ShopifyCLI::Environment.acceptance_test?
|
7
|
+
prerequisite_task :ensure_authenticated
|
8
|
+
end
|
9
|
+
|
10
|
+
options do |parser, flags|
|
11
|
+
parser.on("--name=NAME") { |t| flags[:name] = t }
|
12
|
+
parser.on("--organization-id=ID") { |id| flags[:organization_id] = id }
|
13
|
+
parser.on("--store-domain=MYSHOPIFYDOMAIN") { |url| flags[:store_domain] = url }
|
14
|
+
parser.on("--type=APPTYPE") { |type| flags[:type] = type }
|
15
|
+
parser.on("--db=DB") { |db| flags[:db] = db }
|
16
|
+
parser.on("--rails-opts=RAILSOPTS") { |opts| flags[:rails_opts] = opts }
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(*)
|
20
|
+
Services::App::Create::RailsService.call(
|
21
|
+
name: options.flags[:name],
|
22
|
+
organization_id: options.flags[:organization_id],
|
23
|
+
store_domain: options.flags[:store_domain],
|
24
|
+
type: options.flags[:type],
|
25
|
+
db: options.flags[:db],
|
26
|
+
rails_opts: options.flags[:rails_opts],
|
27
|
+
context: @ctx
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
class << self
|
32
|
+
def help
|
33
|
+
ShopifyCLI::Context.message("core.app.create.rails.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Commands
|
3
|
+
class App
|
4
|
+
class Create < ShopifyCLI::Command
|
5
|
+
subcommand :Rails, "rails", "shopify_cli/commands/app/create/rails"
|
6
|
+
subcommand :PHP, "php", "shopify_cli/commands/app/create/php"
|
7
|
+
subcommand :Node, "node", "shopify_cli/commands/app/create/node"
|
8
|
+
|
9
|
+
def call(_args, _command_name)
|
10
|
+
@ctx.puts(self.class.help)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.help
|
14
|
+
ShopifyCLI::Context.message("core.app.create.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.call_help(*)
|
18
|
+
output = help
|
19
|
+
if respond_to?(:extended_help)
|
20
|
+
output += "\n"
|
21
|
+
output += extended_help
|
22
|
+
end
|
23
|
+
@ctx.puts(output)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Commands
|
3
|
+
class App
|
4
|
+
class Deploy < ShopifyCLI::Command::AppSubCommand
|
5
|
+
subcommand :Heroku, "heroku", "shopify_cli/commands/app/deploy/heroku"
|
6
|
+
|
7
|
+
def call(args, _name)
|
8
|
+
platform = args.shift
|
9
|
+
case platform
|
10
|
+
when "heroku"
|
11
|
+
case detect_app
|
12
|
+
when :rails
|
13
|
+
Services::App::Deploy::Heroku::RailsService.call(
|
14
|
+
context: @ctx
|
15
|
+
)
|
16
|
+
when :php
|
17
|
+
Services::App::Deploy::Heroku::PHPService.call(
|
18
|
+
context: @ctx
|
19
|
+
)
|
20
|
+
when :node
|
21
|
+
Services::App::Deploy::Heroku::NodeService.call(
|
22
|
+
context: @ctx
|
23
|
+
)
|
24
|
+
end
|
25
|
+
when nil
|
26
|
+
raise ShopifyCLI::Abort, @ctx.message(
|
27
|
+
"core.app.deploy.error.missing_platform",
|
28
|
+
ShopifyCLI::TOOL_NAME
|
29
|
+
)
|
30
|
+
else
|
31
|
+
raise ShopifyCLI::Abort, @ctx.message(
|
32
|
+
"core.app.deploy.error.invalid_platform",
|
33
|
+
platform,
|
34
|
+
ShopifyCLI::TOOL_NAME
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.help
|
40
|
+
ShopifyCLI::Context.message("core.app.deploy.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.extended_help
|
44
|
+
ShopifyCLI::Context.message("core.app.deploy.extended_help", ShopifyCLI::TOOL_NAME)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Commands
|
3
|
+
class App
|
4
|
+
class Open < ShopifyCLI::Command::AppSubCommand
|
5
|
+
def call(*)
|
6
|
+
project = ShopifyCLI::Project.current
|
7
|
+
Services::App::OpenService.call(
|
8
|
+
project: project,
|
9
|
+
context: @ctx
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.help
|
14
|
+
ShopifyCLI::Context.message("core.app.open.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Commands
|
3
|
+
class App
|
4
|
+
class Serve < ShopifyCLI::Command::AppSubCommand
|
5
|
+
include ShopifyCLI::CommandOptions::CommandServeOptions
|
6
|
+
|
7
|
+
prerequisite_task :ensure_env, :ensure_dev_store
|
8
|
+
|
9
|
+
options do |parser, flags|
|
10
|
+
parser.on("--host=HOST") do |h|
|
11
|
+
flags[:host] = h.gsub('"', "")
|
12
|
+
end
|
13
|
+
parser.on("--port=PORT") { |port| flags[:port] = port }
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(*)
|
17
|
+
case detect_app
|
18
|
+
when :rails
|
19
|
+
Services::App::Serve::RailsService.call(
|
20
|
+
host: host,
|
21
|
+
port: port,
|
22
|
+
context: @ctx
|
23
|
+
)
|
24
|
+
when :node
|
25
|
+
Services::App::Serve::NodeService.call(
|
26
|
+
host: host,
|
27
|
+
port: port,
|
28
|
+
context: @ctx
|
29
|
+
)
|
30
|
+
when :php
|
31
|
+
Services::App::Serve::PHPService.call(
|
32
|
+
host: host,
|
33
|
+
port: port,
|
34
|
+
context: @ctx
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.help
|
40
|
+
ShopifyCLI::Context.message("core.app.serve.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.extended_help
|
44
|
+
ShopifyCLI::Context.message("app.core.serve.extended_help")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "project_types/node/cli"
|
2
|
+
|
3
|
+
module ShopifyCLI
|
4
|
+
module Commands
|
5
|
+
class App
|
6
|
+
class Tunnel < ShopifyCLI::Command::AppSubCommand
|
7
|
+
def call(args, _name)
|
8
|
+
subcommand = args.shift
|
9
|
+
case subcommand
|
10
|
+
when "auth"
|
11
|
+
token = args.shift
|
12
|
+
if token.nil?
|
13
|
+
raise ShopifyCLI::Abort, @ctx.message("core.app.tunnel.error.token_argument_missing")
|
14
|
+
else
|
15
|
+
Services::App::Tunnel::AuthService.call(
|
16
|
+
token: token,
|
17
|
+
context: @ctx
|
18
|
+
)
|
19
|
+
end
|
20
|
+
when "start"
|
21
|
+
Services::App::Tunnel::StartService.call(
|
22
|
+
context: @ctx
|
23
|
+
)
|
24
|
+
when "stop"
|
25
|
+
Services::App::Tunnel::StopService.call(
|
26
|
+
context: @ctx
|
27
|
+
)
|
28
|
+
else
|
29
|
+
@ctx.puts(self.class.help)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.help
|
34
|
+
ShopifyCLI::Context.message("core.app.tunnel.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.extended_help
|
38
|
+
ShopifyCLI::Context.message("core.app.tunnel.extended_help", ShopifyCLI::TOOL_NAME)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "shopify_cli"
|
2
|
+
|
3
|
+
module ShopifyCLI
|
4
|
+
module Commands
|
5
|
+
class App < ShopifyCLI::Command
|
6
|
+
subcommand :Connect, "connect", "shopify_cli/commands/app/connect"
|
7
|
+
subcommand :Create, "create", "shopify_cli/commands/app/create"
|
8
|
+
subcommand :Deploy, "deploy", "shopify_cli/commands/app/deploy"
|
9
|
+
subcommand :Open, "open", "shopify_cli/commands/app/open"
|
10
|
+
subcommand :Serve, "serve", "shopify_cli/commands/app/serve"
|
11
|
+
subcommand :Tunnel, "tunnel", "shopify_cli/commands/app/tunnel"
|
12
|
+
|
13
|
+
def call(*)
|
14
|
+
@ctx.puts(self.class.help)
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def help
|
19
|
+
subcommands = subcommand_registry.command_names.join(" | ")
|
20
|
+
ShopifyCLI::Context.message("core.app.help", ShopifyCLI::TOOL_NAME, subcommands)
|
21
|
+
end
|
22
|
+
|
23
|
+
def call_help(*)
|
24
|
+
@ctx.puts(help)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -16,7 +16,7 @@ module ShopifyCLI
|
|
16
16
|
ShopifyCLI::Context.message("core.config.help", ShopifyCLI::TOOL_NAME)
|
17
17
|
end
|
18
18
|
|
19
|
-
class Feature < ShopifyCLI::SubCommand
|
19
|
+
class Feature < ShopifyCLI::Command::SubCommand
|
20
20
|
def self.help
|
21
21
|
ShopifyCLI::Context.message("core.config.feature.help", ShopifyCLI::TOOL_NAME)
|
22
22
|
end
|
@@ -45,7 +45,7 @@ module ShopifyCLI
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
class Analytics < ShopifyCLI::SubCommand
|
48
|
+
class Analytics < ShopifyCLI::Command::SubCommand
|
49
49
|
def self.help
|
50
50
|
ShopifyCLI::Context.message("core.config.analytics.help", ShopifyCLI::TOOL_NAME)
|
51
51
|
end
|
@@ -15,7 +15,7 @@ module ShopifyCLI
|
|
15
15
|
|
16
16
|
def call(*)
|
17
17
|
shop = (options.flags[:shop] || @ctx.getenv("SHOPIFY_SHOP" || nil))
|
18
|
-
ShopifyCLI::DB.set(shop: self.class.validate_shop(shop)) unless shop.nil?
|
18
|
+
ShopifyCLI::DB.set(shop: self.class.validate_shop(shop, context: @ctx)) unless shop.nil?
|
19
19
|
|
20
20
|
if shop.nil? && Shopifolk.check
|
21
21
|
Shopifolk.reset
|
@@ -41,9 +41,9 @@ module ShopifyCLI
|
|
41
41
|
ShopifyCLI::Context.message("core.login.help", ShopifyCLI::TOOL_NAME)
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.validate_shop(shop)
|
44
|
+
def self.validate_shop(shop, context:)
|
45
45
|
permanent_domain = shop_to_permanent_domain(shop)
|
46
|
-
|
46
|
+
context.abort(context.message("core.login.invalid_shop", shop)) unless permanent_domain
|
47
47
|
permanent_domain
|
48
48
|
end
|
49
49
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "shopify_cli"
|
2
|
+
|
3
|
+
module ShopifyCLI
|
4
|
+
module Commands
|
5
|
+
class Reporting < ShopifyCLI::Command
|
6
|
+
def call(args, _name)
|
7
|
+
enable_reporting = reporting_enabled?(args)
|
8
|
+
Services::ReportingService.call(enable: enable_reporting)
|
9
|
+
|
10
|
+
message = if enable_reporting
|
11
|
+
@ctx.message("core.reporting.turned_on_message")
|
12
|
+
else
|
13
|
+
@ctx.message("core.reporting.turned_off_message", ShopifyCLI::TOOL_NAME)
|
14
|
+
end
|
15
|
+
@ctx.puts(message)
|
16
|
+
end
|
17
|
+
|
18
|
+
def reporting_enabled?(args)
|
19
|
+
case args.first
|
20
|
+
when nil
|
21
|
+
@ctx.abort(@ctx.message("core.reporting.missing_argument", ShopifyCLI::TOOL_NAME))
|
22
|
+
when "on"
|
23
|
+
true
|
24
|
+
when "off"
|
25
|
+
false
|
26
|
+
else
|
27
|
+
@ctx.abort(
|
28
|
+
@ctx.message("core.reporting.invalid_argument", ShopifyCLI::TOOL_NAME, args.first)
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.help
|
34
|
+
ShopifyCLI::Context.message("core.reporting.help", ShopifyCLI::TOOL_NAME)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|