shopify-cli 2.7.0 → 2.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +2 -2
- data/.github/workflows/shopify.yml +1 -1
- data/.gitignore +2 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +46 -0
- data/Codespace.dockerfile +2 -2
- data/Gemfile.lock +4 -4
- data/Rakefile +27 -0
- data/Tests.dockerfile +2 -2
- data/dev.yml +3 -3
- data/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/javy.rb +204 -0
- data/ext/javy/version +1 -0
- data/lib/graphql/get_extension_registrations.graphql +27 -0
- data/lib/project_types/extension/cli.rb +27 -2
- data/lib/project_types/extension/commands/build.rb +10 -14
- data/lib/project_types/extension/commands/create.rb +3 -6
- data/lib/project_types/extension/commands/push.rb +36 -8
- data/lib/project_types/extension/extension_project.rb +1 -1
- data/lib/project_types/extension/features/argo_serve.rb +6 -5
- data/lib/project_types/extension/forms/questions/ask_registration.rb +6 -2
- data/lib/project_types/extension/loaders/project.rb +29 -0
- data/lib/project_types/extension/loaders/specification_handler.rb +22 -0
- data/lib/project_types/extension/messages/messages.rb +4 -2
- data/lib/project_types/extension/models/app.rb +1 -1
- data/lib/project_types/extension/models/development_server.rb +2 -2
- data/lib/project_types/extension/models/specification_handlers/default.rb +4 -0
- data/lib/project_types/extension/tasks/convert_server_config.rb +3 -1
- data/lib/project_types/extension/tasks/execute_commands/base.rb +13 -0
- data/lib/project_types/extension/tasks/execute_commands/build.rb +29 -0
- data/lib/project_types/extension/tasks/execute_commands/create.rb +33 -0
- data/lib/project_types/extension/tasks/execute_commands/serve.rb +35 -0
- data/lib/project_types/extension/tasks/merge_server_config.rb +33 -22
- data/lib/project_types/rails/commands/create.rb +2 -4
- data/lib/project_types/script/cli.rb +9 -1
- data/lib/project_types/script/commands/connect.rb +19 -0
- data/lib/project_types/script/commands/create.rb +1 -3
- data/lib/project_types/script/commands/javy.rb +29 -0
- data/lib/project_types/script/commands/push.rb +2 -1
- data/lib/project_types/script/config/extension_points.yml +12 -30
- data/lib/project_types/script/forms/ask_app.rb +32 -0
- data/lib/project_types/script/forms/ask_org.rb +30 -0
- data/lib/project_types/script/forms/ask_script_uuid.rb +22 -0
- data/lib/project_types/script/forms/run_against_shopify_org.rb +14 -0
- data/lib/project_types/script/graphql/app_script_set.graphql +2 -2
- data/lib/project_types/script/layers/application/build_script.rb +0 -1
- data/lib/project_types/script/layers/application/connect_app.rb +79 -0
- data/lib/project_types/script/layers/application/create_script.rb +17 -17
- data/lib/project_types/script/layers/application/push_script.rb +1 -1
- data/lib/project_types/script/layers/domain/errors.rb +1 -4
- data/lib/project_types/script/layers/domain/push_package.rb +3 -3
- data/lib/project_types/script/layers/domain/{script_json.rb → script_config.rb} +2 -2
- data/lib/project_types/script/layers/domain/script_project.rb +5 -1
- data/lib/project_types/script/layers/infrastructure/errors.rb +36 -7
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +0 -4
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +0 -4
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +125 -27
- data/lib/project_types/script/layers/infrastructure/script_service.rb +11 -11
- data/lib/project_types/script/messages/messages.rb +32 -4
- data/lib/project_types/script/ui/error_handler.rb +31 -21
- data/lib/project_types/theme/commands/pull.rb +3 -0
- data/lib/project_types/theme/commands/push.rb +7 -1
- data/lib/project_types/theme/commands/serve.rb +1 -1
- data/lib/project_types/theme/messages/messages.rb +35 -1
- data/lib/project_types/theme/ui/sync_progress_bar.rb +2 -2
- data/lib/shopify_cli/command/project_command.rb +20 -7
- data/lib/shopify_cli/command.rb +6 -0
- data/lib/shopify_cli/commands/app/create/node.rb +1 -3
- data/lib/shopify_cli/commands/app/create/rails.rb +1 -3
- data/lib/shopify_cli/constants.rb +7 -0
- data/lib/shopify_cli/context.rb +11 -1
- data/lib/shopify_cli/environment.rb +4 -0
- data/lib/shopify_cli/form.rb +2 -0
- data/lib/shopify_cli/git.rb +2 -0
- data/lib/shopify_cli/identity_auth.rb +18 -0
- data/lib/shopify_cli/messages/messages.rb +9 -2
- data/lib/shopify_cli/partners_api/app_extensions/job.rb +36 -0
- data/lib/shopify_cli/partners_api/app_extensions.rb +46 -0
- data/lib/shopify_cli/partners_api/organizations.rb +2 -5
- data/lib/shopify_cli/partners_api.rb +2 -8
- data/lib/shopify_cli/project.rb +8 -7
- data/lib/shopify_cli/resources/env_file.rb +13 -5
- data/lib/shopify_cli/services/app/create/node_service.rb +2 -0
- data/lib/shopify_cli/services/app/create/php_service.rb +1 -1
- data/lib/shopify_cli/services/app/create/rails_service.rb +3 -1
- data/lib/shopify_cli/services/app/serve/node_service.rb +1 -1
- data/lib/shopify_cli/services/app/serve/rails_service.rb +1 -1
- data/lib/shopify_cli/tasks/ensure_authenticated.rb +9 -3
- data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +73 -0
- data/lib/shopify_cli/theme/dev_server/hot-reload.js +38 -9
- data/lib/shopify_cli/theme/dev_server/proxy/template_param_builder.rb +84 -0
- data/lib/shopify_cli/theme/dev_server/proxy.rb +9 -15
- data/lib/shopify_cli/theme/dev_server.rb +32 -19
- data/lib/shopify_cli/theme/syncer/error_reporter.rb +45 -0
- data/lib/shopify_cli/theme/syncer/operation.rb +56 -0
- data/lib/shopify_cli/theme/syncer/standard_reporter.rb +32 -0
- data/lib/shopify_cli/theme/syncer.rb +40 -39
- data/lib/shopify_cli/theme/theme.rb +31 -19
- data/lib/shopify_cli/thread_pool/job.rb +27 -0
- data/lib/shopify_cli/thread_pool.rb +37 -0
- data/lib/shopify_cli/tunnel.rb +26 -22
- data/lib/shopify_cli/version.rb +1 -1
- data/shopify-cli.gemspec +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +3 -1
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +1 -1
- metadata +34 -8
- data/lib/graphql/all_orgs_with_extensions.graphql +0 -37
- data/lib/project_types/extension/tasks/run_extension_command.rb +0 -82
- data/lib/project_types/script/tasks/ensure_env.rb +0 -106
@@ -1,82 +0,0 @@
|
|
1
|
-
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require "shopify_cli"
|
4
|
-
|
5
|
-
module Extension
|
6
|
-
module Tasks
|
7
|
-
class RunExtensionCommand < ShopifyCLI::Task
|
8
|
-
include SmartProperties
|
9
|
-
|
10
|
-
SUPPORTED_COMMANDS = [
|
11
|
-
"create",
|
12
|
-
"build",
|
13
|
-
"serve",
|
14
|
-
]
|
15
|
-
|
16
|
-
property! :command, accepts: SUPPORTED_COMMANDS
|
17
|
-
property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
|
18
|
-
property :context, accepts: ShopifyCLI::Context
|
19
|
-
property :config_file_name, accepts: String
|
20
|
-
property :port, accepts: Integer, default: 39351
|
21
|
-
property :resource_url, accepts: String
|
22
|
-
property :root_dir, accepts: String
|
23
|
-
property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES
|
24
|
-
property :tunnel_url, accepts: String
|
25
|
-
|
26
|
-
def call
|
27
|
-
ShopifyCLI::Result.success(config_file_exists?)
|
28
|
-
.then(&method(:load_or_build_server_config))
|
29
|
-
.then(&method(:run_command))
|
30
|
-
.unwrap do |error|
|
31
|
-
raise error unless error.nil?
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def config_file_exists?
|
38
|
-
return false if config_file_name.nil?
|
39
|
-
project = ExtensionProject.current
|
40
|
-
File.exist?(File.join(project.directory, config_file_name))
|
41
|
-
end
|
42
|
-
|
43
|
-
def load_or_build_server_config(config_file_exists)
|
44
|
-
return merge_server_config if config_file_exists
|
45
|
-
build_server_config
|
46
|
-
end
|
47
|
-
|
48
|
-
def merge_server_config
|
49
|
-
Tasks::MergeServerConfig.call(
|
50
|
-
context: context,
|
51
|
-
file_name: config_file_name,
|
52
|
-
resource_url: resource_url,
|
53
|
-
tunnel_url: tunnel_url,
|
54
|
-
type: type
|
55
|
-
)
|
56
|
-
end
|
57
|
-
|
58
|
-
def build_server_config
|
59
|
-
extension = Models::ServerConfig::Extension.build(
|
60
|
-
template: template,
|
61
|
-
type: type,
|
62
|
-
root_dir: root_dir,
|
63
|
-
)
|
64
|
-
|
65
|
-
Models::ServerConfig::Root.new(port: port, extensions: [extension])
|
66
|
-
end
|
67
|
-
|
68
|
-
def run_command(server_config)
|
69
|
-
case command
|
70
|
-
when "create"
|
71
|
-
Models::DevelopmentServer.new.create(server_config)
|
72
|
-
when "build"
|
73
|
-
Models::DevelopmentServer.new.build(server_config)
|
74
|
-
when "serve"
|
75
|
-
Models::DevelopmentServer.new.serve(context, server_config)
|
76
|
-
else
|
77
|
-
raise NotImplementedError
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,106 +0,0 @@
|
|
1
|
-
require "shopify_cli"
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Tasks
|
5
|
-
class EnsureEnv < ShopifyCLI::Task
|
6
|
-
attr_accessor :ctx
|
7
|
-
|
8
|
-
def call(ctx)
|
9
|
-
self.ctx = ctx
|
10
|
-
|
11
|
-
script_project_repo = Layers::Infrastructure::ScriptProjectRepository.new(ctx: ctx)
|
12
|
-
script_project = script_project_repo.get
|
13
|
-
|
14
|
-
return false if script_project.api_key && script_project.api_secret && script_project.uuid_defined?
|
15
|
-
|
16
|
-
org = ask_org
|
17
|
-
app = ask_app(org["apps"])
|
18
|
-
uuid = ask_script_uuid(app, script_project.extension_point_type)
|
19
|
-
|
20
|
-
script_project_repo.create_env(
|
21
|
-
api_key: app["apiKey"],
|
22
|
-
secret: app["apiSecretKeys"].first["secret"],
|
23
|
-
uuid: uuid
|
24
|
-
)
|
25
|
-
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def ask_org
|
32
|
-
return stubbed_org if partner_proxy_bypass
|
33
|
-
|
34
|
-
if ShopifyCLI::Shopifolk.check && wants_to_run_against_shopify_org?
|
35
|
-
ShopifyCLI::Shopifolk.act_as_shopify_organization
|
36
|
-
end
|
37
|
-
|
38
|
-
orgs = ShopifyCLI::PartnersAPI::Organizations.fetch_with_app(ctx)
|
39
|
-
if orgs.count == 1
|
40
|
-
default = orgs.first
|
41
|
-
ctx.puts(ctx.message("script.application.ensure_env.organization", default["businessName"], default["id"]))
|
42
|
-
default
|
43
|
-
elsif orgs.count > 0
|
44
|
-
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.organization_select")) do |handler|
|
45
|
-
orgs.each do |org|
|
46
|
-
handler.option("#{org["businessName"]} (#{org["id"]})") { org }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
else
|
50
|
-
raise Errors::NoExistingOrganizationsError
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def stubbed_org
|
55
|
-
{
|
56
|
-
"apps" => [
|
57
|
-
{
|
58
|
-
"appType" => "custom",
|
59
|
-
"apiKey" => "stubbed-api-key",
|
60
|
-
"apiSecretKeys" => [{ "secret" => "stubbed-api-secret" }],
|
61
|
-
"title" => "Fake App (Not connected to Partners)",
|
62
|
-
},
|
63
|
-
],
|
64
|
-
}
|
65
|
-
end
|
66
|
-
|
67
|
-
def partner_proxy_bypass
|
68
|
-
!ENV["BYPASS_PARTNERS_PROXY"].nil?
|
69
|
-
end
|
70
|
-
|
71
|
-
def ask_app(apps)
|
72
|
-
unless ShopifyCLI::Shopifolk.acting_as_shopify_organization?
|
73
|
-
apps = apps.select { |app| app["appType"] == "custom" }
|
74
|
-
end
|
75
|
-
|
76
|
-
if apps.count == 1
|
77
|
-
default = apps.first
|
78
|
-
ctx.puts(ctx.message("script.application.ensure_env.app", default["title"]))
|
79
|
-
default
|
80
|
-
elsif apps.count > 0
|
81
|
-
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.app_select")) do |handler|
|
82
|
-
apps.each do |app|
|
83
|
-
handler.option(app["title"]) { app }
|
84
|
-
end
|
85
|
-
end
|
86
|
-
else
|
87
|
-
raise Errors::NoExistingAppsError
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def ask_script_uuid(app, extension_point_type)
|
92
|
-
script_service = Layers::Infrastructure::ServiceLocator.script_service(ctx: ctx, api_key: app["apiKey"])
|
93
|
-
scripts = script_service.get_app_scripts(extension_point_type: extension_point_type)
|
94
|
-
|
95
|
-
return nil unless scripts.count > 0 &&
|
96
|
-
CLI::UI::Prompt.confirm(ctx.message("script.application.ensure_env.ask_connect_to_existing_script"))
|
97
|
-
|
98
|
-
CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.ask_which_script_to_connect_to")) do |handler|
|
99
|
-
scripts.each do |script|
|
100
|
-
handler.option("#{script["title"]} (#{script["uuid"]})") { script["uuid"] }
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|