shopify-cli 1.3.1 → 1.7.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.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +2 -2
- data/.github/CONTRIBUTING.md +9 -1
- data/.github/PULL_REQUEST_TEMPLATE.md +10 -1
- data/.github/workflows/release.yml +61 -0
- data/.github/workflows/triage.yml +22 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +61 -8
- data/.rubocop_todo.yml +11 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +30 -0
- data/Gemfile +12 -11
- data/Gemfile.lock +39 -37
- data/README.md +39 -7
- data/RELEASING.md +19 -29
- data/Rakefile +32 -28
- data/bin/load_shopify.rb +6 -6
- data/bin/shopify +2 -2
- data/dev.yml +2 -2
- data/docs/_config.yml +1 -18
- data/docs/app/node/commands/index.md +2 -80
- data/docs/app/node/index.md +2 -33
- data/docs/app/rails/commands/index.md +2 -78
- data/docs/app/rails/index.md +2 -34
- data/docs/core/index.md +2 -84
- data/docs/getting-started/index.md +2 -25
- data/docs/getting-started/install/index.md +1 -118
- data/docs/getting-started/migrate/index.md +2 -94
- data/docs/getting-started/uninstall/index.md +2 -35
- data/docs/getting-started/upgrade/index.md +2 -39
- data/docs/help/start-app/index.md +2 -4
- data/docs/index.md +2 -24
- data/ext/shopify-cli/extconf.rb +7 -7
- data/install.sh +1 -1
- data/lib/docgen/markdown.rb +11 -11
- data/lib/{project_types/extension/graphql → graphql}/get_app_by_api_key.graphql +0 -0
- data/lib/project_types/extension/cli.rb +64 -47
- data/lib/project_types/extension/commands/build.rb +3 -3
- data/lib/project_types/extension/commands/create.rb +16 -9
- data/lib/project_types/extension/commands/extension_command.rb +8 -5
- data/lib/project_types/extension/commands/push.rb +8 -8
- data/lib/project_types/extension/commands/register.rb +19 -30
- data/lib/project_types/extension/commands/serve.rb +2 -2
- data/lib/project_types/extension/commands/tunnel.rb +12 -12
- data/lib/project_types/extension/extension_project.rb +4 -4
- data/lib/project_types/extension/extension_project_keys.rb +4 -4
- data/lib/project_types/extension/features/argo.rb +117 -0
- 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_setup.rb +2 -2
- 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 +36 -0
- data/lib/project_types/extension/messages/messages.rb +53 -52
- data/lib/project_types/extension/models/lazy_specification_handler.rb +12 -0
- data/lib/project_types/extension/models/specification.rb +35 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
- data/lib/project_types/extension/models/specifications.rb +77 -0
- data/lib/project_types/extension/tasks/configure_features.rb +52 -0
- data/lib/project_types/extension/tasks/converters/app_converter.rb +6 -6
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +6 -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 +38 -0
- 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 -16
- data/lib/project_types/node/commands/connect.rb +15 -0
- data/lib/project_types/node/commands/create.rb +46 -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 +9 -18
- 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 +7 -7
- data/lib/project_types/node/messages/messages.rb +19 -53
- data/lib/project_types/rails/cli.rb +21 -18
- data/lib/project_types/rails/commands/connect.rb +15 -0
- data/lib/project_types/rails/commands/create.rb +60 -54
- 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 +24 -24
- data/lib/project_types/rails/gem.rb +24 -24
- data/lib/project_types/rails/messages/messages.rb +12 -9
- data/lib/project_types/rails/ruby.rb +2 -2
- data/lib/project_types/script/cli.rb +42 -38
- data/lib/project_types/script/commands/create.rb +13 -10
- data/lib/project_types/script/commands/disable.rb +3 -3
- data/lib/project_types/script/commands/enable.rb +19 -9
- data/lib/project_types/script/commands/push.rb +10 -17
- data/lib/project_types/script/config/extension_points.yml +17 -12
- data/lib/project_types/script/errors.rb +38 -0
- data/lib/project_types/script/forms/create.rb +29 -5
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +12 -1
- data/lib/project_types/script/layers/application/build_script.rb +18 -19
- data/lib/project_types/script/layers/application/create_script.rb +13 -11
- data/lib/project_types/script/layers/application/disable_script.rb +2 -2
- data/lib/project_types/script/layers/application/enable_script.rb +2 -2
- data/lib/project_types/script/layers/application/extension_points.rb +24 -0
- data/lib/project_types/script/layers/application/project_dependencies.rb +4 -4
- data/lib/project_types/script/layers/application/push_script.rb +12 -18
- data/lib/project_types/script/layers/domain/errors.rb +7 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +62 -7
- data/lib/project_types/script/layers/domain/metadata.rb +55 -0
- data/lib/project_types/script/layers/domain/push_package.rb +29 -6
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +19 -54
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +49 -18
- data/lib/project_types/script/layers/infrastructure/errors.rb +17 -1
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +12 -6
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +20 -13
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +26 -16
- data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
- data/lib/project_types/script/messages/messages.rb +67 -10
- data/lib/project_types/script/script_project.rb +47 -16
- data/lib/project_types/script/ui/error_handler.rb +115 -45
- 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 +40 -0
- data/lib/project_types/theme/commands/connect.rb +54 -0
- data/lib/project_types/theme/commands/create.rb +48 -0
- data/lib/project_types/theme/commands/deploy.rb +38 -0
- data/lib/project_types/theme/commands/generate.rb +20 -0
- data/lib/project_types/theme/commands/generate/env.rb +79 -0
- data/lib/project_types/theme/commands/push.rb +55 -0
- data/lib/project_types/theme/commands/serve.rb +31 -0
- data/lib/project_types/theme/forms/connect.rb +34 -0
- data/lib/project_types/theme/forms/create.rb +22 -0
- data/lib/project_types/theme/messages/messages.rb +147 -0
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
- data/lib/project_types/theme/themekit.rb +113 -0
- data/lib/rubygems_plugin.rb +3 -3
- data/lib/shopify-cli/admin_api.rb +52 -12
- 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 +38 -37
- data/lib/shopify-cli/command.rb +1 -1
- data/lib/shopify-cli/commands.rb +9 -9
- data/lib/shopify-cli/commands/config.rb +28 -28
- data/lib/shopify-cli/commands/connect.rb +35 -18
- 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 +40 -31
- data/lib/shopify-cli/commands/version.rb +2 -2
- data/lib/shopify-cli/context.rb +43 -22
- data/lib/shopify-cli/core.rb +4 -4
- data/lib/shopify-cli/core/entry_point.rb +6 -6
- 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 +21 -19
- data/lib/shopify-cli/db.rb +2 -2
- data/lib/shopify-cli/feature.rb +1 -3
- 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 +27 -0
- data/lib/shopify-cli/js_deps.rb +13 -13
- data/lib/shopify-cli/js_system.rb +5 -5
- data/lib/shopify-cli/lazy_delegator.rb +55 -0
- data/lib/shopify-cli/messages/messages.rb +24 -10
- data/lib/shopify-cli/method_object.rb +104 -0
- data/lib/shopify-cli/oauth.rb +25 -25
- data/lib/shopify-cli/oauth/servlet.rb +9 -9
- data/lib/shopify-cli/options.rb +3 -3
- data/lib/shopify-cli/packager.rb +24 -24
- data/lib/shopify-cli/partners_api.rb +38 -16
- data/lib/shopify-cli/partners_api/organizations.rb +10 -10
- data/lib/shopify-cli/process_supervision.rb +8 -8
- data/lib/shopify-cli/project.rb +27 -23
- data/lib/shopify-cli/project_type.rb +21 -5
- data/lib/shopify-cli/resolve_constant.rb +25 -0
- data/lib/shopify-cli/resources.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +9 -9
- data/lib/shopify-cli/result.rb +432 -0
- data/lib/shopify-cli/shopifolk.rb +84 -0
- data/lib/shopify-cli/sub_command.rb +1 -1
- data/lib/shopify-cli/task.rb +9 -1
- data/lib/shopify-cli/tasks.rb +7 -7
- data/lib/shopify-cli/tasks/create_api_client.rb +17 -6
- data/lib/shopify-cli/tasks/ensure_dev_store.rb +11 -11
- data/lib/shopify-cli/tasks/ensure_env.rb +18 -15
- data/lib/shopify-cli/tasks/ensure_loopback_url.rb +4 -4
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +29 -24
- 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 +36 -30
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +57 -51
- data/shopify-cli.gemspec +6 -6
- data/shopify.fish +1 -1
- data/shopify.sh +1 -1
- data/vendor/deps/cli-kit/REVISION +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
- data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
- data/vendor/deps/webrick/.gitignore +9 -0
- data/vendor/deps/webrick/Gemfile +3 -0
- data/vendor/deps/webrick/LICENSE.txt +22 -0
- data/vendor/deps/webrick/README.md +61 -0
- data/vendor/deps/webrick/Rakefile +10 -0
- data/vendor/deps/webrick/lib/webrick.rb +232 -0
- data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
- data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
- data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
- data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
- data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
- data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
- data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
- data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
- data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
- data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
- data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
- data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
- data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
- data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
- data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
- data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
- data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
- data/vendor/deps/webrick/webrick.gemspec +74 -0
- data/vendor/gen/template/bin/update-deps +9 -9
- metadata +84 -29
- data/docs/Gemfile +0 -5
- data/docs/Gemfile.lock +0 -258
- data/docs/_data/nav.yml +0 -35
- data/docs/_includes/footer.html +0 -15
- data/docs/_includes/head.html +0 -19
- data/docs/_includes/sidebar_nav.html +0 -22
- data/docs/_includes/toc.html +0 -112
- data/docs/_layouts/default.html +0 -79
- data/docs/css/docs.css +0 -157
- data/docs/images/header.png +0 -0
- data/docs/installing-ruby.md +0 -28
- data/lib/project_types/extension/features/argo/admin.rb +0 -20
- data/lib/project_types/extension/features/argo/base.rb +0 -129
- data/lib/project_types/extension/features/argo/checkout.rb +0 -20
- data/lib/project_types/extension/forms/register.rb +0 -47
- data/lib/project_types/extension/models/type.rb +0 -81
- data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
- data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
- data/lib/project_types/node/commands/generate/billing.rb +0 -39
- data/lib/project_types/node/commands/generate/page.rb +0 -59
- data/lib/project_types/node/commands/generate/webhook.rb +0 -37
- data/lib/project_types/script/layers/domain/script.rb +0 -18
- data/lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb +0 -38
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -59
- data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
- data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Extension
|
|
2
|
+
module Forms
|
|
3
|
+
module Questions
|
|
4
|
+
class AskName
|
|
5
|
+
include ShopifyCli::MethodObject
|
|
6
|
+
|
|
7
|
+
property! :ctx
|
|
8
|
+
property :name
|
|
9
|
+
property :prompt,
|
|
10
|
+
accepts: ->(prompt) { prompt.respond_to?(:call) },
|
|
11
|
+
default: -> { CLI::UI::Prompt.method(:ask) }
|
|
12
|
+
|
|
13
|
+
def call(project_details)
|
|
14
|
+
project_details.name = ask_with_reprompt(
|
|
15
|
+
initial_value: name,
|
|
16
|
+
break_condition: -> (current_name) { Models::Registration.valid_title?(current_name) },
|
|
17
|
+
prompt_message: ctx.message("create.ask_name"),
|
|
18
|
+
reprompt_message: ctx.message("create.invalid_name", Models::Registration::MAX_TITLE_LENGTH)
|
|
19
|
+
)
|
|
20
|
+
project_details
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def ask_with_reprompt(initial_value:, break_condition:, prompt_message:, reprompt_message:)
|
|
26
|
+
value = initial_value
|
|
27
|
+
reprompt = false
|
|
28
|
+
|
|
29
|
+
until break_condition.call(value)
|
|
30
|
+
ctx.puts(reprompt_message) if reprompt
|
|
31
|
+
value = prompt.call(prompt_message)&.strip
|
|
32
|
+
reprompt = true
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Extension
|
|
2
|
+
module Forms
|
|
3
|
+
module Questions
|
|
4
|
+
class AskType
|
|
5
|
+
include ShopifyCli::MethodObject
|
|
6
|
+
|
|
7
|
+
property! :ctx
|
|
8
|
+
property :type
|
|
9
|
+
property :prompt,
|
|
10
|
+
converts: :to_proc,
|
|
11
|
+
default: -> { CLI::UI::Prompt.method(:ask) }
|
|
12
|
+
|
|
13
|
+
def call(project_details)
|
|
14
|
+
project_details.tap do |p|
|
|
15
|
+
p.type = type.nil? ? choose_type : validate_given_type(type)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def validate_given_type(type)
|
|
22
|
+
return Extension.specifications[type] if Extension.specifications.valid?(type)
|
|
23
|
+
ctx.abort(ctx.message("create.invalid_type")) unless type.nil?
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def choose_type
|
|
27
|
+
prompt.call(ctx.message("create.ask_type")) do |handler|
|
|
28
|
+
Extension.specifications.each do |type|
|
|
29
|
+
handler.option("#{type.name} #{type.tagline}") { type }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require
|
|
2
|
+
require "shopify_cli"
|
|
3
3
|
|
|
4
4
|
module Extension
|
|
5
5
|
module Messages
|
|
6
6
|
MESSAGES = {
|
|
7
7
|
create: {
|
|
8
|
-
ask_name:
|
|
9
|
-
invalid_name:
|
|
10
|
-
ask_type:
|
|
11
|
-
invalid_type:
|
|
12
|
-
setup_project_frame_title:
|
|
8
|
+
ask_name: "Extension name",
|
|
9
|
+
invalid_name: "Extension name must be under %s characters",
|
|
10
|
+
ask_type: "What type of extension are you creating?",
|
|
11
|
+
invalid_type: "Extension type is invalid.",
|
|
12
|
+
setup_project_frame_title: "Initializing project",
|
|
13
13
|
ready_to_start: <<~MESSAGE,
|
|
14
14
|
{{v}} A new folder was generated at {{green:./%s}}.
|
|
15
15
|
{{*}} You’re ready to start building {{green:%s}}!
|
|
@@ -19,49 +19,50 @@ module Extension
|
|
|
19
19
|
{{*}} Once you're ready to version and publish your extension,
|
|
20
20
|
run {{command:shopify register}} to register this extension with one of your apps.
|
|
21
21
|
MESSAGE
|
|
22
|
-
try_again:
|
|
22
|
+
try_again: "{{*}} Fix the errors and run {{command:shopify create extension}} again.",
|
|
23
23
|
errors: {
|
|
24
|
-
directory_exists:
|
|
24
|
+
directory_exists: "Directory ‘%s’ already exists. Please remove it or choose a new name for your project.",
|
|
25
25
|
},
|
|
26
|
+
incomplete_configuration: "Cannot create extension due to missing configuration information",
|
|
27
|
+
invalid_api_key: "The API key %s does not match any of your apps.",
|
|
28
|
+
ask_app: "Which app would you like to register this extension with?",
|
|
29
|
+
no_apps: "{{x}} You don’t have any apps.",
|
|
30
|
+
learn_about_apps: "{{*}} Learn more about building apps at <https://shopify.dev/concepts/apps>, " \
|
|
31
|
+
"or try creating a new app using {{command:shopify create}}.",
|
|
32
|
+
loading_apps: "Loading your apps...",
|
|
26
33
|
},
|
|
27
34
|
build: {
|
|
28
|
-
frame_title:
|
|
29
|
-
build_failure_message:
|
|
35
|
+
frame_title: "Building extension with: %s...",
|
|
36
|
+
build_failure_message: "Failed to build extension code.",
|
|
30
37
|
},
|
|
31
38
|
register: {
|
|
32
|
-
frame_title:
|
|
33
|
-
waiting_text:
|
|
34
|
-
already_registered:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
invalid_api_key: 'The API key %s does not match any of your apps.',
|
|
41
|
-
confirm_info: 'This will create a new extension registration for %s, which can’t be undone.',
|
|
42
|
-
confirm_question: 'Would you like to register this extension with {{green:%s}}? (y/n)',
|
|
43
|
-
confirm_abort: 'Extension was not registered.',
|
|
44
|
-
success: '{{v}} Registered {{green:%s}} with {{green:%s}}.',
|
|
45
|
-
success_info: '{{*}} Run {{command:shopify push}} to push your extension to Shopify.',
|
|
39
|
+
frame_title: "Registering Extension",
|
|
40
|
+
waiting_text: "Registering with Shopify...",
|
|
41
|
+
already_registered: "Extension is already registered.",
|
|
42
|
+
confirm_info: "This will create a new extension registration for %s, which can’t be undone.",
|
|
43
|
+
confirm_question: "Would you like to register this extension with {{green:%s}}? (y/n)",
|
|
44
|
+
confirm_abort: "Extension was not registered.",
|
|
45
|
+
success: "{{v}} Registered {{green:%s}} with {{green:%s}}.",
|
|
46
|
+
success_info: "{{*}} Run {{command:shopify push}} to push your extension to Shopify.",
|
|
46
47
|
},
|
|
47
48
|
push: {
|
|
48
|
-
frame_title:
|
|
49
|
-
waiting_text:
|
|
50
|
-
pushed_with_errors:
|
|
51
|
-
push_with_errors_info:
|
|
52
|
-
success_confirmation:
|
|
53
|
-
success_info:
|
|
49
|
+
frame_title: "Pushing your extension to Shopify",
|
|
50
|
+
waiting_text: "Pushing code to Shopify...",
|
|
51
|
+
pushed_with_errors: "{{x}} Code pushed to Shopify with errors on %s.",
|
|
52
|
+
push_with_errors_info: "{{*}} Fix these errors and run {{command:shopify push}} to revalidate your extension.",
|
|
53
|
+
success_confirmation: "{{v}} Pushed {{green:%s}} to a draft on %s.",
|
|
54
|
+
success_info: "{{*}} Visit %s to version and publish your extension.",
|
|
54
55
|
},
|
|
55
56
|
serve: {
|
|
56
|
-
frame_title:
|
|
57
|
-
serve_failure_message:
|
|
57
|
+
frame_title: "Serving extension...",
|
|
58
|
+
serve_failure_message: "Failed to run extension code.",
|
|
58
59
|
},
|
|
59
60
|
tunnel: {
|
|
60
|
-
missing_token:
|
|
61
|
-
|
|
62
|
-
invalid_port:
|
|
63
|
-
no_tunnel_running:
|
|
64
|
-
tunnel_running_at:
|
|
61
|
+
missing_token: "{{x}} {{red:auth requires a token argument}}. "\
|
|
62
|
+
"Find it on your ngrok dashboard: {{underline:https://dashboard.ngrok.com/auth/your-authtoken}}.",
|
|
63
|
+
invalid_port: "%s is not a valid port.",
|
|
64
|
+
no_tunnel_running: "No tunnel running.",
|
|
65
|
+
tunnel_running_at: "Tunnel running at: {{underline:%s}}",
|
|
65
66
|
help: <<~HELP,
|
|
66
67
|
Start or stop an http tunnel to your local development extension using ngrok.
|
|
67
68
|
Usage: {{command:%s tunnel [ auth | start | stop | status ]}}
|
|
@@ -69,7 +70,7 @@ module Extension
|
|
|
69
70
|
extended_help: <<~HELP,
|
|
70
71
|
{{bold:Subcommands:}}
|
|
71
72
|
|
|
72
|
-
{{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account.
|
|
73
|
+
{{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account.
|
|
73
74
|
Visit https://dashboard.ngrok.com/signup to sign up.
|
|
74
75
|
Usage: {{command:%1$s tunnel auth <token>}}
|
|
75
76
|
|
|
@@ -87,48 +88,48 @@ module Extension
|
|
|
87
88
|
},
|
|
88
89
|
features: {
|
|
89
90
|
argo: {
|
|
90
|
-
missing_file_error:
|
|
91
|
-
script_prepare_error:
|
|
92
|
-
initialization_error:
|
|
91
|
+
missing_file_error: "Could not find built extension file.",
|
|
92
|
+
script_prepare_error: "An error occurred while attempting to prepare your script.",
|
|
93
|
+
initialization_error: "{{x}} There was an error while initializing the project.",
|
|
93
94
|
dependencies: {
|
|
94
95
|
node: {
|
|
95
|
-
node_not_installed:
|
|
96
|
-
version_too_low:
|
|
96
|
+
node_not_installed: "Node must be installed to create this extension.",
|
|
97
|
+
version_too_low: "Your node version %s does not meet the minimum required version %s",
|
|
97
98
|
},
|
|
98
|
-
argo_missing_renderer_package_error:
|
|
99
|
+
argo_missing_renderer_package_error: "%s Install the missing package and try again.",
|
|
99
100
|
argo_renderer_package_invalid_version_error: <<~MESSAGE,
|
|
100
101
|
The renderer package version is not a valid SemVer Version (http://semver.org)
|
|
101
102
|
MESSAGE
|
|
102
103
|
yarn_install_error: "Something went wrong while running 'yarn install'. %s.",
|
|
103
|
-
yarn_run_script_error:
|
|
104
|
+
yarn_run_script_error: "Something went wrong while running script. %s.",
|
|
104
105
|
},
|
|
105
106
|
config: {
|
|
106
|
-
unpermitted_keys:
|
|
107
|
+
unpermitted_keys: "`%s` contains the following unpermitted keys: %s",
|
|
107
108
|
},
|
|
108
109
|
},
|
|
109
110
|
},
|
|
110
111
|
tasks: {
|
|
111
112
|
errors: {
|
|
112
|
-
parse_error:
|
|
113
|
+
parse_error: "Unable to parse response from Partners Dashboard.",
|
|
113
114
|
},
|
|
114
115
|
},
|
|
115
116
|
errors: {
|
|
116
|
-
unknown_type:
|
|
117
|
+
unknown_type: "Unknown extension type %s",
|
|
117
118
|
},
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
TYPES = {
|
|
121
122
|
product_subscription: {
|
|
122
|
-
name:
|
|
123
|
-
tagline:
|
|
123
|
+
name: "Product Subscription",
|
|
124
|
+
tagline: "(limit 1 per app)",
|
|
124
125
|
overrides: {
|
|
125
126
|
register: {
|
|
126
|
-
confirm_info:
|
|
127
|
+
confirm_info: "You can only create one %s extension per app, which can’t be undone.",
|
|
127
128
|
},
|
|
128
129
|
},
|
|
129
130
|
},
|
|
130
131
|
checkout_post_purchase: {
|
|
131
|
-
name:
|
|
132
|
+
name: "Checkout Post Purchase",
|
|
132
133
|
},
|
|
133
134
|
}
|
|
134
135
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Extension
|
|
2
|
+
module Models
|
|
3
|
+
class LazySpecificationHandler < ShopifyCli::LazyDelegator
|
|
4
|
+
attr_reader :identifier
|
|
5
|
+
|
|
6
|
+
def initialize(identifier, &specification_handler_initializer)
|
|
7
|
+
super(&specification_handler_initializer)
|
|
8
|
+
@identifier = identifier
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Extension
|
|
2
|
+
module Models
|
|
3
|
+
class Specification
|
|
4
|
+
include SmartProperties
|
|
5
|
+
|
|
6
|
+
module Features
|
|
7
|
+
class Argo
|
|
8
|
+
include SmartProperties
|
|
9
|
+
|
|
10
|
+
property! :surface_area, converts: :to_str
|
|
11
|
+
property! :renderer_package_name, converts: :to_str
|
|
12
|
+
property! :git_template, converts: :to_str
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.build(feature_set_attributes)
|
|
16
|
+
feature_set_attributes.each_with_object(OpenStruct.new) do |(identifier, feature_attributes), feature_set|
|
|
17
|
+
feature_set[identifier] = ShopifyCli::ResolveConstant
|
|
18
|
+
.call(identifier, namespace: Features)
|
|
19
|
+
.rescue { OpenStruct }
|
|
20
|
+
.then { |c| c.new(**feature_attributes) }
|
|
21
|
+
.unwrap { |error| raise error }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
property! :identifier
|
|
27
|
+
property :graphql_identifier, converts: :to_str
|
|
28
|
+
property! :features, converts: Features.method(:build), default: -> { [] }
|
|
29
|
+
|
|
30
|
+
def graphql_identifier
|
|
31
|
+
super || identifier
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "base64"
|
|
3
|
+
|
|
4
|
+
module Extension
|
|
5
|
+
module Models
|
|
6
|
+
module SpecificationHandlers
|
|
7
|
+
class CheckoutPostPurchase < Default
|
|
8
|
+
PERMITTED_CONFIG_KEYS = [:metafields]
|
|
9
|
+
|
|
10
|
+
def config(context)
|
|
11
|
+
{
|
|
12
|
+
**Features::ArgoConfig.parse_yaml(context, PERMITTED_CONFIG_KEYS),
|
|
13
|
+
**argo.config(context),
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Extension
|
|
4
|
+
module Models
|
|
5
|
+
module SpecificationHandlers
|
|
6
|
+
class Default
|
|
7
|
+
attr_reader :specification
|
|
8
|
+
|
|
9
|
+
def initialize(specification)
|
|
10
|
+
@specification = specification
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def identifier
|
|
14
|
+
specification.identifier.to_s.upcase
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def graphql_identifier
|
|
18
|
+
specification.graphql_identifier.to_s.upcase
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def name
|
|
22
|
+
message("name")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def tagline
|
|
26
|
+
message("tagline") || ""
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def config(context)
|
|
30
|
+
argo.config(context)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def create(directory_name, context)
|
|
34
|
+
argo.create(directory_name, identifier, context)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def extension_context(_context)
|
|
38
|
+
nil
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def valid_extension_contexts
|
|
42
|
+
[]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
protected
|
|
46
|
+
|
|
47
|
+
def argo
|
|
48
|
+
Features::Argo.new(
|
|
49
|
+
git_template: specification.features.argo.git_template,
|
|
50
|
+
renderer_package_name: specification.features.argo.renderer_package_name,
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def message(key, *params)
|
|
57
|
+
return unless messages.key?(key.to_sym)
|
|
58
|
+
messages[key.to_sym] % params
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def messages
|
|
62
|
+
@messages ||= Messages::TYPES[identifier.downcase.to_sym] || {}
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
module Extension
|
|
2
|
+
module Models
|
|
3
|
+
class Specifications
|
|
4
|
+
include SmartProperties
|
|
5
|
+
|
|
6
|
+
property! :custom_handler_root,
|
|
7
|
+
accepts: ->(d) { File.directory?(d) },
|
|
8
|
+
default: -> { File.expand_path("lib/project_types/extension/models/specification_handlers", ShopifyCli::ROOT) }
|
|
9
|
+
|
|
10
|
+
property! :custom_handler_namespace,
|
|
11
|
+
accepts: ->(m) { m.respond_to?(:const_get) },
|
|
12
|
+
default: -> { ::Extension::Models::SpecificationHandlers }
|
|
13
|
+
|
|
14
|
+
property! :fetch_specifications,
|
|
15
|
+
accepts: ->(p) { p.respond_to?(:to_proc) }
|
|
16
|
+
|
|
17
|
+
def [](identifier)
|
|
18
|
+
handlers[identifier]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def valid?(identifier)
|
|
22
|
+
handlers.key?(identifier)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def each(&block)
|
|
26
|
+
handlers.values.each(&block)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
protected
|
|
30
|
+
|
|
31
|
+
def handlers
|
|
32
|
+
@handlers ||= fetch_specifications_and_build_handlers
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def fetch_specifications_and_build_handlers
|
|
38
|
+
ShopifyCli::Result
|
|
39
|
+
.call(&fetch_specifications)
|
|
40
|
+
.then(&Tasks::ConfigureFeatures)
|
|
41
|
+
.then(&method(:ensure_legacy_compatibility))
|
|
42
|
+
.then(&method(:build_specifications))
|
|
43
|
+
.then(&method(:require_handler_implementations))
|
|
44
|
+
.then(&method(:instantiate_specification_handlers))
|
|
45
|
+
.unwrap { |err| raise err }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def require_handler_implementations(specifications)
|
|
49
|
+
specifications.each do |s|
|
|
50
|
+
implementation_file = File.join(custom_handler_root, "#{s.identifier}.rb")
|
|
51
|
+
require(implementation_file) if File.file?(implementation_file)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def instantiate_specification_handlers(specifications)
|
|
56
|
+
specifications.each_with_object({}) do |specification, handlers|
|
|
57
|
+
ShopifyCli::ResolveConstant.call(specification.identifier, namespace: custom_handler_namespace)
|
|
58
|
+
.rescue { |error| error.is_a?(NameError) ? SpecificationHandlers::Default : raise(error) }
|
|
59
|
+
.then { |handler_class| handler_class.new(specification) }
|
|
60
|
+
.unwrap { |error| raise error }
|
|
61
|
+
.yield_self { |handler| handlers[handler.identifier] = handler }
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def ensure_legacy_compatibility(specification_attribute_sets)
|
|
66
|
+
specification_attribute_sets.each do |attributes|
|
|
67
|
+
next unless attributes.fetch(:identifier) == "product_subscription"
|
|
68
|
+
attributes[:graphql_identifier] = "SUBSCRIPTION_MANAGEMENT"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def build_specifications(specification_attribute_sets)
|
|
73
|
+
specification_attribute_sets.map { |attributes| Models::Specification.new(**attributes) }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|