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
data/lib/shopify-cli/js_deps.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "shopify_cli"
|
|
2
2
|
|
|
3
3
|
module ShopifyCli
|
|
4
4
|
##
|
|
@@ -37,9 +37,9 @@ module ShopifyCli
|
|
|
37
37
|
# ShopifyCli::JsDeps.new(context).install(true)
|
|
38
38
|
#
|
|
39
39
|
def install(verbose = false)
|
|
40
|
-
title = ctx.message(
|
|
41
|
-
success = ctx.message(
|
|
42
|
-
failure = ctx.message(
|
|
40
|
+
title = ctx.message("core.js_deps.installing", @system.package_manager)
|
|
41
|
+
success = ctx.message("core.js_deps.installed")
|
|
42
|
+
failure = ctx.message("core.js_deps.error.install_error", @system.package_manager)
|
|
43
43
|
|
|
44
44
|
CLI::UI::Frame.open(title, success_text: success, failure_text: failure) do
|
|
45
45
|
@system.call(
|
|
@@ -53,14 +53,14 @@ module ShopifyCli
|
|
|
53
53
|
|
|
54
54
|
def yarn(verbose = false)
|
|
55
55
|
cmd = %w(yarn install)
|
|
56
|
-
cmd <<
|
|
56
|
+
cmd << "--silent" unless verbose
|
|
57
57
|
|
|
58
58
|
run_install_command(cmd)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def npm(verbose = false)
|
|
62
62
|
cmd = %w(npm install --no-audit)
|
|
63
|
-
cmd <<
|
|
63
|
+
cmd << "--quiet" unless verbose
|
|
64
64
|
|
|
65
65
|
run_install_command(cmd)
|
|
66
66
|
end
|
|
@@ -69,7 +69,7 @@ module ShopifyCli
|
|
|
69
69
|
deps = parse_dependencies
|
|
70
70
|
errors = nil
|
|
71
71
|
|
|
72
|
-
spinner_title = ctx.message(
|
|
72
|
+
spinner_title = ctx.message("core.js_deps.installing", @system.package_manager)
|
|
73
73
|
success = CLI::UI::Spinner.spin(spinner_title, auto_debrief: false) do |spinner|
|
|
74
74
|
_, errors, status = CLI::Kit::System.capture3(*cmd, env: @ctx.env, chdir: ctx.root)
|
|
75
75
|
update_spinner_title_and_status(spinner, status, deps)
|
|
@@ -81,19 +81,19 @@ module ShopifyCli
|
|
|
81
81
|
|
|
82
82
|
def update_spinner_title_and_status(spinner, status, deps)
|
|
83
83
|
if status.success?
|
|
84
|
-
spinner.update_title(ctx.message(
|
|
84
|
+
spinner.update_title(ctx.message("core.js_deps.installed", deps.size))
|
|
85
85
|
else
|
|
86
|
-
spinner.update_title(ctx.message(
|
|
86
|
+
spinner.update_title(ctx.message("core.js_deps.error.install_spinner_error", deps.size))
|
|
87
87
|
CLI::UI::Spinner::TASK_FAILED
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def parse_dependencies
|
|
92
|
-
package_json = File.join(ctx.root,
|
|
92
|
+
package_json = File.join(ctx.root, "package.json")
|
|
93
93
|
pkg = begin
|
|
94
94
|
JSON.parse(File.read(package_json))
|
|
95
95
|
rescue Errno::ENOENT, Errno::ENOTDIR
|
|
96
|
-
ctx.abort(ctx.message(
|
|
96
|
+
ctx.abort(ctx.message("core.js_deps.error.missing_package", package_json))
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
%w(dependencies devDependencies).map do |key|
|
|
@@ -101,7 +101,7 @@ module ShopifyCli
|
|
|
101
101
|
end.flatten
|
|
102
102
|
rescue JSON::ParserError
|
|
103
103
|
ctx.puts(
|
|
104
|
-
ctx.message(
|
|
104
|
+
ctx.message("core.js_deps.error.invalid_package", File.read(File.join(path, "package.json"))),
|
|
105
105
|
error: true
|
|
106
106
|
)
|
|
107
107
|
raise ShopifyCli::AbortSilent
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "shopify_cli"
|
|
2
2
|
|
|
3
3
|
module ShopifyCli
|
|
4
4
|
##
|
|
@@ -7,8 +7,8 @@ module ShopifyCli
|
|
|
7
7
|
class JsSystem
|
|
8
8
|
include SmartProperties
|
|
9
9
|
|
|
10
|
-
YARN_CORE_COMMAND =
|
|
11
|
-
NPM_CORE_COMMAND =
|
|
10
|
+
YARN_CORE_COMMAND = "yarn"
|
|
11
|
+
NPM_CORE_COMMAND = "npm"
|
|
12
12
|
|
|
13
13
|
class << self
|
|
14
14
|
##
|
|
@@ -64,8 +64,8 @@ module ShopifyCli
|
|
|
64
64
|
#
|
|
65
65
|
def yarn?
|
|
66
66
|
@has_yarn ||= begin
|
|
67
|
-
cmd_path = @ctx.which(
|
|
68
|
-
File.exist?(File.join(ctx.root,
|
|
67
|
+
cmd_path = @ctx.which("yarn")
|
|
68
|
+
File.exist?(File.join(ctx.root, "yarn.lock")) && !cmd_path.nil?
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require "delegate"
|
|
2
|
+
|
|
3
|
+
module ShopifyCli
|
|
4
|
+
##
|
|
5
|
+
# `LazyDelegator` defers initialization of its underlying delegatee until the
|
|
6
|
+
# latter is accessed for the first time due to a method call that the
|
|
7
|
+
# delegator cannot handle itself:
|
|
8
|
+
#
|
|
9
|
+
# result = LazyDelegator.new do
|
|
10
|
+
# # carry out costly operation ...
|
|
11
|
+
# end
|
|
12
|
+
#
|
|
13
|
+
# result # referencing the object itself does not result in Proc evaluation
|
|
14
|
+
# result.to_h # however, calling a method on it will result in Proc evaluation
|
|
15
|
+
#
|
|
16
|
+
# LazyDelegator lends itself to being subclassed in scenarios where some
|
|
17
|
+
# facts are known and others are costly to compute:
|
|
18
|
+
#
|
|
19
|
+
# class LazySpecificationHandler < ShopifyCli::LazyDelegator
|
|
20
|
+
# attr_reader :identifier
|
|
21
|
+
#
|
|
22
|
+
# def initialize(identifier, &initializer)
|
|
23
|
+
# super(&initializer)
|
|
24
|
+
# @identifier = identifier
|
|
25
|
+
# end
|
|
26
|
+
# end
|
|
27
|
+
#
|
|
28
|
+
# handler = LazySpecificationHandler.new(:product_subscription) do
|
|
29
|
+
# # fetch specification from the Partners Dashboard API ...
|
|
30
|
+
# end
|
|
31
|
+
#
|
|
32
|
+
# # Accessing identifier will not result in Proc evaluation as it is
|
|
33
|
+
# # available as an attribute of the delegator itself
|
|
34
|
+
# handler.identifier # => :product_subscription
|
|
35
|
+
#
|
|
36
|
+
# # Accessing the specification will result in evaluation of the Proc
|
|
37
|
+
# # and in our example in a subsequent network call
|
|
38
|
+
# handler.specification # => <Extension::Models::Specifcation:...>
|
|
39
|
+
#
|
|
40
|
+
class LazyDelegator < SimpleDelegator
|
|
41
|
+
def initialize(&delegatee_initializer)
|
|
42
|
+
super([false, delegatee_initializer])
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
protected
|
|
46
|
+
|
|
47
|
+
def __getobj__(*)
|
|
48
|
+
initialized, value_or_initializer = super
|
|
49
|
+
return value_or_initializer if initialized
|
|
50
|
+
value_or_initializer.call.tap do |value|
|
|
51
|
+
__setobj__([true, value])
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -76,16 +76,6 @@ module ShopifyCli
|
|
|
76
76
|
is_enabled: "{{v}} analytics are currently enabled",
|
|
77
77
|
is_disabled: "{{v}} analytics are currently disabled",
|
|
78
78
|
},
|
|
79
|
-
shopifolk_beta: {
|
|
80
|
-
help: <<~HELP,
|
|
81
|
-
Opt in/out of shopifolk beta
|
|
82
|
-
Usage: {{command:%s config [ analytics ] }}
|
|
83
|
-
HELP
|
|
84
|
-
enabled: "{{v}} shopifolk-beta has been enabled",
|
|
85
|
-
disabled: "{{v}} shopifolk-beta has been disabled",
|
|
86
|
-
is_enabled: "{{v}} shopifolk-beta is currently enabled",
|
|
87
|
-
is_disabled: "{{v}} shopifolk-beta is currently disabled",
|
|
88
|
-
},
|
|
89
79
|
},
|
|
90
80
|
|
|
91
81
|
git: {
|
|
@@ -129,7 +119,7 @@ module ShopifyCli
|
|
|
129
119
|
missing_package: "expected to have a file at: %s",
|
|
130
120
|
invalid_package: "{{info:%s}} was not valid JSON. Fix this then try again",
|
|
131
121
|
install_spinner_error: "Unable to install all %d dependencies",
|
|
132
|
-
install_error:
|
|
122
|
+
install_error: "An error occurred while installing dependencies",
|
|
133
123
|
},
|
|
134
124
|
|
|
135
125
|
installing: "Installing dependencies with %s...",
|
|
@@ -192,8 +182,9 @@ module ShopifyCli
|
|
|
192
182
|
|
|
193
183
|
api: {
|
|
194
184
|
error: {
|
|
195
|
-
internal_server_error:
|
|
185
|
+
internal_server_error: "{{red:{{x}} An unexpected error occurred on Shopify.}}",
|
|
196
186
|
internal_server_error_debug: "\n{{red:Response details:}}\n%s\n\n",
|
|
187
|
+
invalid_url: "Invalid URL: %s",
|
|
197
188
|
},
|
|
198
189
|
},
|
|
199
190
|
|
|
@@ -281,7 +272,7 @@ module ShopifyCli
|
|
|
281
272
|
MESSAGE
|
|
282
273
|
development_store_select: "Which development store would you like to use?",
|
|
283
274
|
app_select: "To which app does this project belong?",
|
|
284
|
-
no_apps:
|
|
275
|
+
no_apps: "You have no apps to connect to, creating a new app.",
|
|
285
276
|
app_name: "App name",
|
|
286
277
|
app_type: {
|
|
287
278
|
select: "What type of app are you building?",
|
|
@@ -329,6 +320,8 @@ module ShopifyCli
|
|
|
329
320
|
url_fetch_failure: "Unable to fetch external url",
|
|
330
321
|
prereq_command_required: "%1$s is required for installing ngrok. Please install %1$s using the appropriate"\
|
|
331
322
|
" package manager for your system.",
|
|
323
|
+
ngrok: "Something went wrong with ngrok installation,"\
|
|
324
|
+
"please make sure %s exists within %s before trying again",
|
|
332
325
|
},
|
|
333
326
|
|
|
334
327
|
not_running: "{{green:x}} ngrok tunnel not running",
|
|
@@ -363,15 +356,15 @@ module ShopifyCli
|
|
|
363
356
|
{{x}} This version of Shopify App CLI is no longer supported. You’ll need to migrate to the new CLI version to continue.
|
|
364
357
|
|
|
365
358
|
Please visit this page for complete instructions:
|
|
366
|
-
{{underline:https://shopify.
|
|
359
|
+
{{underline:https://shopify.dev/tools/cli/troubleshooting#migrate-from-a-legacy-version}}
|
|
367
360
|
|
|
368
361
|
MESSAGE
|
|
369
362
|
|
|
370
363
|
new_version: <<~MESSAGE,
|
|
371
|
-
{{*}} {{yellow:A new version of
|
|
364
|
+
{{*}} {{yellow:A new version of Shopify App CLI is available! You have version %s and the latest version is %s.
|
|
372
365
|
|
|
373
366
|
To upgrade, follow the instructions for the package manager you’re using:
|
|
374
|
-
{{underline:https://shopify.
|
|
367
|
+
{{underline:https://shopify.dev/tools/cli/troubleshooting#upgrade-shopify-app-cli}}}}
|
|
375
368
|
|
|
376
369
|
MESSAGE
|
|
377
370
|
},
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
module ShopifyCli
|
|
2
|
+
##
|
|
3
|
+
# The `MethodObject` mixin can be included in any class that implements `call`
|
|
4
|
+
# to ensure that
|
|
5
|
+
#
|
|
6
|
+
# * `call` will always return a `ShopifyCli::Result` by prepending a module
|
|
7
|
+
# that takes care of the result wrapping and
|
|
8
|
+
# * a `to_proc` method that allows instances of this class to be passed as a
|
|
9
|
+
# block.
|
|
10
|
+
#
|
|
11
|
+
# For convenience, this mixin also adds the corresponding class methods:
|
|
12
|
+
# `call` and `to_proc`. Method and result objects pair nicely as they greatly
|
|
13
|
+
# simplify the creation of complex processing chains:
|
|
14
|
+
#
|
|
15
|
+
# class Serialize
|
|
16
|
+
# include MethodObject
|
|
17
|
+
#
|
|
18
|
+
# def call(attrs)
|
|
19
|
+
# attrs.to_json
|
|
20
|
+
# end
|
|
21
|
+
# end
|
|
22
|
+
#
|
|
23
|
+
# class Deserialize
|
|
24
|
+
# include MethodObject
|
|
25
|
+
#
|
|
26
|
+
# def call(json)
|
|
27
|
+
# JSON.parse(json)
|
|
28
|
+
# end
|
|
29
|
+
# end
|
|
30
|
+
#
|
|
31
|
+
# Serialize
|
|
32
|
+
# .call(firstname: "John", lastname: "Doe")
|
|
33
|
+
# .then(&Deserialize)
|
|
34
|
+
# .map { |attrs| OpenStruct.new(attrs) }
|
|
35
|
+
# .unwrap(nil)
|
|
36
|
+
#
|
|
37
|
+
# While this example is contrived, it still illustrates some key advantages of
|
|
38
|
+
# this programming paradigm:
|
|
39
|
+
#
|
|
40
|
+
# * chaining operations is as simple as repeatedly calling `then` or `map`,
|
|
41
|
+
# * method objects don't have to be manually instantiated but can be
|
|
42
|
+
# constructed using the `&` operator,
|
|
43
|
+
# * error handling is deferred until the result is unwrapped.
|
|
44
|
+
#
|
|
45
|
+
# Please see the section for `ShopifyCli::Result`,
|
|
46
|
+
# `ShopifyCli::Result::Success`, and `ShopifyCli::Result::Failure` for more
|
|
47
|
+
# information on the API of result objects.
|
|
48
|
+
#
|
|
49
|
+
module MethodObject
|
|
50
|
+
module AutoCreateResultObject
|
|
51
|
+
##
|
|
52
|
+
# invokes the original `call` implementation and wraps its return value
|
|
53
|
+
# into a result object.
|
|
54
|
+
#
|
|
55
|
+
def call(*args, **kwargs)
|
|
56
|
+
Result.wrap { super(*args, **kwargs) }.call
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
module ClassMethods
|
|
61
|
+
##
|
|
62
|
+
# creates a new instance and invokes `call`. Any positional argument
|
|
63
|
+
# is forward to `call`. Keyword arguments are either forwarded to the
|
|
64
|
+
# initializer or to `call`. If the keyword argument matches the name of
|
|
65
|
+
# property, it is forwarded to the initializer, otherwise to call.
|
|
66
|
+
#
|
|
67
|
+
def call(*args, **kwargs)
|
|
68
|
+
properties.keys.yield_self do |properties|
|
|
69
|
+
new(**kwargs.slice(*properties))
|
|
70
|
+
.call(*args, **kwargs.slice(*(kwargs.keys - properties)))
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
##
|
|
75
|
+
# returns a proc that invokes `call` with all arguments it receives when
|
|
76
|
+
# called itself.
|
|
77
|
+
#
|
|
78
|
+
def to_proc
|
|
79
|
+
method(:call).to_proc
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
##
|
|
84
|
+
# is invoked when this mixin is included into a class. This results in
|
|
85
|
+
#
|
|
86
|
+
# * including `SmartProperties`,
|
|
87
|
+
# * prepending the result wrapping mechanism, and
|
|
88
|
+
# * adding the class methods `.call` and `.to_proc`.
|
|
89
|
+
#
|
|
90
|
+
def self.included(method_object_implementation)
|
|
91
|
+
method_object_implementation.prepend(AutoCreateResultObject)
|
|
92
|
+
method_object_implementation.include(SmartProperties)
|
|
93
|
+
method_object_implementation.extend(ClassMethods)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
##
|
|
97
|
+
# returns a proc that invokes `call` with all arguments it receives when
|
|
98
|
+
# called itself.
|
|
99
|
+
#
|
|
100
|
+
def to_proc
|
|
101
|
+
method(:call).to_proc
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
data/lib/shopify-cli/oauth.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
9
|
-
require
|
|
1
|
+
require "base64"
|
|
2
|
+
require "digest"
|
|
3
|
+
require "json"
|
|
4
|
+
require "net/http"
|
|
5
|
+
require "securerandom"
|
|
6
|
+
require "openssl"
|
|
7
|
+
require "shopify_cli"
|
|
8
|
+
require "uri"
|
|
9
|
+
require "webrick"
|
|
10
10
|
|
|
11
11
|
module ShopifyCli
|
|
12
12
|
class OAuth
|
|
13
13
|
include SmartProperties
|
|
14
14
|
|
|
15
|
-
autoload :Servlet,
|
|
15
|
+
autoload :Servlet, "shopify-cli/oauth/servlet"
|
|
16
16
|
|
|
17
17
|
class Error < StandardError; end
|
|
18
18
|
LocalRequest = Struct.new(:method, :path, :query, :protocol)
|
|
@@ -54,10 +54,10 @@ module ShopifyCli
|
|
|
54
54
|
@server ||= begin
|
|
55
55
|
server = WEBrick::HTTPServer.new(
|
|
56
56
|
Port: DEFAULT_PORT,
|
|
57
|
-
Logger: WEBrick::Log.new(File.open(File::NULL,
|
|
57
|
+
Logger: WEBrick::Log.new(File.open(File::NULL, "w")),
|
|
58
58
|
AccessLog: [],
|
|
59
59
|
)
|
|
60
|
-
server.mount(
|
|
60
|
+
server.mount("/", Servlet, self, state_token)
|
|
61
61
|
server
|
|
62
62
|
end
|
|
63
63
|
end
|
|
@@ -80,17 +80,17 @@ module ShopifyCli
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def output_authentication_info(uri)
|
|
83
|
-
login_location = ctx.message(service ==
|
|
84
|
-
ctx.puts(ctx.message(
|
|
83
|
+
login_location = ctx.message(service == "admin" ? "core.oauth.location.admin" : "core.oauth.location.partner")
|
|
84
|
+
ctx.puts(ctx.message("core.oauth.authentication_required", login_location))
|
|
85
85
|
ctx.open_url!(uri)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
def receive_access_code
|
|
89
89
|
@access_code ||= begin
|
|
90
90
|
@server_thread.join(240)
|
|
91
|
-
raise Error, ctx.message(
|
|
92
|
-
raise Error, response_query[
|
|
93
|
-
response_query[
|
|
91
|
+
raise Error, ctx.message("core.oauth.error.timeout") if response_query.nil?
|
|
92
|
+
raise Error, response_query["error_description"] unless response_query["error"].nil?
|
|
93
|
+
response_query["code"]
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -105,8 +105,8 @@ module ShopifyCli
|
|
|
105
105
|
}.merge(confirmation_param)
|
|
106
106
|
)
|
|
107
107
|
store.set(
|
|
108
|
-
"#{service}_access_token".to_sym => resp[
|
|
109
|
-
"#{service}_refresh_token".to_sym => resp[
|
|
108
|
+
"#{service}_access_token".to_sym => resp["access_token"],
|
|
109
|
+
"#{service}_refresh_token".to_sym => resp["refresh_token"],
|
|
110
110
|
)
|
|
111
111
|
end
|
|
112
112
|
|
|
@@ -130,8 +130,8 @@ module ShopifyCli
|
|
|
130
130
|
client_id: client_id,
|
|
131
131
|
)
|
|
132
132
|
store.set(
|
|
133
|
-
"#{service}_access_token".to_sym => resp[
|
|
134
|
-
"#{service}_refresh_token".to_sym => resp[
|
|
133
|
+
"#{service}_access_token".to_sym => resp["access_token"],
|
|
134
|
+
"#{service}_refresh_token".to_sym => resp["refresh_token"],
|
|
135
135
|
)
|
|
136
136
|
end
|
|
137
137
|
|
|
@@ -155,7 +155,7 @@ module ShopifyCli
|
|
|
155
155
|
scope: scopes,
|
|
156
156
|
subject_token: store.get("#{service}_access_token".to_sym),
|
|
157
157
|
)
|
|
158
|
-
store.set("#{service}_exchange_token".to_sym => resp[
|
|
158
|
+
store.set("#{service}_exchange_token".to_sym => resp["access_token"])
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
def post_token_request(url, params)
|
|
@@ -163,17 +163,17 @@ module ShopifyCli
|
|
|
163
163
|
https = Net::HTTP.new(uri.host, uri.port)
|
|
164
164
|
https.use_ssl = true
|
|
165
165
|
request = Net::HTTP::Post.new(uri.path)
|
|
166
|
-
request[
|
|
166
|
+
request["User-Agent"] = "Shopify App CLI #{::ShopifyCli::VERSION}"
|
|
167
167
|
request.body = URI.encode_www_form(params)
|
|
168
168
|
res = https.request(request)
|
|
169
|
-
raise Error, JSON.parse(res.body)[
|
|
169
|
+
raise Error, JSON.parse(res.body)["error_description"] unless res.is_a?(Net::HTTPSuccess)
|
|
170
170
|
JSON.parse(res.body)
|
|
171
171
|
end
|
|
172
172
|
|
|
173
173
|
def challange_params
|
|
174
174
|
{
|
|
175
175
|
code_challenge: code_challenge,
|
|
176
|
-
code_challenge_method:
|
|
176
|
+
code_challenge_method: "S256",
|
|
177
177
|
}
|
|
178
178
|
end
|
|
179
179
|
|