shopify-cli 1.6.0 → 1.9.1
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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +15 -2
- data/CHANGELOG.md +21 -0
- data/Gemfile +12 -12
- data/Gemfile.lock +14 -14
- data/Rakefile +32 -30
- data/bin/load_shopify.rb +6 -6
- data/bin/shopify +2 -2
- data/dev.yml +3 -0
- data/ext/shopify-cli/extconf.rb +7 -7
- data/lib/docgen/markdown.rb +12 -12
- data/lib/graphql/extension_create.graphql +17 -2
- data/lib/graphql/fetch_specifications.graphql +14 -0
- data/lib/{project_types/extension/graphql → graphql}/get_app_by_api_key.graphql +0 -0
- data/lib/project_types/extension/cli.rb +56 -55
- data/lib/project_types/extension/commands/build.rb +3 -3
- data/lib/project_types/extension/commands/create.rb +17 -10
- data/lib/project_types/extension/commands/extension_command.rb +14 -7
- data/lib/project_types/extension/commands/push.rb +10 -10
- data/lib/project_types/extension/commands/register.rb +22 -32
- data/lib/project_types/extension/commands/serve.rb +1 -7
- data/lib/project_types/extension/commands/tunnel.rb +12 -12
- data/lib/project_types/extension/extension_project.rb +22 -7
- data/lib/project_types/extension/extension_project_keys.rb +5 -4
- data/lib/project_types/extension/features/argo.rb +26 -42
- data/lib/project_types/extension/features/argo_config.rb +5 -5
- data/lib/project_types/extension/features/argo_dependencies.rb +5 -5
- data/lib/project_types/extension/features/argo_renderer_package.rb +47 -0
- data/lib/project_types/extension/features/argo_serve.rb +69 -0
- data/lib/project_types/extension/features/argo_setup.rb +3 -3
- data/lib/project_types/extension/features/argo_setup_steps.rb +4 -4
- data/lib/project_types/extension/forms/create.rb +28 -34
- data/lib/project_types/extension/forms/questions/ask_app.rb +53 -0
- data/lib/project_types/extension/forms/questions/ask_name.rb +40 -0
- data/lib/project_types/extension/forms/questions/ask_type.rb +47 -0
- data/lib/project_types/extension/messages/message_loading.rb +3 -1
- data/lib/project_types/extension/messages/messages.rb +55 -55
- data/lib/project_types/extension/models/lazy_specification_handler.rb +12 -0
- data/lib/project_types/extension/models/registration.rb +1 -0
- data/lib/project_types/extension/models/specification.rb +6 -2
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
- data/lib/project_types/extension/models/specification_handlers/default.rb +10 -2
- data/lib/project_types/extension/models/specifications.rb +14 -3
- data/lib/project_types/extension/models/version.rb +1 -1
- data/lib/project_types/extension/tasks/configure_features.rb +7 -5
- data/lib/project_types/extension/tasks/converters/app_converter.rb +6 -6
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +8 -6
- data/lib/project_types/extension/tasks/converters/validation_error_converter.rb +4 -4
- data/lib/project_types/extension/tasks/converters/version_converter.rb +7 -7
- data/lib/project_types/extension/tasks/create_extension.rb +4 -4
- data/lib/project_types/extension/tasks/fetch_specifications.rb +8 -28
- data/lib/project_types/extension/tasks/get_app.rb +4 -4
- data/lib/project_types/extension/tasks/get_apps.rb +3 -3
- data/lib/project_types/extension/tasks/update_draft.rb +4 -4
- data/lib/project_types/extension/tasks/user_errors.rb +4 -4
- data/lib/project_types/node/cli.rb +19 -19
- data/lib/project_types/node/commands/connect.rb +3 -3
- data/lib/project_types/node/commands/create.rb +40 -38
- data/lib/project_types/node/commands/deploy.rb +4 -4
- data/lib/project_types/node/commands/deploy/heroku.rb +24 -24
- data/lib/project_types/node/commands/generate.rb +2 -24
- data/lib/project_types/node/commands/open.rb +2 -2
- data/lib/project_types/node/commands/populate.rb +6 -6
- data/lib/project_types/node/commands/populate/customer.rb +5 -5
- data/lib/project_types/node/commands/populate/draft_order.rb +5 -5
- data/lib/project_types/node/commands/populate/product.rb +5 -5
- data/lib/project_types/node/commands/serve.rb +9 -9
- data/lib/project_types/node/commands/tunnel.rb +7 -7
- data/lib/project_types/node/forms/create.rb +17 -8
- data/lib/project_types/node/messages/messages.rb +8 -7
- data/lib/project_types/rails/cli.rb +21 -21
- data/lib/project_types/rails/commands/connect.rb +3 -3
- data/lib/project_types/rails/commands/create.rb +51 -48
- data/lib/project_types/rails/commands/deploy.rb +4 -4
- data/lib/project_types/rails/commands/deploy/heroku.rb +30 -30
- data/lib/project_types/rails/commands/generate.rb +7 -7
- data/lib/project_types/rails/commands/generate/webhook.rb +6 -6
- data/lib/project_types/rails/commands/open.rb +2 -2
- data/lib/project_types/rails/commands/populate.rb +6 -6
- data/lib/project_types/rails/commands/populate/customer.rb +5 -5
- data/lib/project_types/rails/commands/populate/draft_order.rb +5 -5
- data/lib/project_types/rails/commands/populate/product.rb +5 -5
- data/lib/project_types/rails/commands/serve.rb +11 -11
- data/lib/project_types/rails/commands/tunnel.rb +7 -7
- data/lib/project_types/rails/forms/create.rb +34 -24
- data/lib/project_types/rails/gem.rb +23 -23
- data/lib/project_types/rails/messages/messages.rb +9 -8
- data/lib/project_types/rails/ruby.rb +2 -2
- data/lib/project_types/script/cli.rb +36 -40
- data/lib/project_types/script/commands/create.rb +9 -13
- data/lib/project_types/script/commands/push.rb +6 -5
- data/lib/project_types/script/config/extension_points.yml +25 -10
- data/lib/project_types/script/errors.rb +1 -19
- data/lib/project_types/script/forms/create.rb +7 -18
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +7 -5
- data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
- data/lib/project_types/script/layers/application/build_script.rb +6 -8
- data/lib/project_types/script/layers/application/create_script.rb +34 -24
- data/lib/project_types/script/layers/application/extension_points.rb +3 -2
- data/lib/project_types/script/layers/application/project_dependencies.rb +4 -4
- data/lib/project_types/script/layers/application/push_script.rb +10 -15
- data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
- data/lib/project_types/script/layers/domain/errors.rb +16 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +60 -45
- data/lib/project_types/script/layers/domain/metadata.rb +18 -25
- data/lib/project_types/script/layers/domain/push_package.rb +9 -5
- data/lib/project_types/script/layers/domain/script_project.rb +38 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +39 -10
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +9 -44
- data/lib/project_types/script/layers/infrastructure/errors.rb +50 -19
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +16 -21
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +4 -4
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +179 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +35 -78
- data/lib/project_types/script/messages/messages.rb +33 -57
- data/lib/project_types/script/ui/error_handler.rb +116 -88
- data/lib/project_types/script/ui/printing_spinner.rb +1 -1
- data/lib/project_types/script/ui/strict_spinner.rb +1 -1
- data/lib/project_types/theme/cli.rb +19 -19
- data/lib/project_types/theme/commands/connect.rb +12 -12
- data/lib/project_types/theme/commands/create.rb +11 -11
- data/lib/project_types/theme/commands/deploy.rb +8 -8
- data/lib/project_types/theme/commands/generate.rb +3 -3
- data/lib/project_types/theme/commands/generate/env.rb +15 -15
- data/lib/project_types/theme/commands/push.rb +15 -15
- data/lib/project_types/theme/commands/serve.rb +5 -5
- data/lib/project_types/theme/forms/connect.rb +4 -4
- data/lib/project_types/theme/forms/create.rb +5 -5
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +22 -22
- data/lib/project_types/theme/themekit.rb +15 -15
- data/lib/rubygems_plugin.rb +3 -3
- data/lib/shopify-cli/admin_api.rb +11 -11
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +17 -17
- data/lib/shopify-cli/admin_api/schema.rb +3 -3
- data/lib/shopify-cli/api.rb +10 -10
- data/lib/shopify-cli/command.rb +1 -1
- data/lib/shopify-cli/commands.rb +9 -9
- data/lib/shopify-cli/commands/config.rb +28 -52
- data/lib/shopify-cli/commands/connect.rb +10 -10
- data/lib/shopify-cli/commands/create.rb +5 -5
- data/lib/shopify-cli/commands/help.rb +6 -6
- data/lib/shopify-cli/commands/logout.rb +3 -3
- data/lib/shopify-cli/commands/system.rb +32 -32
- data/lib/shopify-cli/commands/version.rb +2 -2
- data/lib/shopify-cli/context.rb +51 -23
- data/lib/shopify-cli/core.rb +4 -4
- data/lib/shopify-cli/core/entry_point.rb +5 -5
- data/lib/shopify-cli/core/executor.rb +1 -1
- data/lib/shopify-cli/core/help_resolver.rb +2 -2
- data/lib/shopify-cli/core/monorail.rb +16 -16
- data/lib/shopify-cli/db.rb +2 -2
- data/lib/shopify-cli/feature.rb +1 -1
- data/lib/shopify-cli/form.rb +1 -1
- data/lib/shopify-cli/git.rb +17 -17
- data/lib/shopify-cli/helpers.rb +1 -1
- data/lib/shopify-cli/helpers/haikunator.rb +1 -1
- data/lib/shopify-cli/heroku.rb +28 -28
- data/lib/shopify-cli/http_request.rb +2 -2
- data/lib/shopify-cli/js_deps.rb +12 -12
- data/lib/shopify-cli/js_system.rb +7 -7
- data/lib/shopify-cli/lazy_delegator.rb +55 -0
- data/lib/shopify-cli/messages/messages.rb +7 -16
- data/lib/shopify-cli/method_object.rb +1 -1
- data/lib/shopify-cli/oauth.rb +27 -27
- data/lib/shopify-cli/oauth/servlet.rb +9 -9
- data/lib/shopify-cli/options.rb +3 -3
- data/lib/shopify-cli/packager.rb +25 -25
- data/lib/shopify-cli/partners_api.rb +16 -16
- data/lib/shopify-cli/partners_api/organizations.rb +10 -10
- data/lib/shopify-cli/process_supervision.rb +7 -7
- data/lib/shopify-cli/project.rb +16 -16
- data/lib/shopify-cli/project_type.rb +3 -3
- data/lib/shopify-cli/resolve_constant.rb +1 -1
- data/lib/shopify-cli/resources.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +10 -10
- data/lib/shopify-cli/result.rb +11 -11
- data/lib/shopify-cli/shopifolk.rb +6 -9
- data/lib/shopify-cli/sub_command.rb +1 -1
- data/lib/shopify-cli/task.rb +3 -3
- data/lib/shopify-cli/tasks.rb +7 -7
- data/lib/shopify-cli/tasks/create_api_client.rb +5 -5
- data/lib/shopify-cli/tasks/ensure_dev_store.rb +12 -12
- data/lib/shopify-cli/tasks/ensure_env.rb +15 -15
- data/lib/shopify-cli/tasks/ensure_loopback_url.rb +4 -4
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +19 -19
- data/lib/shopify-cli/tasks/update_dashboard_urls.rb +10 -10
- data/lib/shopify-cli/transform_data_structure.rb +86 -0
- data/lib/shopify-cli/tunnel.rb +30 -30
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +56 -54
- data/shopify-cli.gemspec +6 -6
- data/vendor/deps/smart_properties/REVISION +1 -1
- data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
- data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
- data/vendor/gen/template/bin/update-deps +9 -9
- metadata +15 -11
- data/lib/project_types/extension/forms/register.rb +0 -47
- data/lib/project_types/script/commands/disable.rb +0 -25
- data/lib/project_types/script/commands/enable.rb +0 -78
- data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
- data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
- data/lib/project_types/script/layers/application/disable_script.rb +0 -21
- data/lib/project_types/script/layers/application/enable_script.rb +0 -23
- data/lib/project_types/script/script_project.rb +0 -63
|
File without changes
|
|
@@ -1,87 +1,88 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Extension
|
|
4
|
+
class PackageNotFound < RuntimeError; end
|
|
5
|
+
|
|
4
6
|
class Project < ShopifyCli::ProjectType
|
|
5
7
|
hidden_feature
|
|
6
|
-
title(
|
|
7
|
-
creator(
|
|
8
|
+
title("App Extension")
|
|
9
|
+
creator("Extension::Commands::Create")
|
|
8
10
|
|
|
9
|
-
register_command(
|
|
10
|
-
register_command(
|
|
11
|
-
register_command(
|
|
12
|
-
register_command(
|
|
13
|
-
register_command(
|
|
11
|
+
register_command("Extension::Commands::Build", "build")
|
|
12
|
+
register_command("Extension::Commands::Register", "register")
|
|
13
|
+
register_command("Extension::Commands::Push", "push")
|
|
14
|
+
register_command("Extension::Commands::Serve", "serve")
|
|
15
|
+
register_command("Extension::Commands::Tunnel", "tunnel")
|
|
14
16
|
|
|
15
|
-
require Project.project_filepath(
|
|
16
|
-
require Project.project_filepath(
|
|
17
|
-
require Project.project_filepath(
|
|
17
|
+
require Project.project_filepath("messages/messages")
|
|
18
|
+
require Project.project_filepath("messages/message_loading")
|
|
19
|
+
require Project.project_filepath("extension_project_keys")
|
|
18
20
|
register_messages(Extension::Messages::MessageLoading.load)
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
module Commands
|
|
22
|
-
autoload :ExtensionCommand, Project.project_filepath(
|
|
23
|
-
autoload :Create, Project.project_filepath(
|
|
24
|
-
autoload :Register, Project.project_filepath(
|
|
25
|
-
autoload :Build, Project.project_filepath(
|
|
26
|
-
autoload :Serve, Project.project_filepath(
|
|
27
|
-
autoload :Push, Project.project_filepath(
|
|
28
|
-
autoload :Tunnel, Project.project_filepath(
|
|
24
|
+
autoload :ExtensionCommand, Project.project_filepath("commands/extension_command")
|
|
25
|
+
autoload :Create, Project.project_filepath("commands/create")
|
|
26
|
+
autoload :Register, Project.project_filepath("commands/register")
|
|
27
|
+
autoload :Build, Project.project_filepath("commands/build")
|
|
28
|
+
autoload :Serve, Project.project_filepath("commands/serve")
|
|
29
|
+
autoload :Push, Project.project_filepath("commands/push")
|
|
30
|
+
autoload :Tunnel, Project.project_filepath("commands/tunnel")
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
module Tasks
|
|
32
|
-
autoload :UserErrors, Project.project_filepath(
|
|
33
|
-
autoload :GetApps, Project.project_filepath(
|
|
34
|
-
autoload :GetApp, Project.project_filepath(
|
|
35
|
-
autoload :CreateExtension, Project.project_filepath(
|
|
36
|
-
autoload :UpdateDraft, Project.project_filepath(
|
|
37
|
-
autoload :FetchSpecifications, Project.project_filepath(
|
|
38
|
-
autoload :ConfigureFeatures, Project.project_filepath(
|
|
34
|
+
autoload :UserErrors, Project.project_filepath("tasks/user_errors")
|
|
35
|
+
autoload :GetApps, Project.project_filepath("tasks/get_apps")
|
|
36
|
+
autoload :GetApp, Project.project_filepath("tasks/get_app")
|
|
37
|
+
autoload :CreateExtension, Project.project_filepath("tasks/create_extension")
|
|
38
|
+
autoload :UpdateDraft, Project.project_filepath("tasks/update_draft")
|
|
39
|
+
autoload :FetchSpecifications, Project.project_filepath("tasks/fetch_specifications")
|
|
40
|
+
autoload :ConfigureFeatures, Project.project_filepath("tasks/configure_features")
|
|
39
41
|
|
|
40
42
|
module Converters
|
|
41
|
-
autoload :RegistrationConverter, Project.project_filepath(
|
|
42
|
-
autoload :VersionConverter, Project.project_filepath(
|
|
43
|
-
autoload :ValidationErrorConverter, Project.project_filepath(
|
|
44
|
-
autoload :AppConverter, Project.project_filepath(
|
|
43
|
+
autoload :RegistrationConverter, Project.project_filepath("tasks/converters/registration_converter")
|
|
44
|
+
autoload :VersionConverter, Project.project_filepath("tasks/converters/version_converter")
|
|
45
|
+
autoload :ValidationErrorConverter, Project.project_filepath("tasks/converters/validation_error_converter")
|
|
46
|
+
autoload :AppConverter, Project.project_filepath("tasks/converters/app_converter")
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
module Forms
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
module Questions
|
|
52
|
+
autoload :AskApp, Project.project_filepath("forms/questions/ask_app")
|
|
53
|
+
autoload :AskName, Project.project_filepath("forms/questions/ask_name")
|
|
54
|
+
autoload :AskType, Project.project_filepath("forms/questions/ask_type")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
autoload :Create, Project.project_filepath("forms/create")
|
|
58
|
+
autoload :Register, Project.project_filepath("forms/register")
|
|
51
59
|
end
|
|
52
60
|
|
|
53
61
|
module Features
|
|
54
|
-
autoload :
|
|
55
|
-
autoload :
|
|
56
|
-
autoload :
|
|
57
|
-
autoload :
|
|
58
|
-
autoload :
|
|
59
|
-
autoload :
|
|
62
|
+
autoload :ArgoRendererPackage, Project.project_filepath("features/argo_renderer_package")
|
|
63
|
+
autoload :ArgoServe, Project.project_filepath("features/argo_serve")
|
|
64
|
+
autoload :ArgoSetup, Project.project_filepath("features/argo_setup")
|
|
65
|
+
autoload :ArgoSetupStep, Project.project_filepath("features/argo_setup_step")
|
|
66
|
+
autoload :ArgoSetupSteps, Project.project_filepath("features/argo_setup_steps")
|
|
67
|
+
autoload :ArgoDependencies, Project.project_filepath("features/argo_dependencies")
|
|
68
|
+
autoload :ArgoConfig, Project.project_filepath("features/argo_config")
|
|
69
|
+
autoload :Argo, Project.project_filepath("features/argo")
|
|
60
70
|
end
|
|
61
71
|
|
|
62
72
|
module Models
|
|
63
73
|
module SpecificationHandlers
|
|
64
|
-
autoload :Default, Project.project_filepath(
|
|
74
|
+
autoload :Default, Project.project_filepath("models/specification_handlers/default")
|
|
65
75
|
end
|
|
66
76
|
|
|
67
|
-
autoload :App, Project.project_filepath(
|
|
68
|
-
autoload :Registration, Project.project_filepath(
|
|
69
|
-
autoload :Version, Project.project_filepath(
|
|
70
|
-
autoload :ValidationError, Project.project_filepath(
|
|
71
|
-
autoload :Specification, Project.project_filepath(
|
|
72
|
-
autoload :Specifications, Project.project_filepath(
|
|
77
|
+
autoload :App, Project.project_filepath("models/app")
|
|
78
|
+
autoload :Registration, Project.project_filepath("models/registration")
|
|
79
|
+
autoload :Version, Project.project_filepath("models/version")
|
|
80
|
+
autoload :ValidationError, Project.project_filepath("models/validation_error")
|
|
81
|
+
autoload :Specification, Project.project_filepath("models/specification")
|
|
82
|
+
autoload :Specifications, Project.project_filepath("models/specifications")
|
|
83
|
+
autoload :LazySpecificationHandler, Project.project_filepath("models/lazy_specification_handler")
|
|
73
84
|
end
|
|
74
85
|
|
|
75
|
-
autoload :ExtensionProjectKeys, Project.project_filepath(
|
|
76
|
-
autoload :ExtensionProject, Project.project_filepath(
|
|
77
|
-
|
|
78
|
-
def self.specifications
|
|
79
|
-
@specifications ||= Models::Specifications.new(
|
|
80
|
-
fetch_specifications: Tasks::FetchSpecifications
|
|
81
|
-
)
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def self.specifications=(specifications)
|
|
85
|
-
@specifications = specifications
|
|
86
|
-
end
|
|
86
|
+
autoload :ExtensionProjectKeys, Project.project_filepath("extension_project_keys")
|
|
87
|
+
autoload :ExtensionProject, Project.project_filepath("extension_project")
|
|
87
88
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require
|
|
2
|
+
require "shopify_cli"
|
|
3
3
|
|
|
4
4
|
module Extension
|
|
5
5
|
module Commands
|
|
@@ -12,9 +12,9 @@ module Extension
|
|
|
12
12
|
def call(_args, _command_name)
|
|
13
13
|
system = ShopifyCli::JsSystem.new(ctx: @ctx)
|
|
14
14
|
|
|
15
|
-
CLI::UI::Frame.open(@ctx.message(
|
|
15
|
+
CLI::UI::Frame.open(@ctx.message("build.frame_title", system.package_manager)) do
|
|
16
16
|
success = system.call(yarn: YARN_BUILD_COMMAND, npm: NPM_BUILD_COMMAND)
|
|
17
|
-
@ctx.abort(@ctx.message(
|
|
17
|
+
@ctx.abort(@ctx.message("build.build_failure_message")) unless success
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -4,24 +4,30 @@ module Extension
|
|
|
4
4
|
module Commands
|
|
5
5
|
class Create < ShopifyCli::SubCommand
|
|
6
6
|
options do |parser, flags|
|
|
7
|
-
parser.on(
|
|
8
|
-
parser.on(
|
|
7
|
+
parser.on("--name=NAME") { |name| flags[:name] = name }
|
|
8
|
+
parser.on("--type=TYPE") { |type| flags[:type] = type.upcase }
|
|
9
|
+
parser.on("--api-key=KEY") { |key| flags[:api_key] = key.downcase }
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def call(args, _)
|
|
12
13
|
with_create_form(args) do |form|
|
|
13
14
|
if Dir.exist?(form.directory_name)
|
|
14
|
-
@ctx.abort(@ctx.message(
|
|
15
|
+
@ctx.abort(@ctx.message("create.errors.directory_exists", form.directory_name))
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
if form.type.create(form.directory_name, @ctx)
|
|
18
19
|
ExtensionProject.write_cli_file(context: @ctx, type: form.type.identifier)
|
|
19
|
-
ExtensionProject.write_env_file(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
ExtensionProject.write_env_file(
|
|
21
|
+
context: @ctx,
|
|
22
|
+
title: form.name,
|
|
23
|
+
api_key: form.app.api_key,
|
|
24
|
+
api_secret: form.app.secret
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
@ctx.puts(@ctx.message("create.ready_to_start", form.directory_name, form.name))
|
|
28
|
+
@ctx.puts(@ctx.message("create.learn_more", form.type.name))
|
|
23
29
|
else
|
|
24
|
-
@ctx.puts(@ctx.message(
|
|
30
|
+
@ctx.puts(@ctx.message("create.try_again"))
|
|
25
31
|
end
|
|
26
32
|
end
|
|
27
33
|
end
|
|
@@ -29,10 +35,11 @@ module Extension
|
|
|
29
35
|
def self.help
|
|
30
36
|
<<~HELP
|
|
31
37
|
Create a new app extension.
|
|
32
|
-
Usage: {{command:#{ShopifyCli::TOOL_NAME} create extension
|
|
38
|
+
Usage: {{command:#{ShopifyCli::TOOL_NAME} create extension}}
|
|
33
39
|
Options:
|
|
34
40
|
{{command:--type=TYPE}} The type of extension you would like to create.
|
|
35
|
-
{{command:--name=NAME}} The name of your extension (50 characters)
|
|
41
|
+
{{command:--name=NAME}} The name of your extension (50 characters).
|
|
42
|
+
{{command:--api-key=KEY}} The API key of your app.
|
|
36
43
|
HELP
|
|
37
44
|
end
|
|
38
45
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require
|
|
2
|
+
require "shopify_cli"
|
|
3
3
|
|
|
4
4
|
module Extension
|
|
5
5
|
module Commands
|
|
@@ -8,13 +8,20 @@ module Extension
|
|
|
8
8
|
@project ||= ExtensionProject.current
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
def
|
|
12
|
-
@
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
def specification_handler
|
|
12
|
+
@specification_handler ||= begin
|
|
13
|
+
identifier = project.specification_identifier
|
|
14
|
+
Models::LazySpecificationHandler.new(identifier) do
|
|
15
|
+
specifications = Models::Specifications.new(
|
|
16
|
+
fetch_specifications: Tasks::FetchSpecifications.new(api_key: project.app.api_key, context: @ctx)
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
unless specifications.valid?(identifier)
|
|
20
|
+
@ctx.abort(@ctx.message("errors.unknown_type", project.specification_identifier))
|
|
21
|
+
end
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
specifications[identifier]
|
|
24
|
+
end
|
|
18
25
|
end
|
|
19
26
|
end
|
|
20
27
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require
|
|
2
|
+
require "shopify_cli"
|
|
3
3
|
|
|
4
4
|
module Extension
|
|
5
5
|
module Commands
|
|
@@ -10,7 +10,7 @@ module Extension
|
|
|
10
10
|
Commands::Register.new(@ctx).call(args, name) unless project.registered?
|
|
11
11
|
Commands::Build.new(@ctx).call(args, name)
|
|
12
12
|
|
|
13
|
-
CLI::UI::Frame.open(@ctx.message(
|
|
13
|
+
CLI::UI::Frame.open(@ctx.message("push.frame_title")) do
|
|
14
14
|
updated_draft_version = update_draft
|
|
15
15
|
show_message(updated_draft_version)
|
|
16
16
|
end
|
|
@@ -30,18 +30,18 @@ module Extension
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def output_success_messages(draft)
|
|
33
|
-
@ctx.puts(@ctx.message(
|
|
34
|
-
@ctx.puts(@ctx.message(
|
|
33
|
+
@ctx.puts(@ctx.message("push.success_confirmation", project.title, format_time(draft.last_user_interaction_at)))
|
|
34
|
+
@ctx.puts(@ctx.message("push.success_info", draft.location))
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def output_validation_errors(draft)
|
|
38
|
-
@ctx.puts(@ctx.message(
|
|
38
|
+
@ctx.puts(@ctx.message("push.pushed_with_errors", format_time(draft.last_user_interaction_at)))
|
|
39
39
|
|
|
40
40
|
draft.validation_errors.each do |error|
|
|
41
|
-
@ctx.puts(format(
|
|
41
|
+
@ctx.puts(format("{{x}} %s: %s", error.field.last, error.message))
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
@ctx.puts(@ctx.message(
|
|
44
|
+
@ctx.puts(@ctx.message("push.push_with_errors_info"))
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def format_time(time)
|
|
@@ -49,7 +49,7 @@ module Extension
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def with_waiting_text
|
|
52
|
-
@ctx.puts(@ctx.message(
|
|
52
|
+
@ctx.puts(@ctx.message("push.waiting_text"))
|
|
53
53
|
yield
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -59,8 +59,8 @@ module Extension
|
|
|
59
59
|
context: @ctx,
|
|
60
60
|
api_key: project.app.api_key,
|
|
61
61
|
registration_id: project.registration_id,
|
|
62
|
-
config:
|
|
63
|
-
extension_context:
|
|
62
|
+
config: specification_handler.config(@ctx),
|
|
63
|
+
extension_context: specification_handler.extension_context(@ctx)
|
|
64
64
|
)
|
|
65
65
|
end
|
|
66
66
|
end
|
|
@@ -3,23 +3,17 @@
|
|
|
3
3
|
module Extension
|
|
4
4
|
module Commands
|
|
5
5
|
class Register < ExtensionCommand
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def call(args, _command_name)
|
|
11
|
-
CLI::UI::Frame.open(@ctx.message('register.frame_title')) do
|
|
12
|
-
@ctx.abort(@ctx.message('register.already_registered')) if project.registered?
|
|
6
|
+
def call(_args, _command_name)
|
|
7
|
+
CLI::UI::Frame.open(@ctx.message("register.frame_title")) do
|
|
8
|
+
@ctx.abort(@ctx.message("register.already_registered")) if project.registered?
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
registration = should_continue ? register_extension(form.app) : abort_not_registered
|
|
10
|
+
should_continue = confirm_registration
|
|
11
|
+
registration = should_continue ? register_extension : abort_not_registered
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
update_project_files(registration)
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
end
|
|
15
|
+
@ctx.puts(@ctx.message("register.success", project.title))
|
|
16
|
+
@ctx.puts(@ctx.message("register.success_info"))
|
|
23
17
|
end
|
|
24
18
|
end
|
|
25
19
|
|
|
@@ -27,50 +21,46 @@ module Extension
|
|
|
27
21
|
<<~HELP
|
|
28
22
|
Register your local extension to a Shopify app
|
|
29
23
|
Usage: {{command:#{ShopifyCli::TOOL_NAME} register}}
|
|
30
|
-
Options:
|
|
31
|
-
{{command:--api_key=API_KEY}} The API key used to register an app with the extension. This can be found on the app page on Partners Dashboard.
|
|
32
24
|
HELP
|
|
33
25
|
end
|
|
34
26
|
|
|
35
27
|
private
|
|
36
28
|
|
|
37
|
-
def
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
yield form
|
|
29
|
+
def confirm_registration
|
|
30
|
+
@ctx.puts(@ctx.message("register.confirm_info", specification_handler.name))
|
|
31
|
+
CLI::UI::Prompt.confirm(@ctx.message("register.confirm_question"))
|
|
42
32
|
end
|
|
43
33
|
|
|
44
|
-
def
|
|
45
|
-
@ctx.puts(@ctx.message(
|
|
46
|
-
CLI::UI::Prompt.confirm(@ctx.message('register.confirm_question', app.title))
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def register_extension(app)
|
|
50
|
-
@ctx.puts(@ctx.message('register.waiting_text'))
|
|
34
|
+
def register_extension
|
|
35
|
+
@ctx.puts(@ctx.message("register.waiting_text"))
|
|
51
36
|
|
|
52
37
|
Tasks::CreateExtension.call(
|
|
53
38
|
context: @ctx,
|
|
54
39
|
api_key: app.api_key,
|
|
55
|
-
type:
|
|
40
|
+
type: specification_handler.graphql_identifier,
|
|
56
41
|
title: project.title,
|
|
57
42
|
config: {},
|
|
58
|
-
extension_context:
|
|
43
|
+
extension_context: specification_handler.extension_context(@ctx)
|
|
59
44
|
)
|
|
60
45
|
end
|
|
61
46
|
|
|
62
|
-
def update_project_files(
|
|
47
|
+
def update_project_files(registration)
|
|
63
48
|
ExtensionProject.write_env_file(
|
|
64
49
|
context: @ctx,
|
|
65
50
|
api_key: app.api_key,
|
|
66
51
|
api_secret: app.secret,
|
|
67
52
|
registration_id: registration.id,
|
|
53
|
+
registration_uuid: registration.uuid,
|
|
68
54
|
title: project.title
|
|
69
55
|
)
|
|
70
56
|
end
|
|
71
57
|
|
|
58
|
+
def app
|
|
59
|
+
@app ||= project.app
|
|
60
|
+
end
|
|
61
|
+
|
|
72
62
|
def abort_not_registered
|
|
73
|
-
@ctx.puts(@ctx.message(
|
|
63
|
+
@ctx.puts(@ctx.message("register.confirm_abort"))
|
|
74
64
|
raise ShopifyCli::AbortSilent
|
|
75
65
|
end
|
|
76
66
|
end
|
|
@@ -3,14 +3,8 @@
|
|
|
3
3
|
module Extension
|
|
4
4
|
module Commands
|
|
5
5
|
class Serve < ExtensionCommand
|
|
6
|
-
YARN_SERVE_COMMAND = %w(server)
|
|
7
|
-
NPM_SERVE_COMMAND = %w(run-script server)
|
|
8
|
-
|
|
9
6
|
def call(_args, _command_name)
|
|
10
|
-
|
|
11
|
-
success = ShopifyCli::JsSystem.call(@ctx, yarn: YARN_SERVE_COMMAND, npm: NPM_SERVE_COMMAND)
|
|
12
|
-
@ctx.abort(@ctx.message('serve.serve_failure_message')) unless success
|
|
13
|
-
end
|
|
7
|
+
specification_handler.serve(@ctx)
|
|
14
8
|
end
|
|
15
9
|
|
|
16
10
|
def self.help
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require
|
|
2
|
+
require "shopify_cli"
|
|
3
3
|
|
|
4
4
|
module Extension
|
|
5
5
|
module Commands
|
|
6
6
|
class Tunnel < ExtensionCommand
|
|
7
7
|
options do |parser, flags|
|
|
8
|
-
parser.on(
|
|
8
|
+
parser.on("--port=PORT") { |port| flags[:port] = port }
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
AUTH_SUBCOMMAND =
|
|
12
|
-
START_SUBCOMMAND =
|
|
13
|
-
STOP_SUBCOMMAND =
|
|
14
|
-
STATUS_SUBCOMMAND =
|
|
11
|
+
AUTH_SUBCOMMAND = "auth"
|
|
12
|
+
START_SUBCOMMAND = "start"
|
|
13
|
+
STOP_SUBCOMMAND = "stop"
|
|
14
|
+
STATUS_SUBCOMMAND = "status"
|
|
15
15
|
DEFAULT_PORT = 39351
|
|
16
16
|
|
|
17
17
|
def call(args, _name)
|
|
@@ -27,11 +27,11 @@ module Extension
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def self.help
|
|
30
|
-
ShopifyCli::Context.message(
|
|
30
|
+
ShopifyCli::Context.message("tunnel.help", ShopifyCli::TOOL_NAME)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def self.extended_help
|
|
34
|
-
ShopifyCli::Context.message(
|
|
34
|
+
ShopifyCli::Context.message("tunnel.extended_help", ShopifyCli::TOOL_NAME, DEFAULT_PORT)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
private
|
|
@@ -40,9 +40,9 @@ module Extension
|
|
|
40
40
|
tunnel_url = ShopifyCli::Tunnel.urls.first
|
|
41
41
|
|
|
42
42
|
if tunnel_url.nil?
|
|
43
|
-
@ctx.puts(@ctx.message(
|
|
43
|
+
@ctx.puts(@ctx.message("tunnel.no_tunnel_running"))
|
|
44
44
|
else
|
|
45
|
-
@ctx.puts(@ctx.message(
|
|
45
|
+
@ctx.puts(@ctx.message("tunnel.tunnel_running_at", tunnel_url))
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ module Extension
|
|
|
50
50
|
return DEFAULT_PORT unless options.flags.key?(:port)
|
|
51
51
|
|
|
52
52
|
port = options.flags[:port].to_i
|
|
53
|
-
@ctx.abort(@ctx.message(
|
|
53
|
+
@ctx.abort(@ctx.message("tunnel.invalid_port", options.flags[:port])) unless port > 0
|
|
54
54
|
port
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -58,7 +58,7 @@ module Extension
|
|
|
58
58
|
token = args.shift
|
|
59
59
|
|
|
60
60
|
if token.nil?
|
|
61
|
-
@ctx.puts(@ctx.message(
|
|
61
|
+
@ctx.puts(@ctx.message("tunnel.missing_token"))
|
|
62
62
|
@ctx.puts("#{self.class.help}\n#{self.class.extended_help}")
|
|
63
63
|
else
|
|
64
64
|
ShopifyCli::Tunnel.auth(@ctx, token)
|