@shopify/cli-kit 3.45.1 → 3.46.0-pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/cli-ruby/Gemfile +0 -1
- package/assets/cli-ruby/Rakefile +0 -76
- package/assets/cli-ruby/lib/project_types/extension/cli.rb +5 -86
- package/assets/cli-ruby/lib/shopify_cli/admin_api.rb +0 -3
- package/assets/cli-ruby/lib/shopify_cli/command/sub_command.rb +1 -2
- package/assets/cli-ruby/lib/shopify_cli/command.rb +0 -7
- package/assets/cli-ruby/lib/shopify_cli/commands.rb +0 -15
- package/assets/cli-ruby/lib/shopify_cli/core.rb +0 -1
- package/assets/cli-ruby/lib/shopify_cli/identity_auth.rb +0 -1
- package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +9 -1
- package/assets/cli-ruby/lib/shopify_cli.rb +1 -10
- package/assets/cli-ruby/test/test_helpers.rb +0 -2
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +2 -2
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
- package/dist/private/node/ui/components/List.d.ts +2 -0
- package/dist/private/node/ui/components/List.js +5 -4
- package/dist/private/node/ui/components/List.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/InfoTable.d.ts +10 -2
- package/dist/private/node/ui/components/Prompts/InfoTable.js +12 -8
- package/dist/private/node/ui/components/Prompts/InfoTable.js.map +1 -1
- package/dist/public/common/string.js +62 -0
- package/dist/public/common/string.js.map +1 -1
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/cli.d.ts +1 -0
- package/dist/public/node/cli.js +15 -1
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/fs.d.ts +7 -2
- package/dist/public/node/fs.js +4 -3
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/output.d.ts +3 -1
- package/dist/public/node/output.js +10 -2
- package/dist/public/node/output.js.map +1 -1
- package/dist/public/node/ui.d.ts +3 -2
- package/dist/public/node/ui.js +1 -1
- package/dist/public/node/ui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/assets/cli-ruby/lib/project_types/extension/commands/build.rb +0 -51
- package/assets/cli-ruby/lib/project_types/extension/commands/check.rb +0 -51
- package/assets/cli-ruby/lib/project_types/extension/commands/connect.rb +0 -35
- package/assets/cli-ruby/lib/project_types/extension/commands/create.rb +0 -100
- package/assets/cli-ruby/lib/project_types/extension/commands/info.rb +0 -86
- package/assets/cli-ruby/lib/project_types/extension/commands/push.rb +0 -112
- package/assets/cli-ruby/lib/project_types/extension/commands/register.rb +0 -67
- package/assets/cli-ruby/lib/project_types/extension/commands/tunnel.rb +0 -73
- package/assets/cli-ruby/lib/project_types/extension/forms/connect.rb +0 -42
- package/assets/cli-ruby/lib/project_types/extension/forms/create.rb +0 -49
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_app.rb +0 -53
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_name.rb +0 -48
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_registration.rb +0 -55
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_template.rb +0 -37
- package/assets/cli-ruby/lib/project_types/extension/forms/questions/ask_type.rb +0 -47
- package/assets/cli-ruby/lib/project_types/extension/models/development_server.rb +0 -77
- package/assets/cli-ruby/lib/project_types/extension/models/development_server_requirements.rb +0 -56
- package/assets/cli-ruby/lib/project_types/extension/models/npm_package.rb +0 -44
- package/assets/cli-ruby/lib/project_types/extension/models/product.rb +0 -12
- package/assets/cli-ruby/lib/project_types/extension/models/registration.rb +0 -20
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/app.rb +0 -13
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/base.rb +0 -31
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/capabilities.rb +0 -11
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development.rb +0 -33
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_entries.rb +0 -38
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_renderer.rb +0 -38
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/development_resource.rb +0 -13
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/extension.rb +0 -46
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/root.rb +0 -21
- package/assets/cli-ruby/lib/project_types/extension/models/server_config/user.rb +0 -10
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +0 -29
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +0 -170
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb +0 -58
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config.rb +0 -33
- package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config_repository.rb +0 -75
- package/assets/cli-ruby/lib/project_types/extension/tasks/choose_next_available_port.rb +0 -36
- package/assets/cli-ruby/lib/project_types/extension/tasks/convert_server_config.rb +0 -85
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/app_converter.rb +0 -27
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/product_converter.rb +0 -21
- package/assets/cli-ruby/lib/project_types/extension/tasks/converters/registration_converter.rb +0 -28
- package/assets/cli-ruby/lib/project_types/extension/tasks/create_extension.rb +0 -31
- package/assets/cli-ruby/lib/project_types/extension/tasks/ensure_resource_url.rb +0 -39
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/base.rb +0 -15
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/build.rb +0 -30
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/create.rb +0 -30
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/outdated_extension_detection.rb +0 -57
- package/assets/cli-ruby/lib/project_types/extension/tasks/execute_commands/serve.rb +0 -36
- package/assets/cli-ruby/lib/project_types/extension/tasks/find_npm_packages.rb +0 -106
- package/assets/cli-ruby/lib/project_types/extension/tasks/find_package_from_json.rb +0 -37
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_app.rb +0 -22
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_apps.rb +0 -26
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_extensions.rb +0 -33
- package/assets/cli-ruby/lib/project_types/extension/tasks/get_product.rb +0 -22
- package/assets/cli-ruby/lib/project_types/extension/tasks/merge_server_config.rb +0 -47
- package/assets/cli-ruby/lib/project_types/extension/tasks/update_draft.rb +0 -29
- package/assets/cli-ruby/lib/project_types/extension/tasks/user_errors.rb +0 -45
- package/assets/cli-ruby/lib/shopify_cli/admin_api/populate_resource_command.rb +0 -166
- package/assets/cli-ruby/lib/shopify_cli/admin_api/schema.rb +0 -35
- package/assets/cli-ruby/lib/shopify_cli/app_type_detector.rb +0 -36
- package/assets/cli-ruby/lib/shopify_cli/assets/post_auth_page/index.html.erb +0 -34
- package/assets/cli-ruby/lib/shopify_cli/assets/post_auth_page/style.css +0 -58
- package/assets/cli-ruby/lib/shopify_cli/changelog.rb +0 -148
- package/assets/cli-ruby/lib/shopify_cli/command/app_sub_command.rb +0 -26
- package/assets/cli-ruby/lib/shopify_cli/command_options/command_serve_options.rb +0 -53
- package/assets/cli-ruby/lib/shopify_cli/command_options.rb +0 -7
- package/assets/cli-ruby/lib/shopify_cli/commands/app/connect.rb +0 -22
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/node.rb +0 -40
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/php.rb +0 -37
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create/rails.rb +0 -42
- package/assets/cli-ruby/lib/shopify_cli/commands/app/create.rb +0 -28
- package/assets/cli-ruby/lib/shopify_cli/commands/app/deploy.rb +0 -51
- package/assets/cli-ruby/lib/shopify_cli/commands/app/open.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/commands/app/serve.rb +0 -51
- package/assets/cli-ruby/lib/shopify_cli/commands/app/tunnel.rb +0 -43
- package/assets/cli-ruby/lib/shopify_cli/commands/app.rb +0 -29
- package/assets/cli-ruby/lib/shopify_cli/commands/config.rb +0 -76
- package/assets/cli-ruby/lib/shopify_cli/commands/help.rb +0 -52
- package/assets/cli-ruby/lib/shopify_cli/commands/login.rb +0 -98
- package/assets/cli-ruby/lib/shopify_cli/commands/logout.rb +0 -50
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/customer.rb +0 -25
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/draft_order.rb +0 -28
- package/assets/cli-ruby/lib/shopify_cli/commands/populate/product.rb +0 -24
- package/assets/cli-ruby/lib/shopify_cli/commands/populate.rb +0 -23
- package/assets/cli-ruby/lib/shopify_cli/commands/reporting.rb +0 -38
- package/assets/cli-ruby/lib/shopify_cli/commands/store.rb +0 -15
- package/assets/cli-ruby/lib/shopify_cli/commands/switch.rb +0 -39
- package/assets/cli-ruby/lib/shopify_cli/commands/system.rb +0 -165
- package/assets/cli-ruby/lib/shopify_cli/commands/version.rb +0 -15
- package/assets/cli-ruby/lib/shopify_cli/commands/whoami.rb +0 -28
- package/assets/cli-ruby/lib/shopify_cli/connect.rb +0 -32
- package/assets/cli-ruby/lib/shopify_cli/core/help_resolver.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/heroku.rb +0 -140
- package/assets/cli-ruby/lib/shopify_cli/identity_auth/servlet.rb +0 -44
- package/assets/cli-ruby/lib/shopify_cli/js_deps.rb +0 -110
- package/assets/cli-ruby/lib/shopify_cli/packager.rb +0 -108
- package/assets/cli-ruby/lib/shopify_cli/php_deps.rb +0 -102
- package/assets/cli-ruby/lib/shopify_cli/process_supervision.rb +0 -228
- package/assets/cli-ruby/lib/shopify_cli/project_commands.rb +0 -16
- package/assets/cli-ruby/lib/shopify_cli/release.rb +0 -197
- package/assets/cli-ruby/lib/shopify_cli/sed.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/services/app/connect_service.rb +0 -25
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/node_service.rb +0 -143
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/php_service.rb +0 -147
- package/assets/cli-ruby/lib/shopify_cli/services/app/create/rails_service.rb +0 -239
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +0 -101
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +0 -135
- package/assets/cli-ruby/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +0 -120
- package/assets/cli-ruby/lib/shopify_cli/services/app/open_service.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/node_service.rb +0 -19
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/php_service.rb +0 -23
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/rails_service.rb +0 -28
- package/assets/cli-ruby/lib/shopify_cli/services/app/serve/serve_service.rb +0 -57
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/auth_service.rb +0 -21
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/start_service.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/services/app/tunnel/stop_service.rb +0 -20
- package/assets/cli-ruby/lib/shopify_cli/services/base_service.rb +0 -13
- package/assets/cli-ruby/lib/shopify_cli/services/reporting_service.rb +0 -16
- package/assets/cli-ruby/lib/shopify_cli/services.rb +0 -38
- package/assets/cli-ruby/lib/shopify_cli/tunnel.rb +0 -255
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/cli-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.46.0-pre.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A set of utilities, interfaces, and models that are common across all the platform features",
|
|
6
6
|
"keywords": [
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"../../public/node/context/local.js",
|
|
61
61
|
"./context/local.js",
|
|
62
62
|
"@oclif/core",
|
|
63
|
-
"../../private/node/context/utilities.js",
|
|
64
63
|
"../../private/node/constants.js",
|
|
65
64
|
"./path.js",
|
|
66
65
|
"./system.js"
|
|
67
66
|
],
|
|
68
67
|
"static": [
|
|
69
|
-
"@oclif/core"
|
|
68
|
+
"@oclif/core",
|
|
69
|
+
"../../private/node/context/utilities.js"
|
|
70
70
|
]
|
|
71
71
|
}
|
|
72
72
|
]
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@bugsnag/js": "7.16.7",
|
|
79
79
|
"@iarna/toml": "2.2.5",
|
|
80
80
|
"@oclif/core": "2.1.4",
|
|
81
|
-
"@types/archiver": "5.3.
|
|
81
|
+
"@types/archiver": "5.3.2",
|
|
82
82
|
"abort-controller": "3.0.0",
|
|
83
83
|
"ansi-escapes": "6.0.0",
|
|
84
84
|
"archiver": "5.3.1",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"commondir": "1.0.1",
|
|
89
89
|
"conf": "11.0.1",
|
|
90
90
|
"cross-zip": "4.0.0",
|
|
91
|
-
"deepmerge": "4.3.
|
|
91
|
+
"deepmerge": "4.3.1",
|
|
92
92
|
"del": "6.0.0",
|
|
93
93
|
"env-paths": "3.0.0",
|
|
94
94
|
"envfile": "6.18.0",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"open": "8.4.2",
|
|
119
119
|
"pathe": "1.0.0",
|
|
120
120
|
"react": "18.2.0",
|
|
121
|
-
"semver": "7.3.
|
|
121
|
+
"semver": "7.3.8",
|
|
122
122
|
"simple-git": "3.16.0",
|
|
123
123
|
"source-map-support": "0.5.21",
|
|
124
124
|
"stacktracey": "2.1.8",
|
|
@@ -135,10 +135,10 @@
|
|
|
135
135
|
"devDependencies": {
|
|
136
136
|
"@types/commondir": "^1.0.0",
|
|
137
137
|
"@types/cross-zip": "^4.0.0",
|
|
138
|
-
"@types/diff": "^5.0.
|
|
138
|
+
"@types/diff": "^5.0.3",
|
|
139
139
|
"@types/fs-extra": "9.0.13",
|
|
140
140
|
"@types/gradient-string": "^1.1.2",
|
|
141
|
-
"@types/lodash": "4.14.
|
|
141
|
+
"@types/lodash": "4.14.192",
|
|
142
142
|
"@types/node": "14.18.36",
|
|
143
143
|
"@types/react": "17.0.2",
|
|
144
144
|
"@types/semver": "^7.3.13",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require "shopify_cli"
|
|
3
|
-
|
|
4
|
-
module Extension
|
|
5
|
-
class Command
|
|
6
|
-
class Build < ExtensionCommand
|
|
7
|
-
prerequisite_task ensure_project_type: :extension
|
|
8
|
-
|
|
9
|
-
YARN_BUILD_COMMAND = %w(build)
|
|
10
|
-
NPM_BUILD_COMMAND = %w(run-script build)
|
|
11
|
-
|
|
12
|
-
def call(_args, _command_name)
|
|
13
|
-
project = ExtensionProject.current(force_reload: true)
|
|
14
|
-
return run_new_flow(project) if supports_development_server?(project.specification_identifier)
|
|
15
|
-
run_legacy_flow
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.help
|
|
19
|
-
ShopifyCLI::Context.new.message("build.help", ShopifyCLI::TOOL_NAME)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
def run_new_flow(project)
|
|
25
|
-
Tasks::ExecuteCommands
|
|
26
|
-
.build(
|
|
27
|
-
context: @ctx,
|
|
28
|
-
config_file_path: specification_handler.server_config_path,
|
|
29
|
-
type: project.specification_identifier.downcase
|
|
30
|
-
)
|
|
31
|
-
.then { |output| @ctx.puts(output) }
|
|
32
|
-
.unwrap do |error|
|
|
33
|
-
raise ShopifyCLI::Abort, error.message unless error.nil?
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def run_legacy_flow
|
|
38
|
-
system = ShopifyCLI::JsSystem.new(ctx: @ctx)
|
|
39
|
-
|
|
40
|
-
CLI::UI::Frame.open(@ctx.message("build.frame_title", system.package_manager)) do
|
|
41
|
-
success = system.call(yarn: YARN_BUILD_COMMAND, npm: NPM_BUILD_COMMAND)
|
|
42
|
-
@ctx.abort(@ctx.message("build.build_failure_message")) unless success
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def supports_development_server?(type)
|
|
47
|
-
Models::DevelopmentServerRequirements.supported?(type)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require "theme_check"
|
|
3
|
-
|
|
4
|
-
module Extension
|
|
5
|
-
class Command
|
|
6
|
-
class Check < ExtensionCommand
|
|
7
|
-
recommend_default_ruby_range
|
|
8
|
-
|
|
9
|
-
class CheckOptions < ShopifyCLI::Options
|
|
10
|
-
def initialize(ctx, theme_check)
|
|
11
|
-
super()
|
|
12
|
-
@theme_check = theme_check
|
|
13
|
-
@ctx = ctx
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def parse(_options_block, args)
|
|
17
|
-
# Check if .theme-check.yml exists, or if another -C has been passed on the command line
|
|
18
|
-
unless args.include?("-C") || @ctx.file_exist?(".theme-check.yml")
|
|
19
|
-
args += ["-C", ":theme_app_extension"]
|
|
20
|
-
end
|
|
21
|
-
@theme_check.parse(args)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def initialize(*)
|
|
26
|
-
super
|
|
27
|
-
if project.specification_identifier == "THEME_APP_EXTENSION"
|
|
28
|
-
@theme_check = ThemeCheck::Cli.new
|
|
29
|
-
self.options = CheckOptions.new(@ctx, @theme_check)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def call(*)
|
|
34
|
-
if project.specification_identifier == "THEME_APP_EXTENSION"
|
|
35
|
-
begin
|
|
36
|
-
@theme_check.run!
|
|
37
|
-
rescue ThemeCheck::Cli::Abort, ThemeCheck::ThemeCheckError => e
|
|
38
|
-
raise ShopifyCLI::Abort,
|
|
39
|
-
ShopifyCLI::Context.message("theme.check.error", e.full_message)
|
|
40
|
-
end
|
|
41
|
-
else
|
|
42
|
-
@ctx.abort(@ctx.message("check.unsupported", project.specification_identifier))
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def self.help
|
|
47
|
-
ShopifyCLI::Context.message("check.help", ShopifyCLI::TOOL_NAME)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
module Extension
|
|
3
|
-
class Command
|
|
4
|
-
class Connect < ExtensionCommand
|
|
5
|
-
prerequisite_task :ensure_authenticated
|
|
6
|
-
|
|
7
|
-
def call(args, _)
|
|
8
|
-
with_connect_form(args) do |form|
|
|
9
|
-
ExtensionProject.write_env_file(
|
|
10
|
-
context: @ctx,
|
|
11
|
-
api_key: form.app.api_key,
|
|
12
|
-
api_secret: form.app.secret,
|
|
13
|
-
registration_id: form.registration.id,
|
|
14
|
-
registration_uuid: form.registration.uuid,
|
|
15
|
-
title: form.registration.title
|
|
16
|
-
)
|
|
17
|
-
@ctx.done(@ctx.message("connect.connected", form.app.title, form.registration.title))
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def self.help
|
|
22
|
-
ShopifyCLI::Context.new.message("connect.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
def with_connect_form(args)
|
|
28
|
-
form = Forms::Connect.ask(@ctx, args, { type: specification_handler.identifier.downcase })
|
|
29
|
-
return @ctx.puts(self.class.help) if form.nil?
|
|
30
|
-
|
|
31
|
-
yield form
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Extension
|
|
4
|
-
class Command
|
|
5
|
-
class Create < ShopifyCLI::Command::SubCommand
|
|
6
|
-
prerequisite_task :ensure_authenticated
|
|
7
|
-
|
|
8
|
-
recommend_default_ruby_range
|
|
9
|
-
|
|
10
|
-
options do |parser, flags|
|
|
11
|
-
parser.on("--name=NAME") { |name| flags[:name] = name }
|
|
12
|
-
parser.on("--template=TEMPLATE") { |template| flags[:template] = template }
|
|
13
|
-
parser.on("--type=TYPE") { |type| flags[:type] = type.upcase }
|
|
14
|
-
parser.on("--api-key=KEY") { |key| flags[:api_key] = key.downcase }
|
|
15
|
-
parser.on("--getting-started") { flags[:getting_started] = true }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def call(args, _)
|
|
19
|
-
with_create_form(args) do |form, message_for_extension|
|
|
20
|
-
if Dir.exist?(form.directory_name)
|
|
21
|
-
@ctx.abort(message_for_extension["create.errors.directory_exists", form.directory_name])
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
ShopifyCLI::Result.success(supports_development_server?(form.type.identifier))
|
|
25
|
-
.then { |supported| create_extension(supported, form) }
|
|
26
|
-
.then { notify_success(form, message_for_extension) }
|
|
27
|
-
.unwrap { |err| @ctx.puts(message_for_extension["create.try_again"]) unless err.nil? }
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def self.help
|
|
32
|
-
@ctx.message("create.help", ShopifyCLI::TOOL_NAME)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def with_create_form(args)
|
|
38
|
-
form = Forms::Create.ask(@ctx, args, options.flags)
|
|
39
|
-
return @ctx.puts(self.class.help) if form.nil?
|
|
40
|
-
|
|
41
|
-
yield form, form.type.method(:message_for_extension)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def supports_development_server?(type)
|
|
45
|
-
Models::DevelopmentServerRequirements.supported?(type)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def create_extension(supported, form)
|
|
49
|
-
if supported
|
|
50
|
-
use_new_create_flow(form)
|
|
51
|
-
else
|
|
52
|
-
use_legacy_flow(form)
|
|
53
|
-
end
|
|
54
|
-
ShopifyCLI::Result.success(nil)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def use_new_create_flow(form)
|
|
58
|
-
Tasks::ExecuteCommands.create(
|
|
59
|
-
root_dir: form.directory_name,
|
|
60
|
-
template: form.template,
|
|
61
|
-
type: form.type.identifier.downcase,
|
|
62
|
-
context: @ctx,
|
|
63
|
-
)
|
|
64
|
-
.then { |output| @ctx.puts(output) }
|
|
65
|
-
.unwrap do |error|
|
|
66
|
-
raise ShopifyCLI::Abort, error.message unless error.nil?
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
@ctx.chdir(form.directory_name)
|
|
70
|
-
write_env_file(form)
|
|
71
|
-
rescue => error
|
|
72
|
-
@ctx.debug(error)
|
|
73
|
-
raise error
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def use_legacy_flow(form)
|
|
77
|
-
if form.type.create(form.directory_name, @ctx, getting_started: options.flags[:getting_started])
|
|
78
|
-
write_env_file(form)
|
|
79
|
-
else
|
|
80
|
-
raise StandardError
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def write_env_file(form)
|
|
85
|
-
ExtensionProject.write_cli_file(context: @ctx, type: form.type.identifier)
|
|
86
|
-
ExtensionProject.write_env_file(
|
|
87
|
-
context: @ctx,
|
|
88
|
-
title: form.name,
|
|
89
|
-
api_key: form.app.api_key,
|
|
90
|
-
api_secret: form.app.secret
|
|
91
|
-
)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def notify_success(form, msg)
|
|
95
|
-
@ctx.puts(msg["create.ready_to_start", form.directory_name, form.name])
|
|
96
|
-
@ctx.puts(msg["create.learn_more", form.type.name])
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require "shopify_cli"
|
|
3
|
-
|
|
4
|
-
module Extension
|
|
5
|
-
class Command
|
|
6
|
-
class Info < ExtensionCommand
|
|
7
|
-
hidden_feature
|
|
8
|
-
|
|
9
|
-
def call(*)
|
|
10
|
-
@ctx.puts("Extension Title: #{project.title}")
|
|
11
|
-
@ctx.puts("Extension UUID: #{project.registration_uuid}")
|
|
12
|
-
@ctx.puts("Extension ID: #{project.registration_id}")
|
|
13
|
-
theme_app_extension_additional_info
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def self.help
|
|
17
|
-
ShopifyCLI::Context.new.message("info.help", ShopifyCLI::TOOL_NAME)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
OPENING_SCHEMA = "{%schema%}"
|
|
23
|
-
CLOSING_SCHEMA = "{%endschema%}"
|
|
24
|
-
|
|
25
|
-
def theme_app_extension_additional_info
|
|
26
|
-
if project.specification_identifier == "THEME_APP_EXTENSION" && (infos = block_infos)
|
|
27
|
-
title = to_handle(app.title)
|
|
28
|
-
uuid = project.registration_uuid
|
|
29
|
-
@ctx.puts("Block Infos \n")
|
|
30
|
-
index = 1
|
|
31
|
-
infos.each do |type, blocks_name|
|
|
32
|
-
@ctx.puts(" << #{type} >>\n")
|
|
33
|
-
blocks_name.each do |block_name|
|
|
34
|
-
@ctx.puts(" #{index}. shopify://apps/#{title}/blocks/#{block_name}/#{uuid} \n")
|
|
35
|
-
index += 1
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def app
|
|
42
|
-
@app ||= Tasks::GetApp.call(context: @ctx, api_key: project.app.api_key)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def block_infos
|
|
46
|
-
block_infos = {}
|
|
47
|
-
Dir["blocks/*.liquid"].map do |filename|
|
|
48
|
-
block_name = File.basename(filename, ".liquid")
|
|
49
|
-
json_schema = block_info(filename)
|
|
50
|
-
|
|
51
|
-
next unless json_schema
|
|
52
|
-
block_type = json_schema["target"] == "section" ? "App Block" : "App Embed"
|
|
53
|
-
block_infos[block_type] ||= []
|
|
54
|
-
block_infos[block_type] << block_name
|
|
55
|
-
end
|
|
56
|
-
block_infos
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def block_info(filename)
|
|
60
|
-
output = File.read(filename)
|
|
61
|
-
output = output.gsub(/\s+/, "")
|
|
62
|
-
|
|
63
|
-
if output
|
|
64
|
-
opening_index = output.index(OPENING_SCHEMA) + OPENING_SCHEMA.size
|
|
65
|
-
closing_index = output.index(CLOSING_SCHEMA) - 1
|
|
66
|
-
|
|
67
|
-
if (schema = output.slice(opening_index..closing_index))
|
|
68
|
-
json_schema = JSON.parse(schema)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
json_schema
|
|
72
|
-
rescue JSON::ParserError
|
|
73
|
-
{}
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def to_handle(s)
|
|
77
|
-
s = s.dup
|
|
78
|
-
s.downcase!
|
|
79
|
-
s.delete!("'\"()[]")
|
|
80
|
-
s.gsub!(/\W+/, "-")
|
|
81
|
-
s.gsub!(/\A-+|-+\z/, "")
|
|
82
|
-
-s
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require "shopify_cli"
|
|
3
|
-
|
|
4
|
-
module Extension
|
|
5
|
-
class Command
|
|
6
|
-
class Push < ShopifyCLI::Command::SubCommand
|
|
7
|
-
prerequisite_task ensure_project_type: :extension
|
|
8
|
-
|
|
9
|
-
recommend_default_ruby_range
|
|
10
|
-
|
|
11
|
-
options do |parser, flags|
|
|
12
|
-
parser.on("--api-key=API_KEY") { |api_key| flags[:api_key] = api_key.gsub('"', "") }
|
|
13
|
-
parser.on("--api-secret=API_SECRET") { |api_secret| flags[:api_secret] = api_secret.gsub('"', "") }
|
|
14
|
-
parser.on("--extension-id=EXTENSION_ID") do |registration_id|
|
|
15
|
-
flags[:registration_id] = registration_id.gsub('"', "")
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
TIME_DISPLAY_FORMAT = "%B %d, %Y %H:%M:%S %Z"
|
|
20
|
-
|
|
21
|
-
def call(args, name)
|
|
22
|
-
project = Extension::Loaders::Project.load(
|
|
23
|
-
context: @ctx,
|
|
24
|
-
directory: Dir.pwd,
|
|
25
|
-
api_key: options.flags[:api_key],
|
|
26
|
-
api_secret: options.flags[:api_secret],
|
|
27
|
-
registration_id: options.flags[:registration_id]
|
|
28
|
-
)
|
|
29
|
-
# on ci, registration id must be present
|
|
30
|
-
registration_id = options.flags[:registration_id]
|
|
31
|
-
check_registration(registration_id: registration_id, context: @ctx)
|
|
32
|
-
|
|
33
|
-
specification_handler = Extension::Loaders::SpecificationHandler.load(project: project, context: @ctx)
|
|
34
|
-
register_if_necessary(project: project, args: args, name: name)
|
|
35
|
-
|
|
36
|
-
Command::Build.new(@ctx).call(args, name) unless specification_handler.specification.options[:skip_build]
|
|
37
|
-
CLI::UI::Frame.open(@ctx.message("push.frame_title")) do
|
|
38
|
-
updated_draft_version = update_draft(project: project, specification_handler: specification_handler)
|
|
39
|
-
show_message(updated_draft_version, project: project)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def register_if_necessary(project:, args:, name:)
|
|
44
|
-
if ShopifyCLI::Environment.interactive? && !project.registered?
|
|
45
|
-
Command::Register.new(@ctx).call(args, name)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def check_registration(registration_id:, context:)
|
|
50
|
-
if !ShopifyCLI::Environment.interactive? && (!registration_id || registration_id.empty?)
|
|
51
|
-
message = context.message("errors.missing_push_options_ci", "--registration-id")
|
|
52
|
-
message += context.message("errors.missing_push_options_ci_solution", ShopifyCLI::TOOL_NAME)
|
|
53
|
-
raise ShopifyCLI::Abort,
|
|
54
|
-
message
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def self.help
|
|
59
|
-
ShopifyCLI::Context.new.message("push.help", ShopifyCLI::TOOL_NAME)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
private
|
|
63
|
-
|
|
64
|
-
def show_message(draft, project:)
|
|
65
|
-
if draft.validation_errors.empty?
|
|
66
|
-
output_success_messages(draft,
|
|
67
|
-
project: project)
|
|
68
|
-
else
|
|
69
|
-
output_validation_errors(draft)
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def output_success_messages(draft, project:)
|
|
74
|
-
@ctx.puts(@ctx.message("push.success_confirmation", project.title, format_time(draft.last_user_interaction_at)))
|
|
75
|
-
@ctx.puts(@ctx.message("push.success_info", draft.location))
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def output_validation_errors(draft)
|
|
79
|
-
@ctx.puts(@ctx.message("push.pushed_with_errors", format_time(draft.last_user_interaction_at)))
|
|
80
|
-
|
|
81
|
-
draft.validation_errors.each do |error|
|
|
82
|
-
@ctx.puts(format("{{x}} %s: %s", error.field.last, error.message))
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
@ctx.puts(@ctx.message("push.push_with_errors_info"))
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def format_time(time)
|
|
89
|
-
time.utc.strftime(TIME_DISPLAY_FORMAT)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def with_waiting_text
|
|
93
|
-
@ctx.puts(@ctx.message("push.waiting_text"))
|
|
94
|
-
yield
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def update_draft(project:, specification_handler:)
|
|
98
|
-
with_waiting_text do
|
|
99
|
-
Tasks::UpdateDraft.call(
|
|
100
|
-
context: @ctx,
|
|
101
|
-
api_key: project.app.api_key,
|
|
102
|
-
registration_id: project.registration_id,
|
|
103
|
-
config: specification_handler.config(@ctx),
|
|
104
|
-
extension_context: specification_handler.extension_context(@ctx)
|
|
105
|
-
)
|
|
106
|
-
end
|
|
107
|
-
rescue Extension::Errors::ExtensionError => e
|
|
108
|
-
@ctx.abort(e)
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Extension
|
|
4
|
-
class Command
|
|
5
|
-
class Register < ExtensionCommand
|
|
6
|
-
prerequisite_task ensure_project_type: :extension
|
|
7
|
-
|
|
8
|
-
def call(_args, _command_name)
|
|
9
|
-
CLI::UI::Frame.open(@ctx.message("register.frame_title")) do
|
|
10
|
-
@ctx.abort(@ctx.message("register.already_registered")) if project.registered?
|
|
11
|
-
|
|
12
|
-
should_continue = confirm_registration
|
|
13
|
-
registration = should_continue ? register_extension : abort_not_registered
|
|
14
|
-
|
|
15
|
-
update_project_files(registration)
|
|
16
|
-
|
|
17
|
-
@ctx.puts(@ctx.message("register.success", project.title))
|
|
18
|
-
@ctx.puts(@ctx.message("register.success_info"))
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def self.help
|
|
23
|
-
ShopifyCLI::Context.new.message("register.help", ShopifyCLI::TOOL_NAME)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
def confirm_registration
|
|
29
|
-
@ctx.puts(@ctx.message("register.confirm_info", specification_handler.name))
|
|
30
|
-
CLI::UI::Prompt.confirm(@ctx.message("register.confirm_question"))
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def register_extension
|
|
34
|
-
@ctx.puts(@ctx.message("register.waiting_text"))
|
|
35
|
-
|
|
36
|
-
Tasks::CreateExtension.call(
|
|
37
|
-
context: @ctx,
|
|
38
|
-
api_key: app.api_key,
|
|
39
|
-
type: specification_handler.graphql_identifier,
|
|
40
|
-
title: project.title,
|
|
41
|
-
config: {},
|
|
42
|
-
extension_context: specification_handler.extension_context(@ctx)
|
|
43
|
-
)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def update_project_files(registration)
|
|
47
|
-
ExtensionProject.write_env_file(
|
|
48
|
-
context: @ctx,
|
|
49
|
-
api_key: app.api_key,
|
|
50
|
-
api_secret: app.secret,
|
|
51
|
-
registration_id: registration.id,
|
|
52
|
-
registration_uuid: registration.uuid,
|
|
53
|
-
title: project.title
|
|
54
|
-
)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def app
|
|
58
|
-
@app ||= project.app
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def abort_not_registered
|
|
62
|
-
@ctx.puts(@ctx.message("register.confirm_abort"))
|
|
63
|
-
raise ShopifyCLI::AbortSilent
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require "shopify_cli"
|
|
3
|
-
|
|
4
|
-
module Extension
|
|
5
|
-
class Command
|
|
6
|
-
class Tunnel < ExtensionCommand
|
|
7
|
-
prerequisite_task ensure_project_type: :extension
|
|
8
|
-
|
|
9
|
-
options do |parser, flags|
|
|
10
|
-
parser.on("--port=PORT") { |port| flags[:port] = port }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
AUTH_SUBCOMMAND = "auth"
|
|
14
|
-
START_SUBCOMMAND = "start"
|
|
15
|
-
STOP_SUBCOMMAND = "stop"
|
|
16
|
-
STATUS_SUBCOMMAND = "status"
|
|
17
|
-
DEFAULT_PORT = 39351
|
|
18
|
-
|
|
19
|
-
def call(args, _name)
|
|
20
|
-
subcommand = args.shift
|
|
21
|
-
|
|
22
|
-
case subcommand
|
|
23
|
-
when AUTH_SUBCOMMAND then authorize(args)
|
|
24
|
-
when START_SUBCOMMAND then ShopifyCLI::Tunnel.start(@ctx, port: port)
|
|
25
|
-
when STOP_SUBCOMMAND then ShopifyCLI::Tunnel.stop(@ctx)
|
|
26
|
-
when STATUS_SUBCOMMAND then status
|
|
27
|
-
else @ctx.puts(self.class.help)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def self.help
|
|
32
|
-
ShopifyCLI::Context.message("tunnel.help", ShopifyCLI::TOOL_NAME)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def self.extended_help
|
|
36
|
-
ShopifyCLI::Context.message("tunnel.extended_help", ShopifyCLI::TOOL_NAME, DEFAULT_PORT)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
private
|
|
40
|
-
|
|
41
|
-
def status
|
|
42
|
-
tunnel_urls = ShopifyCLI::Tunnel.urls
|
|
43
|
-
tunnel_url = tunnel_urls.find { |url| url.start_with?("https://") }
|
|
44
|
-
tunnel_url = tunnel_urls.first if tunnel_url.nil?
|
|
45
|
-
|
|
46
|
-
if tunnel_url.nil?
|
|
47
|
-
@ctx.puts(@ctx.message("tunnel.no_tunnel_running"))
|
|
48
|
-
else
|
|
49
|
-
@ctx.puts(@ctx.message("tunnel.tunnel_running_at", tunnel_url))
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def port
|
|
54
|
-
return DEFAULT_PORT unless options.flags.key?(:port)
|
|
55
|
-
|
|
56
|
-
port = options.flags[:port].to_i
|
|
57
|
-
@ctx.abort(@ctx.message("tunnel.invalid_port", options.flags[:port])) unless port > 0
|
|
58
|
-
port
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def authorize(args)
|
|
62
|
-
token = args.shift
|
|
63
|
-
|
|
64
|
-
if token.nil?
|
|
65
|
-
@ctx.puts(@ctx.message("tunnel.missing_token"))
|
|
66
|
-
@ctx.puts("#{self.class.help}\n#{self.class.extended_help}")
|
|
67
|
-
else
|
|
68
|
-
ShopifyCLI::Tunnel.auth(@ctx, token)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Extension
|
|
4
|
-
module Forms
|
|
5
|
-
class Connect < ShopifyCLI::Form
|
|
6
|
-
attr_reader :registration, :app
|
|
7
|
-
|
|
8
|
-
flag_arguments :type
|
|
9
|
-
|
|
10
|
-
class ExtensionProjectDetails
|
|
11
|
-
include SmartProperties
|
|
12
|
-
|
|
13
|
-
property :registration, accepts: Models::Registration
|
|
14
|
-
property :app, accepts: Models::App
|
|
15
|
-
|
|
16
|
-
def complete?
|
|
17
|
-
!!(registration && app)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def ask
|
|
22
|
-
ShopifyCLI::Result.wrap(ExtensionProjectDetails.new)
|
|
23
|
-
.then(&Questions::AskRegistration.new(ctx: ctx, type: type))
|
|
24
|
-
.unwrap { |e| raise e }
|
|
25
|
-
.tap do |project_details|
|
|
26
|
-
ctx.abort(ctx.message("connect.incomplete_configuration")) unless project_details.complete?
|
|
27
|
-
|
|
28
|
-
self.registration = project_details.registration
|
|
29
|
-
self.app = project_details.app
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def directory_name
|
|
34
|
-
name.strip.gsub(/( )/, "_").downcase
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
private
|
|
38
|
-
|
|
39
|
-
attr_writer :registration, :app
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|