shopify-cli 2.15.2 → 2.15.5
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/.vscode/settings.json +1 -2
- data/CHANGELOG.md +69 -22
- data/Gemfile.lock +1 -1
- data/Rakefile +8 -0
- data/ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256 +1 -0
- data/ext/javy/version +1 -1
- data/ext/shopify-extensions/version +1 -1
- data/lib/project_types/extension/cli.rb +4 -0
- data/lib/project_types/extension/commands/check.rb +6 -1
- data/lib/project_types/extension/forms/questions/ask_template.rb +1 -2
- data/lib/project_types/extension/messages/messages.rb +0 -2
- data/lib/project_types/extension/models/development_server_requirements.rb +1 -0
- data/lib/project_types/extension/models/specification_handlers/beacon_extension.rb +57 -0
- data/lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config.rb +33 -0
- data/lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config_repository.rb +75 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +16 -1
- data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +4 -1
- data/lib/project_types/extension/tasks/configure_options.rb +2 -1
- data/lib/project_types/extension/tasks/convert_server_config.rb +13 -2
- data/lib/project_types/extension/tasks/merge_server_config.rb +5 -2
- data/lib/project_types/script/cli.rb +1 -0
- data/lib/project_types/script/layers/application/create_script.rb +14 -6
- data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +6 -21
- data/lib/project_types/script/layers/infrastructure/sparse_checkout_details.rb +35 -0
- data/lib/project_types/theme/cli.rb +1 -0
- data/lib/project_types/theme/commands/check.rb +4 -1
- data/lib/project_types/theme/commands/open.rb +2 -2
- data/lib/project_types/theme/commands/push.rb +1 -3
- data/lib/project_types/theme/commands/share.rb +56 -0
- data/lib/project_types/theme/messages/messages.rb +24 -3
- data/lib/shopify_cli/changelog.rb +97 -25
- data/lib/shopify_cli/command_options/command_serve_options.rb +10 -0
- data/lib/shopify_cli/commands/app/serve.rb +7 -7
- data/lib/shopify_cli/commands/login.rb +5 -2
- data/lib/shopify_cli/context.rb +13 -0
- data/lib/shopify_cli/identity_auth.rb +24 -4
- data/lib/shopify_cli/messages/messages.rb +17 -7
- data/lib/shopify_cli/release.rb +1 -1
- data/lib/shopify_cli/services/app/create/rails_service.rb +9 -1
- data/lib/shopify_cli/services/app/serve/node_service.rb +2 -25
- data/lib/shopify_cli/services/app/serve/php_service.rb +2 -25
- data/lib/shopify_cli/services/app/serve/rails_service.rb +8 -28
- data/lib/shopify_cli/services/app/serve/serve_service.rb +57 -0
- data/lib/shopify_cli/services.rb +1 -0
- data/lib/shopify_cli/tasks/update_dashboard_urls.rb +7 -9
- data/lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb +1 -0
- data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -8
- data/lib/shopify_cli/theme/dev_server.rb +3 -2
- data/lib/shopify_cli/theme/theme.rb +21 -7
- data/lib/shopify_cli/theme/theme_admin_api.rb +23 -8
- data/lib/shopify_cli/tunnel.rb +3 -13
- data/lib/shopify_cli/version.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/os.rb +8 -0
- metadata +12 -2
@@ -18,6 +18,7 @@ module ShopifyCLI
|
|
18
18
|
missing_node: "Node.js is required to continue. Install Node.js here: https://nodejs.org/en/download.",
|
19
19
|
missing_npm: "npm is required to continue. Install npm here: https://www.npmjs.com/get-npm.",
|
20
20
|
missing_ruby: "Ruby is required to continue. Install Ruby here: https://www.ruby-lang.org/en/downloads.",
|
21
|
+
bundle_info_failure: "Error getting version for %s gem",
|
21
22
|
option_parser: {
|
22
23
|
invalid_option: "The option {{command:%s}} is not supported.",
|
23
24
|
invalid_option_store_equals: <<~MESSAGE,
|
@@ -263,6 +264,7 @@ module ShopifyCLI
|
|
263
264
|
{{bold:Options:}}
|
264
265
|
{{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
|
265
266
|
{{cyan:--port=PORT}}: Use custom port.
|
267
|
+
{{cyan:--no-update}}: Skips the dashboard URL update step
|
266
268
|
HELP
|
267
269
|
open_info: <<~MESSAGE,
|
268
270
|
{{*}} To install and start using your app, open this URL in your browser:
|
@@ -283,6 +285,13 @@ module ShopifyCLI
|
|
283
285
|
},
|
284
286
|
extension: {
|
285
287
|
push: {
|
288
|
+
beacon_extension: {
|
289
|
+
error: {
|
290
|
+
file_read_error: "There was a problem reading %s",
|
291
|
+
missing_config_key_error: "Configuration is missing key: %s",
|
292
|
+
invalid_config_value_error: "Configuration value is invalid: %s",
|
293
|
+
},
|
294
|
+
},
|
286
295
|
checkout_ui_extension: {
|
287
296
|
localization: {
|
288
297
|
error: {
|
@@ -294,6 +303,7 @@ module ShopifyCLI
|
|
294
303
|
invalid_file_extension: "Invalid locale filename: `%s`; only .json files are allowed.",
|
295
304
|
invalid_locale_code: "Invalid locale filename: `%s`; locale code should be 2 or 3 letters,"\
|
296
305
|
" optionally followed by a two-letter region code, e.g. `fr-CA`.",
|
306
|
+
invalid_file_encoding: "Invalid file encoding for `%s`; file encoding should be UTF-8.",
|
297
307
|
single_default_locale: "There must be one and only one locale identified as the default locale,"\
|
298
308
|
" e.g. `en.default.json`",
|
299
309
|
},
|
@@ -447,6 +457,11 @@ module ShopifyCLI
|
|
447
457
|
shop_prompt: <<~PROMPT,
|
448
458
|
What store are you connecting to? (e.g. my-store.myshopify.com; do {{bold:NOT}} include protocol part, e.g., https://)
|
449
459
|
PROMPT
|
460
|
+
spinner: {
|
461
|
+
initiating: "Initiating authentication",
|
462
|
+
finalizing: "Finalizing authentication",
|
463
|
+
loading_organizations: "Loading available partner organizations",
|
464
|
+
},
|
450
465
|
},
|
451
466
|
|
452
467
|
logout: {
|
@@ -714,7 +729,6 @@ module ShopifyCLI
|
|
714
729
|
updated: "{{v}} Whitelist URLS updated in Partners Dashboard}}",
|
715
730
|
update_error:
|
716
731
|
"{{x}} error: For authentication issues, run {{command:%s logout}} to clear invalid credentials",
|
717
|
-
update_prompt: "Do you want to update your application url?",
|
718
732
|
},
|
719
733
|
select_org_and_shop: {
|
720
734
|
authentication_issue: "For authentication issues, run {{command:%s logout}} to clear invalid credentials",
|
@@ -746,16 +760,12 @@ module ShopifyCLI
|
|
746
760
|
" package manager for your system.",
|
747
761
|
ngrok: "Something went wrong with ngrok installation,"\
|
748
762
|
"please make sure %s exists within %s before trying again",
|
763
|
+
signup_required: "A free ngrok account is required: {{underline:https://ngrok.com/signup}}. After you "\
|
764
|
+
"signup, install your personal authorization token using {{command:%s app tunnel auth <token>}}.",
|
749
765
|
},
|
750
766
|
installing: "Installing ngrok…",
|
751
767
|
not_running: "{{green:x}} ngrok tunnel not running",
|
752
768
|
prereq_command_location: "%s @ %s",
|
753
|
-
signup_suggestion: <<~MESSAGE,
|
754
|
-
{{*}} To avoid tunnels that timeout, it is recommended to signup for a free ngrok
|
755
|
-
account at {{underline:https://ngrok.com/signup}}. After you signup, install your
|
756
|
-
personalized authorization token using {{command:%s app tunnel auth <token>}}.
|
757
|
-
MESSAGE
|
758
|
-
start: "{{v}} ngrok tunnel running at {{underline:%s}}",
|
759
769
|
start_with_account: "{{v}} ngrok tunnel running at {{underline:%s}}, with account %s",
|
760
770
|
stopped: "{{green:x}} ngrok tunnel stopped",
|
761
771
|
timed_out: "{{x}} ngrok tunnel has timed out, restarting…",
|
data/lib/shopify_cli/release.rb
CHANGED
@@ -109,7 +109,9 @@ module ShopifyCLI
|
|
109
109
|
|
110
110
|
def check_ruby
|
111
111
|
ruby_version = Environment.ruby_version(context: context)
|
112
|
-
return if ruby_version.satisfies?("~>2.5") ||
|
112
|
+
return if ruby_version.satisfies?("~>2.5") ||
|
113
|
+
ruby_version.satisfies?("~>3.0.0") ||
|
114
|
+
ruby_version.satisfies?("~>3.1.0")
|
113
115
|
context.abort(context.message("core.app.create.rails.error.invalid_ruby_version"))
|
114
116
|
end
|
115
117
|
|
@@ -205,6 +207,12 @@ module ShopifyCLI
|
|
205
207
|
end
|
206
208
|
|
207
209
|
def set_custom_ua
|
210
|
+
requires_ua_file = Dir.chdir(context.root) do
|
211
|
+
context.ruby_gem_version("shopify_app") < ::Semantic::Version.new("19.0.0")
|
212
|
+
end
|
213
|
+
|
214
|
+
return unless requires_ua_file
|
215
|
+
|
208
216
|
ua_path = File.join("config", "initializers", "user_agent.rb")
|
209
217
|
context.write(ua_path, USER_AGENT_CODE)
|
210
218
|
end
|
@@ -2,32 +2,9 @@ module ShopifyCLI
|
|
2
2
|
module Services
|
3
3
|
module App
|
4
4
|
module Serve
|
5
|
-
class NodeService <
|
6
|
-
attr_accessor :host, :port, :context
|
7
|
-
|
8
|
-
def initialize(host:, port:, context:)
|
9
|
-
@host = host
|
10
|
-
@port = port
|
11
|
-
@context = context
|
12
|
-
super()
|
13
|
-
end
|
14
|
-
|
5
|
+
class NodeService < ServeService
|
15
6
|
def call
|
16
|
-
|
17
|
-
url = host || ShopifyCLI::Tunnel.start(context, port: port)
|
18
|
-
raise ShopifyCLI::Abort,
|
19
|
-
context.message("core.app.serve.error.host_must_be_https") if url.match(/^https/i).nil?
|
20
|
-
project.env.update(context, :host, url)
|
21
|
-
ShopifyCLI::Tasks::UpdateDashboardURLS.call(
|
22
|
-
context,
|
23
|
-
url: url,
|
24
|
-
callback_url: "/auth/callback",
|
25
|
-
)
|
26
|
-
|
27
|
-
if project.env.shop
|
28
|
-
project_url = "#{project.env.host}/auth?shop=#{project.env.shop}"
|
29
|
-
context.puts("\n" + context.message("core.app.serve.open_info", project_url) + "\n")
|
30
|
-
end
|
7
|
+
generate_url
|
31
8
|
|
32
9
|
CLI::UI::Frame.open(context.message("core.app.serve.running_server")) do
|
33
10
|
env = project.env.to_h
|
@@ -2,32 +2,9 @@ module ShopifyCLI
|
|
2
2
|
module Services
|
3
3
|
module App
|
4
4
|
module Serve
|
5
|
-
class PHPService <
|
6
|
-
attr_accessor :host, :port, :context
|
7
|
-
|
8
|
-
def initialize(host:, port:, context:)
|
9
|
-
@host = host
|
10
|
-
@port = port
|
11
|
-
@context = context
|
12
|
-
super()
|
13
|
-
end
|
14
|
-
|
5
|
+
class PHPService < ServeService
|
15
6
|
def call
|
16
|
-
|
17
|
-
url = host || ShopifyCLI::Tunnel.start(context, port: port)
|
18
|
-
raise ShopifyCLI::Abort,
|
19
|
-
context.message("core.app.serve.error.host_must_be_https") if url.match(/^https/i).nil?
|
20
|
-
project.env.update(context, :host, url)
|
21
|
-
ShopifyCLI::Tasks::UpdateDashboardURLS.call(
|
22
|
-
context,
|
23
|
-
url: url,
|
24
|
-
callback_url: "/auth/callback",
|
25
|
-
)
|
26
|
-
|
27
|
-
if project.env.shop
|
28
|
-
project_url = "#{project.env.host}/login?shop=#{project.env.shop}"
|
29
|
-
context.puts("\n" + context.message("core.app.serve.open_info", project_url) + "\n")
|
30
|
-
end
|
7
|
+
generate_url
|
31
8
|
|
32
9
|
CLI::UI::Frame.open(context.message("core.app.serve.running_server")) do
|
33
10
|
if ShopifyCLI::ProcessSupervision.running?(:npm_watch)
|
@@ -2,38 +2,18 @@ module ShopifyCLI
|
|
2
2
|
module Services
|
3
3
|
module App
|
4
4
|
module Serve
|
5
|
-
class RailsService <
|
6
|
-
attr_accessor :host, :port, :context
|
7
|
-
|
8
|
-
def initialize(host:, port:, context:)
|
9
|
-
@host = host
|
10
|
-
@port = port
|
11
|
-
@context = context
|
12
|
-
super()
|
13
|
-
end
|
14
|
-
|
5
|
+
class RailsService < ServeService
|
15
6
|
def call
|
16
|
-
|
17
|
-
url = host || ShopifyCLI::Tunnel.start(context, port: port)
|
18
|
-
raise ShopifyCLI::Abort,
|
19
|
-
context.message("core.app.serve.error.host_must_be_https") if url.match(/^https/i).nil?
|
20
|
-
project.env.update(context, :host, url)
|
21
|
-
ShopifyCLI::Tasks::UpdateDashboardURLS.call(
|
22
|
-
context,
|
23
|
-
url: url,
|
24
|
-
callback_url: "/auth/shopify/callback",
|
25
|
-
)
|
26
|
-
|
27
|
-
if project.env.shop
|
28
|
-
project_url = "#{project.env.host}/login?shop=#{project.env.shop}"
|
29
|
-
context.puts("\n" + context.message("core.app.serve.open_info", project_url) + "\n")
|
30
|
-
end
|
7
|
+
generate_url
|
31
8
|
|
32
9
|
CLI::UI::Frame.open(context.message("core.app.serve.running_server")) do
|
33
|
-
|
34
|
-
env.
|
10
|
+
original_env = JSON.parse(ENV["ORIGINAL_ENV"] || "{}")
|
11
|
+
env = original_env.merge(ShopifyCLI::Project.current.env.to_h)
|
12
|
+
env.delete("HOST") if context.ruby_gem_version("shopify_app") < ::Semantic::Version.new("19.0.0")
|
35
13
|
env["PORT"] = port.to_s
|
36
|
-
env["GEM_PATH"] =
|
14
|
+
env["GEM_PATH"] =
|
15
|
+
[env["GEM_PATH"], Rails::Gem.gem_path(context)].compact
|
16
|
+
.join(CLI::UI::OS.current.path_separator)
|
37
17
|
if context.windows?
|
38
18
|
context.system("ruby bin\\rails server", env: env)
|
39
19
|
else
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module ShopifyCLI
|
2
|
+
module Services
|
3
|
+
module App
|
4
|
+
module Serve
|
5
|
+
class ServeService < BaseService
|
6
|
+
attr_accessor :host, :port, :no_update, :context
|
7
|
+
|
8
|
+
def initialize(host:, port:, no_update:, context:)
|
9
|
+
@host = host
|
10
|
+
@port = port
|
11
|
+
@no_update = no_update
|
12
|
+
@context = context
|
13
|
+
super()
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
raise NotImplementedError
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def generate_url
|
23
|
+
create_tunnel
|
24
|
+
update_url unless no_update
|
25
|
+
show_app_url
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_tunnel
|
29
|
+
url = host || ShopifyCLI::Tunnel.start(context, port: port)
|
30
|
+
raise ShopifyCLI::Abort,
|
31
|
+
context.message("core.app.serve.error.host_must_be_https") if url.match(/^https/i).nil?
|
32
|
+
project.env.update(context, :host, url)
|
33
|
+
end
|
34
|
+
|
35
|
+
def update_url
|
36
|
+
ShopifyCLI::Tasks::UpdateDashboardURLS.call(
|
37
|
+
context,
|
38
|
+
url: project.env.host,
|
39
|
+
callback_url: "/auth/shopify/callback",
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def show_app_url
|
44
|
+
return unless project.env.shop
|
45
|
+
|
46
|
+
project_url = "#{project.env.host}/login?shop=#{project.env.shop}"
|
47
|
+
context.puts("\n" + context.message("core.app.serve.open_info", project_url) + "\n")
|
48
|
+
end
|
49
|
+
|
50
|
+
def project
|
51
|
+
@project ||= ShopifyCLI::Project.current
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/shopify_cli/services.rb
CHANGED
@@ -5,6 +5,7 @@ module ShopifyCLI
|
|
5
5
|
|
6
6
|
module App
|
7
7
|
module Serve
|
8
|
+
autoload :ServeService, "shopify_cli/services/app/serve/serve_service"
|
8
9
|
autoload :NodeService, "shopify_cli/services/app/serve/node_service"
|
9
10
|
autoload :RailsService, "shopify_cli/services/app/serve/rails_service"
|
10
11
|
autoload :PHPService, "shopify_cli/services/app/serve/php_service"
|
@@ -9,24 +9,22 @@ module ShopifyCLI
|
|
9
9
|
api_key = project.env.api_key
|
10
10
|
result = ShopifyCLI::PartnersAPI.query(ctx, "get_app_urls", apiKey: api_key)
|
11
11
|
app = result["data"]["app"]
|
12
|
-
|
12
|
+
|
13
|
+
return if app["applicationUrl"].match(url)
|
14
|
+
|
13
15
|
constructed_urls = construct_redirect_urls(app["redirectUrlWhitelist"], url, callback_url)
|
14
|
-
return if url == app["applicationUrl"]
|
15
16
|
ShopifyCLI::PartnersAPI.query(@ctx, "update_dashboard_urls", input: {
|
16
|
-
applicationUrl:
|
17
|
-
redirectUrlWhitelist: constructed_urls,
|
17
|
+
applicationUrl: url,
|
18
|
+
redirectUrlWhitelist: constructed_urls,
|
19
|
+
apiKey: api_key,
|
18
20
|
})
|
21
|
+
|
19
22
|
@ctx.puts(@ctx.message("core.tasks.update_dashboard_urls.updated"))
|
20
23
|
rescue
|
21
24
|
@ctx.puts(@ctx.message("core.tasks.update_dashboard_urls.update_error", ShopifyCLI::TOOL_NAME))
|
22
25
|
raise
|
23
26
|
end
|
24
27
|
|
25
|
-
def check_application_url(application_url, new_url)
|
26
|
-
return false if application_url.match(new_url)
|
27
|
-
CLI::UI::Prompt.confirm(@ctx.message("core.tasks.update_dashboard_urls.update_prompt"))
|
28
|
-
end
|
29
|
-
|
30
28
|
def construct_redirect_urls(urls, new_url, callback_url)
|
31
29
|
new_urls = urls.map do |url|
|
32
30
|
if (match = url.match(NGROK_REGEX))
|
@@ -46,20 +46,14 @@ module ShopifyCLI
|
|
46
46
|
files
|
47
47
|
.select { |file| @theme.theme_file?(file) }
|
48
48
|
.map { |file| @theme[file] }
|
49
|
-
.reject { |file| ignore_file?(file) }
|
49
|
+
.reject { |file| @syncer.ignore_file?(file) }
|
50
50
|
end
|
51
51
|
|
52
52
|
def filter_remote_files(files)
|
53
53
|
files
|
54
54
|
.select { |file| @syncer.remote_file?(file) }
|
55
55
|
.map { |file| @theme[file] }
|
56
|
-
.reject { |file| ignore_file?(file) }
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def ignore_file?(file)
|
62
|
-
@ignore_filter&.ignore?(file.relative_path)
|
56
|
+
.reject { |file| @syncer.ignore_file?(file) }
|
63
57
|
end
|
64
58
|
end
|
65
59
|
end
|
@@ -32,7 +32,7 @@ module ShopifyCLI
|
|
32
32
|
theme = DevelopmentTheme.find_or_create!(ctx, root: root)
|
33
33
|
ignore_filter = IgnoreFilter.from_path(root)
|
34
34
|
@syncer = Syncer.new(ctx, theme: theme, ignore_filter: ignore_filter, overwrite_json: !editor_sync)
|
35
|
-
watcher = Watcher.new(ctx, theme: theme, syncer: @syncer,
|
35
|
+
watcher = Watcher.new(ctx, theme: theme, syncer: @syncer, poll: poll)
|
36
36
|
remote_watcher = RemoteWatcher.to(theme: theme, syncer: @syncer)
|
37
37
|
|
38
38
|
# Setup the middleware stack. Mimics Rack::Builder / config.ru, but in reverse order
|
@@ -92,7 +92,8 @@ module ShopifyCLI
|
|
92
92
|
|
93
93
|
rescue ShopifyCLI::API::APIRequestForbiddenError,
|
94
94
|
ShopifyCLI::API::APIRequestUnauthorizedError
|
95
|
-
|
95
|
+
shop = ShopifyCLI::AdminAPI.get_shop_or_abort(@ctx)
|
96
|
+
raise ShopifyCLI::Abort, @ctx.message("theme.serve.ensure_user", shop)
|
96
97
|
rescue Errno::EADDRINUSE
|
97
98
|
error_message = @ctx.message("theme.serve.address_already_in_use", address)
|
98
99
|
help_message = @ctx.message("theme.serve.try_port_option")
|
@@ -37,10 +37,10 @@ module ShopifyCLI
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def glob(pattern, raise_on_dir: false)
|
40
|
-
root
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
root
|
41
|
+
.glob(pattern)
|
42
|
+
.select { |path| file?(path, raise_on_dir) }
|
43
|
+
.map { |path| File.new(path, root) }
|
44
44
|
end
|
45
45
|
|
46
46
|
def theme_file?(file)
|
@@ -155,6 +155,13 @@ module ShopifyCLI
|
|
155
155
|
end
|
156
156
|
|
157
157
|
class << self
|
158
|
+
def create_unpublished(ctx, root: nil, name: nil)
|
159
|
+
name ||= random_name
|
160
|
+
theme = new(ctx, root: root, name: name, role: "unpublished")
|
161
|
+
theme.create
|
162
|
+
theme
|
163
|
+
end
|
164
|
+
|
158
165
|
def all(ctx, root: nil)
|
159
166
|
_status, body = fetch_themes(ctx)
|
160
167
|
|
@@ -182,6 +189,10 @@ module ShopifyCLI
|
|
182
189
|
|
183
190
|
private
|
184
191
|
|
192
|
+
def random_name
|
193
|
+
ShopifyCLI::Helpers::Haikunator.haikunate(9999)
|
194
|
+
end
|
195
|
+
|
185
196
|
def find(ctx, root, &block)
|
186
197
|
_status, body = fetch_themes(ctx)
|
187
198
|
|
@@ -222,9 +233,12 @@ module ShopifyCLI
|
|
222
233
|
self
|
223
234
|
end
|
224
235
|
|
225
|
-
def
|
226
|
-
|
227
|
-
|
236
|
+
def file?(path, raise_on_dir = false)
|
237
|
+
if raise_on_dir && ::File.directory?(path)
|
238
|
+
@ctx.abort(@ctx.message("theme.serve.error.invalid_subdirectory", path.to_s))
|
239
|
+
end
|
240
|
+
|
241
|
+
::File.file?(path)
|
228
242
|
end
|
229
243
|
end
|
230
244
|
end
|
@@ -41,31 +41,46 @@ module ShopifyCLI
|
|
41
41
|
)
|
42
42
|
rescue ShopifyCLI::API::APIRequestForbiddenError,
|
43
43
|
ShopifyCLI::API::APIRequestUnauthorizedError => error
|
44
|
+
|
45
|
+
##
|
44
46
|
# The Admin API returns 403 Forbidden responses on different
|
45
47
|
# scenarios:
|
46
48
|
#
|
47
49
|
# * when a user doesn't have permissions for a request:
|
48
|
-
# <APIRequestForbiddenError: 403 {}>
|
50
|
+
# - <APIRequestForbiddenError: 403 {}>
|
51
|
+
# - <APIRequestForbiddenError: 403 {"errors":"Unauthorized Access"}>
|
49
52
|
#
|
50
53
|
# * when an asset operation cannot be performed:
|
51
|
-
# <APIRequestForbiddenError: 403 {"message":"templates/gift_card.liquid could not be deleted"}>
|
52
|
-
|
53
|
-
|
54
|
+
# - <APIRequestForbiddenError: 403 {"message":"templates/gift_card.liquid could not be deleted"}>
|
55
|
+
#
|
56
|
+
if empty_response?(error) || unauthorized_response?(error)
|
57
|
+
return permission_error
|
54
58
|
end
|
55
59
|
|
56
60
|
raise error
|
57
61
|
end
|
58
62
|
|
59
|
-
def
|
63
|
+
def permission_error
|
60
64
|
ensure_user_error = @ctx.message("theme.ensure_user_error", shop)
|
61
65
|
ensure_user_try_this = @ctx.message("theme.ensure_user_try_this")
|
62
66
|
|
63
67
|
@ctx.abort(ensure_user_error, ensure_user_try_this)
|
64
68
|
end
|
65
69
|
|
66
|
-
def
|
67
|
-
|
68
|
-
|
70
|
+
def empty_response?(error)
|
71
|
+
response_body(error).empty?
|
72
|
+
end
|
73
|
+
|
74
|
+
def unauthorized_response?(error)
|
75
|
+
parsed_body = JSON.parse(response_body(error))
|
76
|
+
errors = parsed_body["errors"].to_s
|
77
|
+
errors.match?(/Unauthorized Access/)
|
78
|
+
rescue JSON::ParserError
|
79
|
+
false
|
80
|
+
end
|
81
|
+
|
82
|
+
def response_body(error)
|
83
|
+
error&.response&.body.to_s
|
69
84
|
end
|
70
85
|
end
|
71
86
|
end
|
data/lib/shopify_cli/tunnel.rb
CHANGED
@@ -66,14 +66,9 @@ module ShopifyCLI
|
|
66
66
|
#
|
67
67
|
def start(ctx, port: PORT)
|
68
68
|
install(ctx)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
else
|
73
|
-
url, _ = restart_ngrok(ctx, port)
|
74
|
-
ctx.puts(ctx.message("core.tunnel.start", url))
|
75
|
-
ctx.puts(ctx.message("core.tunnel.signup_suggestion", ShopifyCLI::TOOL_NAME))
|
76
|
-
end
|
69
|
+
ctx.abort(ctx.message("core.tunnel.error.signup_required", ShopifyCLI::TOOL_NAME)) unless authenticated?
|
70
|
+
url, account = start_ngrok(ctx, port)
|
71
|
+
ctx.puts(ctx.message("core.tunnel.start_with_account", url, account))
|
77
72
|
url
|
78
73
|
end
|
79
74
|
|
@@ -208,11 +203,6 @@ module ShopifyCLI
|
|
208
203
|
[log.url, log.account]
|
209
204
|
end
|
210
205
|
|
211
|
-
def restart_ngrok(ctx, port)
|
212
|
-
ShopifyCLI::ProcessSupervision.stop(:ngrok)
|
213
|
-
start_ngrok(ctx, port)
|
214
|
-
end
|
215
|
-
|
216
206
|
def check_prereq_command(ctx, command)
|
217
207
|
cmd_path = ctx.which(command)
|
218
208
|
ctx.abort(ctx.message("core.tunnel.error.prereq_command_required", command)) if cmd_path.nil?
|
data/lib/shopify_cli/version.rb
CHANGED
@@ -35,6 +35,10 @@ module CLI
|
|
35
35
|
def shift_cursor_on_line_reset?
|
36
36
|
false
|
37
37
|
end
|
38
|
+
|
39
|
+
def path_separator
|
40
|
+
":"
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
@@ -58,6 +62,10 @@ module CLI
|
|
58
62
|
def shift_cursor_on_line_reset?
|
59
63
|
true
|
60
64
|
end
|
65
|
+
|
66
|
+
def path_separator
|
67
|
+
";"
|
68
|
+
end
|
61
69
|
end
|
62
70
|
end
|
63
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.15.
|
4
|
+
version: 2.15.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -158,15 +158,19 @@ files:
|
|
158
158
|
- ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256
|
159
159
|
- ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256
|
160
160
|
- ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256
|
161
|
+
- ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256
|
161
162
|
- ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256
|
162
163
|
- ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256
|
163
164
|
- ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256
|
165
|
+
- ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256
|
164
166
|
- ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256
|
165
167
|
- ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256
|
166
168
|
- ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256
|
169
|
+
- ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256
|
167
170
|
- ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256
|
168
171
|
- ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256
|
169
172
|
- ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256
|
173
|
+
- ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256
|
170
174
|
- ext/javy/javy.rb
|
171
175
|
- ext/javy/version
|
172
176
|
- ext/shopify-extensions/extconf.rb
|
@@ -247,6 +251,9 @@ files:
|
|
247
251
|
- lib/project_types/extension/models/server_config/root.rb
|
248
252
|
- lib/project_types/extension/models/server_config/user.rb
|
249
253
|
- lib/project_types/extension/models/specification.rb
|
254
|
+
- lib/project_types/extension/models/specification_handlers/beacon_extension.rb
|
255
|
+
- lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config.rb
|
256
|
+
- lib/project_types/extension/models/specification_handlers/beacon_extension_utils/script_config_repository.rb
|
250
257
|
- lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb
|
251
258
|
- lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
|
252
259
|
- lib/project_types/extension/models/specification_handlers/default.rb
|
@@ -335,6 +342,7 @@ files:
|
|
335
342
|
- lib/project_types/script/layers/infrastructure/script_service.rb
|
336
343
|
- lib/project_types/script/layers/infrastructure/script_uploader.rb
|
337
344
|
- lib/project_types/script/layers/infrastructure/service_locator.rb
|
345
|
+
- lib/project_types/script/layers/infrastructure/sparse_checkout_details.rb
|
338
346
|
- lib/project_types/script/loaders/project.rb
|
339
347
|
- lib/project_types/script/loaders/specification_handler.rb
|
340
348
|
- lib/project_types/script/messages/messages.rb
|
@@ -354,6 +362,7 @@ files:
|
|
354
362
|
- lib/project_types/theme/commands/pull.rb
|
355
363
|
- lib/project_types/theme/commands/push.rb
|
356
364
|
- lib/project_types/theme/commands/serve.rb
|
365
|
+
- lib/project_types/theme/commands/share.rb
|
357
366
|
- lib/project_types/theme/conversions/base_glob.rb
|
358
367
|
- lib/project_types/theme/conversions/ignore_glob.rb
|
359
368
|
- lib/project_types/theme/conversions/include_glob.rb
|
@@ -465,6 +474,7 @@ files:
|
|
465
474
|
- lib/shopify_cli/services/app/serve/node_service.rb
|
466
475
|
- lib/shopify_cli/services/app/serve/php_service.rb
|
467
476
|
- lib/shopify_cli/services/app/serve/rails_service.rb
|
477
|
+
- lib/shopify_cli/services/app/serve/serve_service.rb
|
468
478
|
- lib/shopify_cli/services/app/tunnel/auth_service.rb
|
469
479
|
- lib/shopify_cli/services/app/tunnel/start_service.rb
|
470
480
|
- lib/shopify_cli/services/app/tunnel/stop_service.rb
|