@shopify/cli-kit 3.45.0 → 3.46.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/cli-ruby/Gemfile +0 -1
- package/assets/cli-ruby/Rakefile +0 -76
- package/assets/cli-ruby/lib/project_types/extension/cli.rb +5 -86
- package/assets/cli-ruby/lib/shopify_cli/admin_api.rb +0 -3
- package/assets/cli-ruby/lib/shopify_cli/command/sub_command.rb +1 -2
- package/assets/cli-ruby/lib/shopify_cli/command.rb +0 -7
- package/assets/cli-ruby/lib/shopify_cli/commands.rb +0 -15
- package/assets/cli-ruby/lib/shopify_cli/core.rb +0 -1
- package/assets/cli-ruby/lib/shopify_cli/identity_auth.rb +0 -1
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +9 -1
- package/assets/cli-ruby/lib/shopify_cli.rb +1 -10
- package/assets/cli-ruby/test/test_helpers.rb +0 -2
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/assets/cli-ruby/lib/project_types/extension/commands/build.rb +0 -51
- package/assets/cli-ruby/lib/project_types/extension/commands/check.rb +0 -51
- package/assets/cli-ruby/lib/project_types/extension/commands/connect.rb +0 -35
- package/assets/cli-ruby/lib/project_types/extension/commands/create.rb +0 -100
- package/assets/cli-ruby/lib/project_types/extension/commands/info.rb +0 -86
- package/assets/cli-ruby/lib/project_types/extension/commands/push.rb +0 -112
- package/assets/cli-ruby/lib/project_types/extension/commands/register.rb +0 -67
- package/assets/cli-ruby/lib/project_types/extension/commands/tunnel.rb +0 -73
- package/assets/cli-ruby/lib/project_types/extension/forms/connect.rb +0 -42
- package/assets/cli-ruby/lib/project_types/extension/forms/create.rb +0 -49
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_app.rb +0 -53
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_name.rb +0 -48
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_registration.rb +0 -55
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_template.rb +0 -37
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_type.rb +0 -47
- package/assets/cli-ruby/lib/project_types/extension/models/development_server.rb +0 -77
- package/assets/cli-ruby/lib/project_types/extension/models/development_server_requirements.rb +0 -56
- package/assets/cli-ruby/lib/project_types/extension/models/npm_package.rb +0 -44
- package/assets/cli-ruby/lib/project_types/extension/models/product.rb +0 -12
- package/assets/cli-ruby/lib/project_types/extension/models/registration.rb +0 -20
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/app.rb +0 -13
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/base.rb +0 -31
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/capabilities.rb +0 -11
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development.rb +0 -33
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_entries.rb +0 -38
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_renderer.rb +0 -38
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_resource.rb +0 -13
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/extension.rb +0 -46
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/root.rb +0 -21
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/user.rb +0 -10
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +0 -29
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +0 -170
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb +0 -58
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config.rb +0 -33
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config_repository.rb +0 -75
- package/assets/cli-ruby/lib/project_types/extension/tasks/choose_next_available_port.rb +0 -36
- package/assets/cli-ruby/lib/project_types/extension/tasks/convert_server_config.rb +0 -85
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/app_converter.rb +0 -27
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/product_converter.rb +0 -21
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/registration_converter.rb +0 -28
- package/assets/cli-ruby/lib/project_types/extension/tasks/create_extension.rb +0 -31
- package/assets/cli-ruby/lib/project_types/extension/tasks/ensure_resource_url.rb +0 -39
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/base.rb +0 -15
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/build.rb +0 -30
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/create.rb +0 -30
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/outdated_extension_detection.rb +0 -57
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/serve.rb +0 -36
- package/assets/cli-ruby/lib/project_types/extension/tasks/find_npm_packages.rb +0 -106
- package/assets/cli-ruby/lib/project_types/extension/tasks/find_package_from_json.rb +0 -37
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_app.rb +0 -22
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_apps.rb +0 -26
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_extensions.rb +0 -33
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_product.rb +0 -22
- package/assets/cli-ruby/lib/project_types/extension/tasks/merge_server_config.rb +0 -47
- package/assets/cli-ruby/lib/project_types/extension/tasks/update_draft.rb +0 -29
- package/assets/cli-ruby/lib/project_types/extension/tasks/user_errors.rb +0 -45
- package/assets/cli-ruby/lib/shopify_cli/admin_api/populate_resource_command.rb +0 -166
- package/assets/cli-ruby/lib/shopify_cli/admin_api/schema.rb +0 -35
- package/assets/cli-ruby/lib/shopify_cli/app_type_detector.rb +0 -36
- package/assets/cli-ruby/lib/shopify_cli/assets/post_auth_page/index.html.erb +0 -34
- package/assets/cli-ruby/lib/shopify_cli/assets/post_auth_page/style.css +0 -58
- package/assets/cli-ruby/lib/shopify_cli/changelog.rb +0 -148
- package/assets/cli-ruby/lib/shopify_cli/command/app_sub_command.rb +0 -26
- package/assets/cli-ruby/lib/shopify_cli/command_options/command_serve_options.rb +0 -53
- package/assets/cli-ruby/lib/shopify_cli/command_options.rb +0 -7
- package/assets/cli-ruby/lib/shopify_cli/commands/app/connect.rb +0 -22
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/node.rb +0 -40
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/php.rb +0 -37
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/rails.rb +0 -42
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create.rb +0 -28
- package/assets/cli-ruby/lib/shopify_cli/commands/app/deploy.rb +0 -51
- package/assets/cli-ruby/lib/shopify_cli/commands/app/open.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/commands/app/serve.rb +0 -51
- package/assets/cli-ruby/lib/shopify_cli/commands/app/tunnel.rb +0 -43
- package/assets/cli-ruby/lib/shopify_cli/commands/app.rb +0 -29
- package/assets/cli-ruby/lib/shopify_cli/commands/config.rb +0 -76
- package/assets/cli-ruby/lib/shopify_cli/commands/help.rb +0 -52
- package/assets/cli-ruby/lib/shopify_cli/commands/login.rb +0 -98
- package/assets/cli-ruby/lib/shopify_cli/commands/logout.rb +0 -50
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/customer.rb +0 -25
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/draft_order.rb +0 -28
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/product.rb +0 -24
- package/assets/cli-ruby/lib/shopify_cli/commands/populate.rb +0 -23
- package/assets/cli-ruby/lib/shopify_cli/commands/reporting.rb +0 -38
- package/assets/cli-ruby/lib/shopify_cli/commands/store.rb +0 -15
- package/assets/cli-ruby/lib/shopify_cli/commands/switch.rb +0 -39
- package/assets/cli-ruby/lib/shopify_cli/commands/system.rb +0 -165
- package/assets/cli-ruby/lib/shopify_cli/commands/version.rb +0 -15
- package/assets/cli-ruby/lib/shopify_cli/commands/whoami.rb +0 -28
- package/assets/cli-ruby/lib/shopify_cli/connect.rb +0 -32
- package/assets/cli-ruby/lib/shopify_cli/core/help_resolver.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/heroku.rb +0 -140
- package/assets/cli-ruby/lib/shopify_cli/identity_auth/servlet.rb +0 -44
- package/assets/cli-ruby/lib/shopify_cli/js_deps.rb +0 -110
- package/assets/cli-ruby/lib/shopify_cli/packager.rb +0 -108
- package/assets/cli-ruby/lib/shopify_cli/php_deps.rb +0 -102
- package/assets/cli-ruby/lib/shopify_cli/process_supervision.rb +0 -228
- package/assets/cli-ruby/lib/shopify_cli/project_commands.rb +0 -16
- package/assets/cli-ruby/lib/shopify_cli/release.rb +0 -197
- package/assets/cli-ruby/lib/shopify_cli/sed.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/services/app/connect_service.rb +0 -25
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/node_service.rb +0 -143
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/php_service.rb +0 -147
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/rails_service.rb +0 -239
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +0 -101
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +0 -135
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +0 -120
- package/assets/cli-ruby/lib/shopify_cli/services/app/open_service.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/node_service.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/php_service.rb +0 -23
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/rails_service.rb +0 -28
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/serve_service.rb +0 -57
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/auth_service.rb +0 -21
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/start_service.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/stop_service.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/services/base_service.rb +0 -13
- package/assets/cli-ruby/lib/shopify_cli/services/reporting_service.rb +0 -16
- package/assets/cli-ruby/lib/shopify_cli/services.rb +0 -38
- package/assets/cli-ruby/lib/shopify_cli/tunnel.rb +0 -255
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
recommend_default_ruby_range
|
|
10
|
-
|
|
11
|
-
parse_host_option
|
|
12
|
-
parse_port_option
|
|
13
|
-
parse_no_update_option
|
|
14
|
-
|
|
15
|
-
def call(*)
|
|
16
|
-
case detect_app
|
|
17
|
-
when :rails
|
|
18
|
-
Services::App::Serve::RailsService.call(
|
|
19
|
-
host: host,
|
|
20
|
-
port: port,
|
|
21
|
-
no_update: no_update,
|
|
22
|
-
context: @ctx
|
|
23
|
-
)
|
|
24
|
-
when :node
|
|
25
|
-
Services::App::Serve::NodeService.call(
|
|
26
|
-
host: host,
|
|
27
|
-
port: port,
|
|
28
|
-
no_update: no_update,
|
|
29
|
-
context: @ctx
|
|
30
|
-
)
|
|
31
|
-
when :php
|
|
32
|
-
Services::App::Serve::PHPService.call(
|
|
33
|
-
host: host,
|
|
34
|
-
port: port,
|
|
35
|
-
no_update: no_update,
|
|
36
|
-
context: @ctx
|
|
37
|
-
)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def self.help
|
|
42
|
-
ShopifyCLI::Context.message("core.app.serve.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def self.extended_help
|
|
46
|
-
ShopifyCLI::Context.message("core.app.serve.extended_help")
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Config < ShopifyCLI::Command
|
|
6
|
-
hidden_feature(feature_set: :debug)
|
|
7
|
-
|
|
8
|
-
subcommand :Feature, "feature"
|
|
9
|
-
subcommand :Analytics, "analytics"
|
|
10
|
-
|
|
11
|
-
def call(*)
|
|
12
|
-
@ctx.puts(self.class.help)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def self.help
|
|
16
|
-
ShopifyCLI::Context.message("core.config.help", ShopifyCLI::TOOL_NAME)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
class Feature < ShopifyCLI::Command::SubCommand
|
|
20
|
-
def self.help
|
|
21
|
-
ShopifyCLI::Context.message("core.config.feature.help", ShopifyCLI::TOOL_NAME)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
options do |parser, flags|
|
|
25
|
-
parser.on("--enable") { flags[:action] = "enable" }
|
|
26
|
-
parser.on("--disable") { flags[:action] = "disable" }
|
|
27
|
-
parser.on("--status") { flags[:action] = "status" }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def call(args, _name)
|
|
31
|
-
feature_name = args.shift
|
|
32
|
-
return @ctx.puts(@ctx.message("core.config.help", ShopifyCLI::TOOL_NAME)) if feature_name.nil?
|
|
33
|
-
is_enabled = ShopifyCLI::Feature.enabled?(feature_name)
|
|
34
|
-
if options.flags[:action] == "disable" && is_enabled
|
|
35
|
-
ShopifyCLI::Feature.disable(feature_name)
|
|
36
|
-
@ctx.puts(@ctx.message("core.config.feature.disabled", feature_name))
|
|
37
|
-
elsif options.flags[:action] == "enable" && !is_enabled
|
|
38
|
-
ShopifyCLI::Feature.enable(feature_name)
|
|
39
|
-
@ctx.puts(@ctx.message("core.config.feature.enabled", feature_name))
|
|
40
|
-
elsif is_enabled
|
|
41
|
-
@ctx.puts(@ctx.message("core.config.feature.is_enabled", feature_name))
|
|
42
|
-
else
|
|
43
|
-
@ctx.puts(@ctx.message("core.config.feature.is_disabled", feature_name))
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
class Analytics < ShopifyCLI::Command::SubCommand
|
|
49
|
-
def self.help
|
|
50
|
-
ShopifyCLI::Context.message("core.config.analytics.help", ShopifyCLI::TOOL_NAME)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
options do |parser, flags|
|
|
54
|
-
parser.on("--enable") { flags[:action] = "enable" }
|
|
55
|
-
parser.on("--disable") { flags[:action] = "disable" }
|
|
56
|
-
parser.on("--status") { flags[:action] = "status" }
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def call(_args, _name)
|
|
60
|
-
is_enabled = ShopifyCLI::Config.get_bool("analytics", "enabled")
|
|
61
|
-
if options.flags[:action] == "disable" && is_enabled
|
|
62
|
-
ShopifyCLI::Config.set("analytics", "enabled", false)
|
|
63
|
-
@ctx.puts(@ctx.message("core.config.analytics.disabled"))
|
|
64
|
-
elsif options.flags[:action] == "enable" && !is_enabled
|
|
65
|
-
ShopifyCLI::Config.set("analytics", "enabled", true)
|
|
66
|
-
@ctx.puts(@ctx.message("core.config.analytics.enabled"))
|
|
67
|
-
elsif is_enabled
|
|
68
|
-
@ctx.puts(@ctx.message("core.config.analytics.is_enabled"))
|
|
69
|
-
else
|
|
70
|
-
@ctx.puts(@ctx.message("core.config.analytics.is_disabled"))
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Help < ShopifyCLI::Command
|
|
6
|
-
def call(args, _name)
|
|
7
|
-
command = args.shift
|
|
8
|
-
if command && command != "help"
|
|
9
|
-
if Registry.exist?(command)
|
|
10
|
-
cmd, _ = Registry.lookup_command(command)
|
|
11
|
-
subcmd, _ = cmd.subcommand_registry.lookup_command(args.first)
|
|
12
|
-
if subcmd
|
|
13
|
-
display_help(subcmd)
|
|
14
|
-
else
|
|
15
|
-
display_help(cmd)
|
|
16
|
-
end
|
|
17
|
-
return
|
|
18
|
-
else
|
|
19
|
-
@ctx.puts(@ctx.message("core.help.error.command_not_found", command))
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
preamble = @ctx.message("core.help.preamble", ShopifyCLI::TOOL_NAME)
|
|
24
|
-
@ctx.puts(preamble)
|
|
25
|
-
|
|
26
|
-
available_commands = resolved_commands.select { |_name, c| !c.hidden? }
|
|
27
|
-
|
|
28
|
-
available_commands.each do |name, klass|
|
|
29
|
-
next if name == "help"
|
|
30
|
-
@ctx.puts("{{command:#{name}}}: #{klass.help}\n")
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def display_help(klass)
|
|
37
|
-
output = klass.help
|
|
38
|
-
if klass.respond_to?(:extended_help)
|
|
39
|
-
output += "\n"
|
|
40
|
-
output += klass.extended_help
|
|
41
|
-
end
|
|
42
|
-
@ctx.puts(output)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def resolved_commands
|
|
46
|
-
ShopifyCLI::Commands::Registry
|
|
47
|
-
.resolved_commands
|
|
48
|
-
.sort
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Login < ShopifyCLI::Command
|
|
6
|
-
PROTOCOL_REGEX = /^https?\:\/\//
|
|
7
|
-
PERMANENT_DOMAIN_SUFFIX = /\.myshopify\.(com|io)$/
|
|
8
|
-
|
|
9
|
-
options do |parser, flags|
|
|
10
|
-
parser.on("-s", "--store=STORE") { |url| flags[:shop] = url }
|
|
11
|
-
# backwards compatibility allow 'shop' for now
|
|
12
|
-
parser.on("--shop=SHOP") { |url| flags[:shop] = url }
|
|
13
|
-
parser.on("--password=PASSWORD") { |password| flags[:password] = password }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def call(*)
|
|
17
|
-
shop = (options.flags[:shop] || @ctx.getenv("SHOPIFY_SHOP" || nil))
|
|
18
|
-
ShopifyCLI::DB.set(shop: self.class.validate_shop(shop, context: @ctx)) unless shop.nil?
|
|
19
|
-
|
|
20
|
-
if shop.nil? && Shopifolk.check
|
|
21
|
-
Shopifolk.reset
|
|
22
|
-
@ctx.puts(@ctx.message("core.tasks.select_org_and_shop.identified_as_shopify"))
|
|
23
|
-
message = @ctx.message("core.tasks.select_org_and_shop.first_party")
|
|
24
|
-
if CLI::UI::Prompt.confirm(message, default: false)
|
|
25
|
-
Shopifolk.act_as_shopify_organization
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
password = options.flags[:password] || @ctx.getenv("SHOPIFY_PASSWORD")
|
|
30
|
-
if !password.nil? && !password.empty?
|
|
31
|
-
ShopifyCLI::DB.set(shopify_exchange_token: password)
|
|
32
|
-
else
|
|
33
|
-
IdentityAuth.new(ctx: @ctx).authenticate(spinner: true)
|
|
34
|
-
org = select_organization
|
|
35
|
-
ShopifyCLI::DB.set(organization_id: org["id"].to_i) unless org.nil?
|
|
36
|
-
Whoami.call([], "whoami")
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def self.help
|
|
41
|
-
ShopifyCLI::Context.message("core.login.help", ShopifyCLI::TOOL_NAME)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def self.validate_shop(shop, context:)
|
|
45
|
-
permanent_domain = shop_to_permanent_domain(shop)
|
|
46
|
-
context.abort(context.message("core.login.invalid_shop", shop)) unless permanent_domain
|
|
47
|
-
permanent_domain
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def self.shop_to_permanent_domain(shop)
|
|
51
|
-
url = if PROTOCOL_REGEX =~ shop
|
|
52
|
-
shop
|
|
53
|
-
elsif shop.include?(".")
|
|
54
|
-
"https://#{shop}"
|
|
55
|
-
else
|
|
56
|
-
"https://#{shop}.myshopify.com"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# Make a request to see if it exists or if we get redirected to the permanent domain one
|
|
60
|
-
uri = URI.parse(url)
|
|
61
|
-
Net::HTTP.start(uri.host, use_ssl: true) do |http|
|
|
62
|
-
response = http.request_head("/admin")
|
|
63
|
-
case response
|
|
64
|
-
when Net::HTTPSuccess, Net::HTTPSeeOther
|
|
65
|
-
uri.host
|
|
66
|
-
when Net::HTTPFound
|
|
67
|
-
domain = URI.parse(response["location"]).host
|
|
68
|
-
if PERMANENT_DOMAIN_SUFFIX =~ domain
|
|
69
|
-
domain
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
private
|
|
76
|
-
|
|
77
|
-
def select_organization
|
|
78
|
-
organizations = []
|
|
79
|
-
CLI::UI::Spinner.spin(@ctx.message("core.login.spinner.loading_organizations")) do
|
|
80
|
-
organizations = ShopifyCLI::PartnersAPI::Organizations.fetch_all(@ctx)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
if organizations.count == 0
|
|
84
|
-
nil
|
|
85
|
-
elsif organizations.count == 1
|
|
86
|
-
organizations.first
|
|
87
|
-
else
|
|
88
|
-
org_id = CLI::UI::Prompt.ask(@ctx.message("core.tasks.select_org_and_shop.organization_select")) do |handler|
|
|
89
|
-
organizations.each do |o|
|
|
90
|
-
handler.option(@ctx.message("core.partners_api.org_name_and_id", o["businessName"], o["id"])) { o["id"] }
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
organizations.find { |o| o["id"] == org_id }
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
require "shopify_cli/theme/development_theme"
|
|
3
|
-
require "shopify_cli/theme/extension/host_theme"
|
|
4
|
-
|
|
5
|
-
module ShopifyCLI
|
|
6
|
-
module Commands
|
|
7
|
-
class Logout < ShopifyCLI::Command
|
|
8
|
-
def call(*)
|
|
9
|
-
try_delete_development_theme
|
|
10
|
-
try_delete_host_theme
|
|
11
|
-
|
|
12
|
-
ShopifyCLI::IdentityAuth.delete_tokens_and_keys
|
|
13
|
-
ShopifyCLI::DB.del(:shop) if has_shop?
|
|
14
|
-
ShopifyCLI::DB.del(:organization_id) if has_organization_id?
|
|
15
|
-
ShopifyCLI::Shopifolk.reset
|
|
16
|
-
@ctx.puts(@ctx.message("core.logout.success"))
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def self.help
|
|
20
|
-
ShopifyCLI::Context.message("core.logout.help", ShopifyCLI::TOOL_NAME)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def has_shop?
|
|
26
|
-
ShopifyCLI::DB.exists?(:shop)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def has_organization_id?
|
|
30
|
-
ShopifyCLI::DB.exists?(:organization_id)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def try_delete_development_theme
|
|
34
|
-
return unless has_shop?
|
|
35
|
-
|
|
36
|
-
ShopifyCLI::Theme::DevelopmentTheme.delete(@ctx)
|
|
37
|
-
rescue ShopifyCLI::API::APIRequestError, ShopifyCLI::Abort, ShopifyCLI::AbortSilent => e
|
|
38
|
-
@ctx.debug("[Logout Error]: #{e.message}")
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def try_delete_host_theme
|
|
42
|
-
return unless has_shop?
|
|
43
|
-
|
|
44
|
-
ShopifyCLI::Theme::Extension::HostTheme.delete(@ctx)
|
|
45
|
-
rescue ShopifyCLI::API::APIRequestError, ShopifyCLI::Abort, ShopifyCLI::AbortSilent => e
|
|
46
|
-
@ctx.debug("[Logout Error]: #{e.message}")
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Populate
|
|
6
|
-
class Customer < ShopifyCLI::AdminAPI::PopulateResourceCommand
|
|
7
|
-
@input_type = :CustomerInput
|
|
8
|
-
|
|
9
|
-
def defaults
|
|
10
|
-
first_name, last_name = ShopifyCLI::Helpers::Haikunator.name
|
|
11
|
-
{
|
|
12
|
-
firstName: first_name,
|
|
13
|
-
lastName: last_name,
|
|
14
|
-
}
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def message(data)
|
|
18
|
-
ret = data["customerCreate"]["customer"]
|
|
19
|
-
id = ShopifyCLI::API.gid_to_id(ret["id"])
|
|
20
|
-
@ctx.message("core.populate.customer.added", ret["displayName"], @shop, admin_url, id)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Populate
|
|
6
|
-
class DraftOrder < ShopifyCLI::AdminAPI::PopulateResourceCommand
|
|
7
|
-
@input_type = :DraftOrderInput
|
|
8
|
-
|
|
9
|
-
def defaults
|
|
10
|
-
{
|
|
11
|
-
lineItems: [{
|
|
12
|
-
originalUnitPrice: price,
|
|
13
|
-
quantity: 1,
|
|
14
|
-
weight: { value: 10, unit: "GRAMS" },
|
|
15
|
-
title: ShopifyCLI::Helpers::Haikunator.title,
|
|
16
|
-
}],
|
|
17
|
-
}
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def message(data)
|
|
21
|
-
ret = data["draftOrderCreate"]["draftOrder"]
|
|
22
|
-
id = ShopifyCLI::API.gid_to_id(ret["id"])
|
|
23
|
-
@ctx.message("core.populate.draft_order.added", @shop, admin_url, id)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Populate
|
|
6
|
-
class Product < ShopifyCLI::AdminAPI::PopulateResourceCommand
|
|
7
|
-
@input_type = :ProductInput
|
|
8
|
-
|
|
9
|
-
def defaults
|
|
10
|
-
{
|
|
11
|
-
title: ShopifyCLI::Helpers::Haikunator.title,
|
|
12
|
-
variants: [{ price: price }],
|
|
13
|
-
}
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def message(data)
|
|
17
|
-
ret = data["productCreate"]["product"]
|
|
18
|
-
id = ShopifyCLI::API.gid_to_id(ret["id"])
|
|
19
|
-
@ctx.message("core.populate.product.added", ret["title"], @shop, admin_url, id)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Populate < ShopifyCLI::Command
|
|
6
|
-
subcommand :Customer, "customers", "shopify_cli/commands/populate/customer"
|
|
7
|
-
subcommand :DraftOrder, "draftorders", "shopify_cli/commands/populate/draft_order"
|
|
8
|
-
subcommand :Product, "products", "shopify_cli/commands/populate/product"
|
|
9
|
-
|
|
10
|
-
def call(_args, _name)
|
|
11
|
-
@ctx.puts(self.class.help)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.help
|
|
15
|
-
ShopifyCLI::Context.message("core.populate.help", ShopifyCLI::TOOL_NAME)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.extended_help
|
|
19
|
-
ShopifyCLI::Context.message("core.populate.extended_help", ShopifyCLI::TOOL_NAME)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Store < ShopifyCLI::Command
|
|
6
|
-
def call(_args, _name)
|
|
7
|
-
@ctx.puts(@ctx.message("core.store.shop", ShopifyCLI::AdminAPI.get_shop_or_abort(@ctx)))
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.help
|
|
11
|
-
ShopifyCLI::Context.message("core.store.help", ShopifyCLI::TOOL_NAME)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
require "shopify_cli"
|
|
2
|
-
|
|
3
|
-
module ShopifyCLI
|
|
4
|
-
module Commands
|
|
5
|
-
class Switch < ShopifyCLI::Command
|
|
6
|
-
options do |parser, flags|
|
|
7
|
-
parser.on("-s", "--store=STORE") { |url| flags[:shop] = url }
|
|
8
|
-
# backwards compatibility allow 'shop' for now
|
|
9
|
-
parser.on("--shop=SHOP") { |url| flags[:shop] = url }
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def call(*)
|
|
13
|
-
if Shopifolk.acting_as_shopify_organization?
|
|
14
|
-
@ctx.puts(@ctx.message("core.switch.disabled_as_shopify_org"))
|
|
15
|
-
return
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
shop = if options.flags[:shop]
|
|
19
|
-
Login.validate_shop(options.flags[:shop], context: @ctx)
|
|
20
|
-
elsif (org_id = DB.get(:organization_id))
|
|
21
|
-
res = ShopifyCLI::Tasks::SelectOrgAndShop.call(@ctx, organization_id: org_id)
|
|
22
|
-
res[:shop_domain]
|
|
23
|
-
else
|
|
24
|
-
AdminAPI.get_shop_or_abort(@ctx)
|
|
25
|
-
res = ShopifyCLI::Tasks::SelectOrgAndShop.call(@ctx)
|
|
26
|
-
res[:shop_domain]
|
|
27
|
-
end
|
|
28
|
-
DB.set(shop: shop)
|
|
29
|
-
IdentityAuth.new(ctx: @ctx).reauthenticate
|
|
30
|
-
|
|
31
|
-
@ctx.puts(@ctx.message("core.switch.success", shop))
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def self.help
|
|
35
|
-
ShopifyCLI::Context.message("core.switch.help", ShopifyCLI::TOOL_NAME)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|