shopify-cli 1.5.0 → 1.9.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/PULL_REQUEST_TEMPLATE.md +1 -0
- data/.rubocop_todo.yml +15 -2
- data/.travis.yml +1 -0
- data/CHANGELOG.md +26 -0
- data/Gemfile +12 -12
- data/Gemfile.lock +14 -14
- data/README.md +39 -7
- data/Rakefile +32 -28
- data/bin/load_shopify.rb +6 -6
- data/bin/shopify +2 -2
- data/dev.yml +5 -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 +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 -48
- 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 +123 -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_renderer_package.rb +32 -0
- data/lib/project_types/extension/features/argo_serve.rb +69 -0
- 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 +47 -0
- data/lib/project_types/extension/messages/message_loading.rb +3 -1
- data/lib/project_types/extension/messages/messages.rb +55 -52
- 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 +39 -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 +75 -0
- data/lib/project_types/extension/models/specifications.rb +88 -0
- data/lib/project_types/extension/tasks/configure_features.rb +54 -0
- 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 +18 -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 -19
- data/lib/project_types/node/commands/connect.rb +3 -3
- data/lib/project_types/node/commands/create.rb +42 -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 +3 -34
- 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 +13 -47
- 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 +56 -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 +35 -25
- data/lib/project_types/rails/gem.rb +24 -24
- data/lib/project_types/rails/messages/messages.rb +6 -5
- data/lib/project_types/rails/ruby.rb +2 -2
- data/lib/project_types/script/cli.rb +38 -39
- data/lib/project_types/script/commands/create.rb +12 -14
- data/lib/project_types/script/commands/push.rb +10 -17
- data/lib/project_types/script/config/extension_points.yml +29 -10
- data/lib/project_types/script/errors.rb +1 -2
- data/lib/project_types/script/forms/create.rb +18 -5
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +9 -1
- data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
- data/lib/project_types/script/layers/application/build_script.rb +10 -7
- data/lib/project_types/script/layers/application/create_script.rb +37 -25
- data/lib/project_types/script/layers/application/extension_points.rb +25 -0
- data/lib/project_types/script/layers/application/project_dependencies.rb +4 -4
- data/lib/project_types/script/layers/application/push_script.rb +13 -18
- data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
- data/lib/project_types/script/layers/domain/errors.rb +20 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +82 -11
- data/lib/project_types/script/layers/domain/metadata.rb +48 -0
- data/lib/project_types/script/layers/domain/push_package.rb +25 -6
- data/lib/project_types/script/layers/domain/script_project.rb +34 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +42 -13
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +24 -49
- data/lib/project_types/script/layers/infrastructure/errors.rb +32 -19
- 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 +22 -17
- 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_project_repository.rb +145 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +32 -75
- data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
- data/lib/project_types/script/messages/messages.rb +58 -59
- data/lib/project_types/script/ui/error_handler.rb +115 -72
- 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 +34 -31
- 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 +33 -33
- data/lib/shopify-cli/commands/version.rb +2 -2
- data/lib/shopify-cli/context.rb +71 -22
- 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 -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 +21 -9
- data/lib/shopify-cli/js_deps.rb +12 -12
- 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 +9 -16
- 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 +24 -18
- 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 +4 -4
- 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 +6 -8
- 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 +25 -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 -52
- 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 +83 -35
- 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/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/layers/domain/script.rb +0 -18
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -47
- data/lib/project_types/script/script_project.rb +0 -54
- 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
|
@@ -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,52 @@ 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...",
|
|
33
|
+
no_available_extensions: "{{x}} There are no available extensions for this app.",
|
|
26
34
|
},
|
|
27
35
|
build: {
|
|
28
|
-
frame_title:
|
|
29
|
-
build_failure_message:
|
|
36
|
+
frame_title: "Building extension with: %s...",
|
|
37
|
+
build_failure_message: "Failed to build extension code.",
|
|
30
38
|
},
|
|
31
39
|
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.',
|
|
40
|
+
frame_title: "Registering Extension",
|
|
41
|
+
waiting_text: "Registering with Shopify...",
|
|
42
|
+
already_registered: "Extension is already registered.",
|
|
43
|
+
confirm_info: "This will create a new extension registration for %s, which can’t be undone.",
|
|
44
|
+
confirm_question: "Would you like to register this extension? (y/n)",
|
|
45
|
+
confirm_abort: "Extension was not registered.",
|
|
46
|
+
success: "{{v}} Registered {{green:%s}}.",
|
|
47
|
+
success_info: "{{*}} Run {{command:shopify push}} to push your extension to Shopify.",
|
|
46
48
|
},
|
|
47
49
|
push: {
|
|
48
|
-
frame_title:
|
|
49
|
-
waiting_text:
|
|
50
|
-
pushed_with_errors:
|
|
51
|
-
push_with_errors_info:
|
|
52
|
-
success_confirmation:
|
|
53
|
-
success_info:
|
|
50
|
+
frame_title: "Pushing your extension to Shopify",
|
|
51
|
+
waiting_text: "Pushing code to Shopify...",
|
|
52
|
+
pushed_with_errors: "{{x}} Code pushed to Shopify with errors on %s.",
|
|
53
|
+
push_with_errors_info: "{{*}} Fix these errors and run {{command:shopify push}} to revalidate your extension.",
|
|
54
|
+
success_confirmation: "{{v}} Pushed {{green:%s}} to a draft on %s.",
|
|
55
|
+
success_info: "{{*}} Visit %s to version and publish your extension.",
|
|
54
56
|
},
|
|
55
57
|
serve: {
|
|
56
|
-
frame_title:
|
|
57
|
-
serve_failure_message:
|
|
58
|
+
frame_title: "Serving extension...",
|
|
59
|
+
serve_failure_message: "Failed to run extension code.",
|
|
60
|
+
serve_missing_information: "Missing shop or api_key.",
|
|
58
61
|
},
|
|
59
62
|
tunnel: {
|
|
60
|
-
missing_token:
|
|
61
|
-
|
|
62
|
-
invalid_port:
|
|
63
|
-
no_tunnel_running:
|
|
64
|
-
tunnel_running_at:
|
|
63
|
+
missing_token: "{{x}} {{red:auth requires a token argument}}. "\
|
|
64
|
+
"Find it on your ngrok dashboard: {{underline:https://dashboard.ngrok.com/auth/your-authtoken}}.",
|
|
65
|
+
invalid_port: "%s is not a valid port.",
|
|
66
|
+
no_tunnel_running: "No tunnel running.",
|
|
67
|
+
tunnel_running_at: "Tunnel running at: {{underline:%s}}",
|
|
65
68
|
help: <<~HELP,
|
|
66
69
|
Start or stop an http tunnel to your local development extension using ngrok.
|
|
67
70
|
Usage: {{command:%s tunnel [ auth | start | stop | status ]}}
|
|
@@ -69,7 +72,7 @@ module Extension
|
|
|
69
72
|
extended_help: <<~HELP,
|
|
70
73
|
{{bold:Subcommands:}}
|
|
71
74
|
|
|
72
|
-
{{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account.
|
|
75
|
+
{{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account.
|
|
73
76
|
Visit https://dashboard.ngrok.com/signup to sign up.
|
|
74
77
|
Usage: {{command:%1$s tunnel auth <token>}}
|
|
75
78
|
|
|
@@ -87,48 +90,48 @@ module Extension
|
|
|
87
90
|
},
|
|
88
91
|
features: {
|
|
89
92
|
argo: {
|
|
90
|
-
missing_file_error:
|
|
91
|
-
script_prepare_error:
|
|
92
|
-
initialization_error:
|
|
93
|
+
missing_file_error: "Could not find built extension file.",
|
|
94
|
+
script_prepare_error: "An error occurred while attempting to prepare your script.",
|
|
95
|
+
initialization_error: "{{x}} There was an error while initializing the project.",
|
|
93
96
|
dependencies: {
|
|
94
97
|
node: {
|
|
95
|
-
node_not_installed:
|
|
96
|
-
version_too_low:
|
|
98
|
+
node_not_installed: "Node must be installed to create this extension.",
|
|
99
|
+
version_too_low: "Your node version %s does not meet the minimum required version %s",
|
|
97
100
|
},
|
|
98
|
-
argo_missing_renderer_package_error:
|
|
101
|
+
argo_missing_renderer_package_error: "%s Install the missing package and try again.",
|
|
99
102
|
argo_renderer_package_invalid_version_error: <<~MESSAGE,
|
|
100
103
|
The renderer package version is not a valid SemVer Version (http://semver.org)
|
|
101
104
|
MESSAGE
|
|
102
105
|
yarn_install_error: "Something went wrong while running 'yarn install'. %s.",
|
|
103
|
-
yarn_run_script_error:
|
|
106
|
+
yarn_run_script_error: "Something went wrong while running script. %s.",
|
|
104
107
|
},
|
|
105
108
|
config: {
|
|
106
|
-
unpermitted_keys:
|
|
109
|
+
unpermitted_keys: "`%s` contains the following unpermitted keys: %s",
|
|
107
110
|
},
|
|
108
111
|
},
|
|
109
112
|
},
|
|
110
113
|
tasks: {
|
|
111
114
|
errors: {
|
|
112
|
-
parse_error:
|
|
115
|
+
parse_error: "Unable to parse response from Partners Dashboard.",
|
|
113
116
|
},
|
|
114
117
|
},
|
|
115
118
|
errors: {
|
|
116
|
-
unknown_type:
|
|
119
|
+
unknown_type: "Unknown extension type %s",
|
|
117
120
|
},
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
TYPES = {
|
|
121
124
|
product_subscription: {
|
|
122
|
-
name:
|
|
123
|
-
tagline:
|
|
125
|
+
name: "Product Subscription",
|
|
126
|
+
tagline: "(limit 1 per app)",
|
|
124
127
|
overrides: {
|
|
125
128
|
register: {
|
|
126
|
-
confirm_info:
|
|
129
|
+
confirm_info: "You can only create one %s extension per app, which can’t be undone.",
|
|
127
130
|
},
|
|
128
131
|
},
|
|
129
132
|
},
|
|
130
133
|
checkout_post_purchase: {
|
|
131
|
-
name:
|
|
134
|
+
name: "Checkout Post Purchase",
|
|
132
135
|
},
|
|
133
136
|
}
|
|
134
137
|
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,39 @@
|
|
|
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, converts: :to_str
|
|
11
|
+
property! :renderer_package_name, converts: :to_str
|
|
12
|
+
property! :git_template, converts: :to_str
|
|
13
|
+
property! :required_fields, accepts: Array, default: []
|
|
14
|
+
property! :required_shop_beta_flags, accepts: Array, default: []
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.build(feature_set_attributes)
|
|
18
|
+
feature_set_attributes.each_with_object(OpenStruct.new) do |(identifier, feature_attributes), feature_set|
|
|
19
|
+
feature_set[identifier] = ShopifyCli::ResolveConstant
|
|
20
|
+
.call(identifier, namespace: Features)
|
|
21
|
+
.rescue { OpenStruct }
|
|
22
|
+
.then { |c| c.new(**feature_attributes) }
|
|
23
|
+
.unwrap { |error| raise(error) }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
property! :identifier
|
|
29
|
+
property :name, converts: :to_str
|
|
30
|
+
property :graphql_identifier, converts: :to_str
|
|
31
|
+
property! :features, converts: Features.method(:build), default: -> { [] }
|
|
32
|
+
property! :options, converts: ->(options) { OpenStruct.new(options) }, default: -> { OpenStruct.new }
|
|
33
|
+
|
|
34
|
+
def graphql_identifier
|
|
35
|
+
super || identifier
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
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,75 @@
|
|
|
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") || specification.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
|
+
def serve(context)
|
|
46
|
+
Features::ArgoServe.new(specification_handler: self, context: context).call
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def renderer_package(context)
|
|
50
|
+
argo.renderer_package(context)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
protected
|
|
54
|
+
|
|
55
|
+
def argo
|
|
56
|
+
Features::Argo.new(
|
|
57
|
+
git_template: specification.features.argo.git_template,
|
|
58
|
+
renderer_package_name: specification.features.argo.renderer_package_name,
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def message(key, *params)
|
|
65
|
+
return unless messages.key?(key.to_sym)
|
|
66
|
+
messages[key.to_sym] % params
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def messages
|
|
70
|
+
@messages ||= Messages::TYPES[identifier.downcase.to_sym] || {}
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
def none?
|
|
30
|
+
each.none?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
protected
|
|
34
|
+
|
|
35
|
+
def handlers
|
|
36
|
+
@handlers ||= fetch_specifications_and_build_handlers
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def fetch_specifications_and_build_handlers
|
|
42
|
+
ShopifyCli::Result
|
|
43
|
+
.call(&fetch_specifications)
|
|
44
|
+
.map(&ShopifyCli::TransformDataStructure.new(symbolize_keys: true, underscore_keys: true))
|
|
45
|
+
.then(&method(:select_cli_extensions))
|
|
46
|
+
.then(&Tasks::ConfigureFeatures)
|
|
47
|
+
.then(&method(:ensure_legacy_compatibility))
|
|
48
|
+
.then(&method(:build_specifications))
|
|
49
|
+
.then(&method(:require_handler_implementations))
|
|
50
|
+
.then(&method(:instantiate_specification_handlers))
|
|
51
|
+
.unwrap { |err| raise err }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def require_handler_implementations(specifications)
|
|
55
|
+
specifications.each do |s|
|
|
56
|
+
implementation_file = File.join(custom_handler_root, "#{s.identifier}.rb")
|
|
57
|
+
require(implementation_file) if File.file?(implementation_file)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def instantiate_specification_handlers(specifications)
|
|
62
|
+
specifications.each_with_object({}) do |specification, handlers|
|
|
63
|
+
ShopifyCli::ResolveConstant.call(specification.identifier, namespace: custom_handler_namespace)
|
|
64
|
+
.rescue { |error| error.is_a?(NameError) ? SpecificationHandlers::Default : raise(error) }
|
|
65
|
+
.then { |handler_class| handler_class.new(specification) }
|
|
66
|
+
.unwrap { |error| raise error }
|
|
67
|
+
.yield_self { |handler| handlers[handler.identifier] = handler }
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def ensure_legacy_compatibility(specification_attribute_sets)
|
|
72
|
+
specification_attribute_sets.each do |attributes|
|
|
73
|
+
next unless attributes.fetch(:identifier) == "subscription_management"
|
|
74
|
+
attributes[:identifier] = "product_subscription"
|
|
75
|
+
attributes[:graphql_identifier] = "SUBSCRIPTION_MANAGEMENT"
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def build_specifications(specification_attribute_sets)
|
|
80
|
+
specification_attribute_sets.map { |attributes| Models::Specification.new(**attributes) }
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def select_cli_extensions(specification_attribute_sets)
|
|
84
|
+
specification_attribute_sets.select { |attributes| attributes.dig(:options, :management_experience) == "cli" }
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module Extension
|
|
2
|
+
module Tasks
|
|
3
|
+
class ConfigureFeatures
|
|
4
|
+
include ShopifyCli::MethodObject
|
|
5
|
+
|
|
6
|
+
class Error < RuntimeError; end
|
|
7
|
+
class UnknownSurfaceArea < Error; end
|
|
8
|
+
class UnspecifiedSurfaceArea < Error; end
|
|
9
|
+
|
|
10
|
+
def call(specification_attribute_sets)
|
|
11
|
+
specification_attribute_sets.each do |attributes|
|
|
12
|
+
argo_configuration = extract_argo_configuration(attributes)
|
|
13
|
+
next if argo_configuration.nil?
|
|
14
|
+
surface_area = extract_surface_area(argo_configuration)
|
|
15
|
+
surface_area_configuration = fetch_surface_area_configuration(surface_area)
|
|
16
|
+
argo_configuration.merge!(surface_area_configuration)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def extract_argo_configuration(attributes)
|
|
23
|
+
attributes.dig(:features, :argo)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def extract_surface_area(argo_configuration)
|
|
27
|
+
argo_configuration.fetch(:surface) do
|
|
28
|
+
raise UnspecifiedSurfaceArea, "Argo configuration does not specify surface area"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def fetch_surface_area_configuration(surface_area)
|
|
33
|
+
surface_area_configurations.fetch(surface_area.to_sym) do
|
|
34
|
+
raise UnknownSurfaceArea, "Unknown surface area: #{surface_area}"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def surface_area_configurations
|
|
39
|
+
{
|
|
40
|
+
admin: {
|
|
41
|
+
git_template: "https://github.com/Shopify/argo-admin-template.git",
|
|
42
|
+
renderer_package_name: "@shopify/argo-admin",
|
|
43
|
+
required_fields: [:shop, :api_key],
|
|
44
|
+
required_shop_beta_flags: [:argo_admin_beta],
|
|
45
|
+
},
|
|
46
|
+
checkout: {
|
|
47
|
+
git_template: "https://github.com/Shopify/argo-checkout-template.git",
|
|
48
|
+
renderer_package_name: "@shopify/argo-checkout",
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|