shopify-cli 2.7.0 → 2.7.4
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/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
|
@@ -2,24 +2,31 @@
|
|
|
2
2
|
require "thread"
|
|
3
3
|
require "json"
|
|
4
4
|
require "base64"
|
|
5
|
+
require "forwardable"
|
|
6
|
+
|
|
7
|
+
require_relative "syncer/error_reporter"
|
|
8
|
+
require_relative "syncer/standard_reporter"
|
|
9
|
+
require_relative "syncer/operation"
|
|
5
10
|
|
|
6
11
|
module ShopifyCLI
|
|
7
12
|
module Theme
|
|
8
13
|
class Syncer
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"#{method} #{file&.relative_path}"
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
+
extend Forwardable
|
|
15
|
+
|
|
14
16
|
API_VERSION = "unstable"
|
|
15
17
|
|
|
16
18
|
attr_reader :checksums
|
|
17
19
|
attr_accessor :ignore_filter
|
|
18
20
|
|
|
21
|
+
def_delegators :@error_reporter, :has_any_error?
|
|
22
|
+
|
|
19
23
|
def initialize(ctx, theme:, ignore_filter: nil)
|
|
20
24
|
@ctx = ctx
|
|
21
25
|
@theme = theme
|
|
22
26
|
@ignore_filter = ignore_filter
|
|
27
|
+
@error_reporter = ErrorReporter.new(ctx)
|
|
28
|
+
@standard_reporter = StandardReporter.new(ctx)
|
|
29
|
+
@reporters = [@error_reporter, @standard_reporter]
|
|
23
30
|
|
|
24
31
|
# Queue of `Operation`s waiting to be picked up from a thread for processing.
|
|
25
32
|
@queue = Queue.new
|
|
@@ -30,12 +37,19 @@ module ShopifyCLI
|
|
|
30
37
|
# Mutex used to pause all threads when backing-off when hitting API rate limits
|
|
31
38
|
@backoff_mutex = Mutex.new
|
|
32
39
|
|
|
33
|
-
# Allows delaying log of errors, mainly to not break the progress bar.
|
|
34
|
-
@delay_errors = false
|
|
35
|
-
@delayed_errors = []
|
|
36
|
-
|
|
37
40
|
# Latest theme assets checksums. Updated on each upload.
|
|
38
41
|
@checksums = {}
|
|
42
|
+
|
|
43
|
+
# Checksums of assets with errors.
|
|
44
|
+
@error_checksums = []
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def lock_io!
|
|
48
|
+
@reporters.each { |reporter| reporter.disable! }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def unlock_io!
|
|
52
|
+
@reporters.each { |reporter| reporter.enable! }
|
|
39
53
|
end
|
|
40
54
|
|
|
41
55
|
def enqueue_updates(files)
|
|
@@ -103,25 +117,14 @@ module ShopifyCLI
|
|
|
103
117
|
break if operation.nil? # shutdown was called
|
|
104
118
|
perform(operation)
|
|
105
119
|
rescue Exception => e
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
)
|
|
120
|
+
error_suffix = ": #{e}"
|
|
121
|
+
error_suffix += + "\n\t#{e.backtrace.join("\n\t")}" if @ctx.debug?
|
|
122
|
+
report_error(operation, error_suffix)
|
|
110
123
|
end
|
|
111
124
|
end
|
|
112
125
|
end
|
|
113
126
|
end
|
|
114
127
|
|
|
115
|
-
def delay_errors!
|
|
116
|
-
@delay_errors = true
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def report_errors!
|
|
120
|
-
@delay_errors = false
|
|
121
|
-
@delayed_errors.each { |error| report_error(error) }
|
|
122
|
-
@delayed_errors.clear
|
|
123
|
-
end
|
|
124
|
-
|
|
125
128
|
def upload_theme!(delay_low_priority_files: false, delete: true, &block)
|
|
126
129
|
fetch_checksums!
|
|
127
130
|
|
|
@@ -177,21 +180,27 @@ module ShopifyCLI
|
|
|
177
180
|
|
|
178
181
|
private
|
|
179
182
|
|
|
183
|
+
def report_error(operation, error_suffix = "")
|
|
184
|
+
@error_checksums << @checksums[operation.file_path]
|
|
185
|
+
@error_reporter.report("#{operation.as_error_message}#{error_suffix}")
|
|
186
|
+
end
|
|
187
|
+
|
|
180
188
|
def enqueue(method, file)
|
|
181
189
|
raise ArgumentError, "file required" unless file
|
|
182
190
|
|
|
183
|
-
operation = Operation.new(method, @theme[file])
|
|
191
|
+
operation = Operation.new(@ctx, method, @theme[file])
|
|
184
192
|
|
|
185
193
|
# Already enqueued
|
|
186
194
|
return if @pending.include?(operation)
|
|
187
195
|
|
|
188
|
-
if @ignore_filter&.ignore?(operation.
|
|
189
|
-
@ctx.debug("ignore #{operation.
|
|
196
|
+
if @ignore_filter&.ignore?(operation.file_path)
|
|
197
|
+
@ctx.debug("ignore #{operation.file_path}")
|
|
190
198
|
return
|
|
191
199
|
end
|
|
192
200
|
|
|
193
201
|
if [:update, :get].include?(method) && operation.file.exist? && !file_has_changed?(operation.file)
|
|
194
|
-
|
|
202
|
+
is_fixed = !!@error_checksums.delete(operation.file.checksum)
|
|
203
|
+
@standard_reporter.report(operation.as_fix_message) if is_fixed
|
|
195
204
|
return
|
|
196
205
|
end
|
|
197
206
|
|
|
@@ -206,16 +215,16 @@ module ShopifyCLI
|
|
|
206
215
|
|
|
207
216
|
response = send(operation.method, operation.file)
|
|
208
217
|
|
|
218
|
+
@standard_reporter.report(operation.as_synced_message)
|
|
219
|
+
|
|
209
220
|
# Check if the API told us we're near the rate limit
|
|
210
221
|
if !backingoff? && (limit = response["x-shopify-shop-api-call-limit"])
|
|
211
222
|
used, total = limit.split("/").map(&:to_i)
|
|
212
223
|
backoff_if_near_limit!(used, total)
|
|
213
224
|
end
|
|
214
225
|
rescue ShopifyCLI::API::APIRequestError => e
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
parse_api_errors(e).join("\n ")
|
|
218
|
-
)
|
|
226
|
+
error_suffix = ":\n " + parse_api_errors(e).join("\n ")
|
|
227
|
+
report_error(operation, error_suffix)
|
|
219
228
|
ensure
|
|
220
229
|
@pending.delete(operation)
|
|
221
230
|
end
|
|
@@ -295,14 +304,6 @@ module ShopifyCLI
|
|
|
295
304
|
file.checksum != @checksums[file.relative_path.to_s]
|
|
296
305
|
end
|
|
297
306
|
|
|
298
|
-
def report_error(error)
|
|
299
|
-
if @delay_errors
|
|
300
|
-
@delayed_errors << error
|
|
301
|
-
else
|
|
302
|
-
@ctx.puts(error)
|
|
303
|
-
end
|
|
304
|
-
end
|
|
305
|
-
|
|
306
307
|
def parse_api_errors(exception)
|
|
307
308
|
parsed_body = JSON.parse(exception&.response&.body)
|
|
308
309
|
message = parsed_body.dig("errors", "asset") || parsed_body["message"] || exception.message
|
|
@@ -162,26 +162,38 @@ module ShopifyCLI
|
|
|
162
162
|
}
|
|
163
163
|
end
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
ctx
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
165
|
+
class << self
|
|
166
|
+
def all(ctx, root: nil)
|
|
167
|
+
_status, body = fetch_themes(ctx)
|
|
168
|
+
|
|
169
|
+
body["themes"]
|
|
170
|
+
.sort_by { |theme_attrs| Time.parse(theme_attrs["updated_at"]) }
|
|
171
|
+
.reverse
|
|
172
|
+
.map { |theme_attrs| new(ctx, root: root, **allowed_attrs(theme_attrs)) }
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def live(ctx, root: nil)
|
|
176
|
+
_status, body = fetch_themes(ctx)
|
|
172
177
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
178
|
+
body["themes"]
|
|
179
|
+
.find { |theme_attrs| theme_attrs["role"] == "main" }
|
|
180
|
+
.tap { |theme_attrs| break new(ctx, root: root, **allowed_attrs(theme_attrs)) }
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
private
|
|
184
|
+
|
|
185
|
+
def allowed_attrs(attrs)
|
|
186
|
+
attrs.slice("id", "name", "role").transform_keys(&:to_sym)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def fetch_themes(ctx)
|
|
190
|
+
AdminAPI.rest_request(
|
|
191
|
+
ctx,
|
|
192
|
+
shop: AdminAPI.get_shop_or_abort(ctx),
|
|
193
|
+
path: "themes.json",
|
|
194
|
+
api_version: "unstable",
|
|
195
|
+
)
|
|
196
|
+
end
|
|
185
197
|
end
|
|
186
198
|
|
|
187
199
|
private
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ShopifyCLI
|
|
4
|
+
class ThreadPool
|
|
5
|
+
class Job
|
|
6
|
+
attr_reader :error
|
|
7
|
+
|
|
8
|
+
def perform!
|
|
9
|
+
raise "`#{self.class.name}#perform!` must be defined"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def call
|
|
13
|
+
perform!
|
|
14
|
+
rescue StandardError => error
|
|
15
|
+
@error = error
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def success?
|
|
19
|
+
!@error
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def error?
|
|
23
|
+
!!@error
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ShopifyCLI
|
|
4
|
+
class ThreadPool
|
|
5
|
+
attr_reader :errors
|
|
6
|
+
|
|
7
|
+
def initialize(pool_size: 10)
|
|
8
|
+
@jobs = Queue.new
|
|
9
|
+
@pool = Array.new(pool_size) { spawn_thread }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def schedule(job)
|
|
13
|
+
@jobs << job
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def shutdown
|
|
17
|
+
@pool.size.times do
|
|
18
|
+
schedule(-> { throw(:stop_thread) })
|
|
19
|
+
end
|
|
20
|
+
@pool.map(&:join)
|
|
21
|
+
ensure
|
|
22
|
+
@jobs.close
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def spawn_thread
|
|
28
|
+
Thread.new do
|
|
29
|
+
catch(:stop_thread) do
|
|
30
|
+
loop do
|
|
31
|
+
@jobs.pop.call
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/shopify_cli/tunnel.rb
CHANGED
|
@@ -12,7 +12,7 @@ module ShopifyCLI
|
|
|
12
12
|
class Tunnel
|
|
13
13
|
extend SingleForwardable
|
|
14
14
|
|
|
15
|
-
def_delegators :new, :start, :stop, :auth, :stats, :urls, :running_on?
|
|
15
|
+
def_delegators :new, :start, :stop, :auth, :authenticated?, :stats, :urls, :running_on?
|
|
16
16
|
|
|
17
17
|
class FetchUrlError < RuntimeError; end
|
|
18
18
|
class NgrokError < RuntimeError; end
|
|
@@ -21,6 +21,7 @@ module ShopifyCLI
|
|
|
21
21
|
# mapping for supported operating systems for where to download ngrok from.
|
|
22
22
|
DOWNLOAD_URLS = {
|
|
23
23
|
mac: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip",
|
|
24
|
+
mac_m1: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-arm64.zip",
|
|
24
25
|
linux: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip",
|
|
25
26
|
windows: "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip",
|
|
26
27
|
}
|
|
@@ -65,16 +66,12 @@ module ShopifyCLI
|
|
|
65
66
|
#
|
|
66
67
|
def start(ctx, port: PORT)
|
|
67
68
|
install(ctx)
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
if authenticated?
|
|
70
|
+
url, account = start_ngrok(ctx, port)
|
|
70
71
|
ctx.puts(ctx.message("core.tunnel.start_with_account", url, account))
|
|
71
72
|
else
|
|
72
|
-
|
|
73
|
-
ctx.puts(ctx.message("core.tunnel.timed_out"))
|
|
74
|
-
url, _account, seconds_remaining = restart_ngrok(ctx, port)
|
|
75
|
-
end
|
|
73
|
+
url, _ = restart_ngrok(ctx, port)
|
|
76
74
|
ctx.puts(ctx.message("core.tunnel.start", url))
|
|
77
|
-
ctx.puts(ctx.message("core.tunnel.will_timeout", seconds_to_hm(seconds_remaining)))
|
|
78
75
|
ctx.puts(ctx.message("core.tunnel.signup_suggestion", ShopifyCLI::TOOL_NAME))
|
|
79
76
|
end
|
|
80
77
|
url
|
|
@@ -91,7 +88,16 @@ module ShopifyCLI
|
|
|
91
88
|
#
|
|
92
89
|
def auth(ctx, token)
|
|
93
90
|
install(ctx)
|
|
94
|
-
ctx.system(
|
|
91
|
+
ctx.system(ngrok_path(ctx), "authtoken", token)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
##
|
|
95
|
+
# returns a boolean: if the user has a ngrok token to authenticate
|
|
96
|
+
#
|
|
97
|
+
def authenticated?
|
|
98
|
+
ngrok_config_path = File.join(Dir.home, ".ngrok2/ngrok.yml")
|
|
99
|
+
return false unless File.exist?(ngrok_config_path)
|
|
100
|
+
File.read(ngrok_config_path).include?("authtoken")
|
|
95
101
|
end
|
|
96
102
|
|
|
97
103
|
##
|
|
@@ -145,7 +151,7 @@ module ShopifyCLI
|
|
|
145
151
|
|
|
146
152
|
def install(ctx)
|
|
147
153
|
ngrok = "ngrok#{ctx.executable_file_extension}"
|
|
148
|
-
return if File.exist?(
|
|
154
|
+
return if File.exist?(ngrok_path(ctx))
|
|
149
155
|
check_prereq_command(ctx, "curl")
|
|
150
156
|
check_prereq_command(ctx, ctx.linux? ? "unzip" : "tar")
|
|
151
157
|
spinner = CLI::UI::SpinGroup.new
|
|
@@ -165,7 +171,7 @@ module ShopifyCLI
|
|
|
165
171
|
spinner.wait
|
|
166
172
|
|
|
167
173
|
# final check to see if ngrok is accessible
|
|
168
|
-
unless File.exist?(
|
|
174
|
+
unless File.exist?(ngrok_path(ctx))
|
|
169
175
|
ctx.abort(ctx.message("core.tunnel.error.ngrok", ngrok, ShopifyCLI.cache_dir))
|
|
170
176
|
end
|
|
171
177
|
end
|
|
@@ -177,8 +183,9 @@ module ShopifyCLI
|
|
|
177
183
|
raise e.class, e.message
|
|
178
184
|
end
|
|
179
185
|
|
|
180
|
-
def
|
|
181
|
-
|
|
186
|
+
def ngrok_path(ctx)
|
|
187
|
+
ngrok = "ngrok#{ctx.executable_file_extension}"
|
|
188
|
+
File.join(ShopifyCLI.cache_dir, ngrok)
|
|
182
189
|
end
|
|
183
190
|
|
|
184
191
|
def seconds_to_hm(seconds)
|
|
@@ -186,16 +193,14 @@ module ShopifyCLI
|
|
|
186
193
|
end
|
|
187
194
|
|
|
188
195
|
def start_ngrok(ctx, port)
|
|
189
|
-
|
|
196
|
+
ngrok_command = "\"#{ngrok_path(ctx)}\" http -inspect=false -log=stdout -log-level=debug #{port}"
|
|
197
|
+
process = ShopifyCLI::ProcessSupervision.start(:ngrok, ngrok_command)
|
|
190
198
|
log = fetch_url(ctx, process.log_path)
|
|
191
|
-
|
|
192
|
-
[log.url, log.account, seconds_remaining]
|
|
199
|
+
[log.url, log.account]
|
|
193
200
|
end
|
|
194
201
|
|
|
195
202
|
def restart_ngrok(ctx, port)
|
|
196
|
-
|
|
197
|
-
ctx.abort(ctx.message("core.tunnel.error.stop"))
|
|
198
|
-
end
|
|
203
|
+
ShopifyCLI::ProcessSupervision.stop(:ngrok)
|
|
199
204
|
start_ngrok(ctx, port)
|
|
200
205
|
end
|
|
201
206
|
|
|
@@ -208,7 +213,7 @@ module ShopifyCLI
|
|
|
208
213
|
class LogParser # :nodoc:
|
|
209
214
|
TIMEOUT = 10
|
|
210
215
|
|
|
211
|
-
attr_reader :url, :account
|
|
216
|
+
attr_reader :url, :account
|
|
212
217
|
|
|
213
218
|
def initialize(log_path)
|
|
214
219
|
@log_path = log_path
|
|
@@ -237,9 +242,8 @@ module ShopifyCLI
|
|
|
237
242
|
end
|
|
238
243
|
|
|
239
244
|
def parse_account
|
|
240
|
-
account,
|
|
245
|
+
account, _ = @log.match(/AccountName:(.*)\s+SessionDuration/)&.captures
|
|
241
246
|
@account = account&.empty? ? nil : account
|
|
242
|
-
@timeout = timeout&.empty? ? 0 : timeout.to_i
|
|
243
247
|
end
|
|
244
248
|
|
|
245
249
|
def error
|
data/lib/shopify_cli/version.rb
CHANGED
data/shopify-cli.gemspec
CHANGED
|
@@ -114,7 +114,9 @@ module CLI
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
def print_error_message(e)
|
|
117
|
-
|
|
117
|
+
CLI::UI::Frame.open("Error", color: :red, timing: false) do
|
|
118
|
+
$stderr.puts(format_error_message(e.message))
|
|
119
|
+
end
|
|
118
120
|
end
|
|
119
121
|
end
|
|
120
122
|
end
|
|
@@ -222,7 +222,7 @@ module CLI
|
|
|
222
222
|
end
|
|
223
223
|
|
|
224
224
|
def which(cmd, env)
|
|
225
|
-
exts = os == :windows ? env.fetch('PATHEXT').split(';') : ['']
|
|
225
|
+
exts = os == :windows ? env.fetch('PATHEXT', ['']).split(';') : ['']
|
|
226
226
|
env.fetch('PATH', '').split(File::PATH_SEPARATOR).each do |path|
|
|
227
227
|
exts.each do |ext|
|
|
228
228
|
exe = File.join(path, "#{cmd}#{ext}")
|
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.7.
|
|
4
|
+
version: 2.7.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-12-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -92,14 +92,14 @@ dependencies:
|
|
|
92
92
|
requirements:
|
|
93
93
|
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 1.
|
|
95
|
+
version: 1.9.0
|
|
96
96
|
type: :runtime
|
|
97
97
|
prerelease: false
|
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 1.
|
|
102
|
+
version: 1.9.0
|
|
103
103
|
description: |
|
|
104
104
|
Shopify CLI helps you build Shopify apps faster. It quickly scaffolds Node.js
|
|
105
105
|
and Ruby on Rails embedded apps. It also automates many common tasks in the
|
|
@@ -150,6 +150,12 @@ files:
|
|
|
150
150
|
- docs/contributors/testing.md
|
|
151
151
|
- docs/users/installation.md
|
|
152
152
|
- docs/users/migrate-from-themekit.md
|
|
153
|
+
- ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256
|
|
154
|
+
- ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256
|
|
155
|
+
- ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256
|
|
156
|
+
- ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256
|
|
157
|
+
- ext/javy/javy.rb
|
|
158
|
+
- ext/javy/version
|
|
153
159
|
- ext/shopify-extensions/extconf.rb
|
|
154
160
|
- ext/shopify-extensions/shopify_extensions.rb
|
|
155
161
|
- ext/shopify-extensions/version
|
|
@@ -159,7 +165,6 @@ files:
|
|
|
159
165
|
- lib/graphql/admin_introspection.graphql
|
|
160
166
|
- lib/graphql/all_organizations.graphql
|
|
161
167
|
- lib/graphql/all_orgs_with_apps.graphql
|
|
162
|
-
- lib/graphql/all_orgs_with_extensions.graphql
|
|
163
168
|
- lib/graphql/api_versions.graphql
|
|
164
169
|
- lib/graphql/convert_dev_to_test_store.graphql
|
|
165
170
|
- lib/graphql/create_app.graphql
|
|
@@ -172,6 +177,7 @@ files:
|
|
|
172
177
|
- lib/graphql/find_organization.graphql
|
|
173
178
|
- lib/graphql/get_app_by_api_key.graphql
|
|
174
179
|
- lib/graphql/get_app_urls.graphql
|
|
180
|
+
- lib/graphql/get_extension_registrations.graphql
|
|
175
181
|
- lib/graphql/get_variant_id.graphql
|
|
176
182
|
- lib/graphql/update_dashboard_urls.graphql
|
|
177
183
|
- lib/project_types/extension/cli.rb
|
|
@@ -207,6 +213,8 @@ files:
|
|
|
207
213
|
- lib/project_types/extension/forms/questions/ask_registration.rb
|
|
208
214
|
- lib/project_types/extension/forms/questions/ask_template.rb
|
|
209
215
|
- lib/project_types/extension/forms/questions/ask_type.rb
|
|
216
|
+
- lib/project_types/extension/loaders/project.rb
|
|
217
|
+
- lib/project_types/extension/loaders/specification_handler.rb
|
|
210
218
|
- lib/project_types/extension/messages/message_loading.rb
|
|
211
219
|
- lib/project_types/extension/messages/messages.rb
|
|
212
220
|
- lib/project_types/extension/models/app.rb
|
|
@@ -244,6 +252,10 @@ files:
|
|
|
244
252
|
- lib/project_types/extension/tasks/converters/version_converter.rb
|
|
245
253
|
- lib/project_types/extension/tasks/create_extension.rb
|
|
246
254
|
- lib/project_types/extension/tasks/ensure_resource_url.rb
|
|
255
|
+
- lib/project_types/extension/tasks/execute_commands/base.rb
|
|
256
|
+
- lib/project_types/extension/tasks/execute_commands/build.rb
|
|
257
|
+
- lib/project_types/extension/tasks/execute_commands/create.rb
|
|
258
|
+
- lib/project_types/extension/tasks/execute_commands/serve.rb
|
|
247
259
|
- lib/project_types/extension/tasks/fetch_specifications.rb
|
|
248
260
|
- lib/project_types/extension/tasks/find_npm_packages.rb
|
|
249
261
|
- lib/project_types/extension/tasks/find_package_from_json.rb
|
|
@@ -252,7 +264,6 @@ files:
|
|
|
252
264
|
- lib/project_types/extension/tasks/get_extensions.rb
|
|
253
265
|
- lib/project_types/extension/tasks/get_product.rb
|
|
254
266
|
- lib/project_types/extension/tasks/merge_server_config.rb
|
|
255
|
-
- lib/project_types/extension/tasks/run_extension_command.rb
|
|
256
267
|
- lib/project_types/extension/tasks/update_draft.rb
|
|
257
268
|
- lib/project_types/extension/tasks/user_errors.rb
|
|
258
269
|
- lib/project_types/node/cli.rb
|
|
@@ -268,16 +279,23 @@ files:
|
|
|
268
279
|
- lib/project_types/rails/messages/messages.rb
|
|
269
280
|
- lib/project_types/rails/ruby.rb
|
|
270
281
|
- lib/project_types/script/cli.rb
|
|
282
|
+
- lib/project_types/script/commands/connect.rb
|
|
271
283
|
- lib/project_types/script/commands/create.rb
|
|
284
|
+
- lib/project_types/script/commands/javy.rb
|
|
272
285
|
- lib/project_types/script/commands/push.rb
|
|
273
286
|
- lib/project_types/script/config/extension_points.yml
|
|
274
287
|
- lib/project_types/script/errors.rb
|
|
288
|
+
- lib/project_types/script/forms/ask_app.rb
|
|
289
|
+
- lib/project_types/script/forms/ask_org.rb
|
|
290
|
+
- lib/project_types/script/forms/ask_script_uuid.rb
|
|
275
291
|
- lib/project_types/script/forms/create.rb
|
|
292
|
+
- lib/project_types/script/forms/run_against_shopify_org.rb
|
|
276
293
|
- lib/project_types/script/graphql/app_script_set.graphql
|
|
277
294
|
- lib/project_types/script/graphql/get_app_scripts.graphql
|
|
278
295
|
- lib/project_types/script/graphql/module_upload_url_generate.graphql
|
|
279
296
|
- lib/project_types/script/graphql/script_service_proxy.graphql
|
|
280
297
|
- lib/project_types/script/layers/application/build_script.rb
|
|
298
|
+
- lib/project_types/script/layers/application/connect_app.rb
|
|
281
299
|
- lib/project_types/script/layers/application/create_script.rb
|
|
282
300
|
- lib/project_types/script/layers/application/extension_points.rb
|
|
283
301
|
- lib/project_types/script/layers/application/project_dependencies.rb
|
|
@@ -286,7 +304,7 @@ files:
|
|
|
286
304
|
- lib/project_types/script/layers/domain/extension_point.rb
|
|
287
305
|
- lib/project_types/script/layers/domain/metadata.rb
|
|
288
306
|
- lib/project_types/script/layers/domain/push_package.rb
|
|
289
|
-
- lib/project_types/script/layers/domain/
|
|
307
|
+
- lib/project_types/script/layers/domain/script_config.rb
|
|
290
308
|
- lib/project_types/script/layers/domain/script_project.rb
|
|
291
309
|
- lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb
|
|
292
310
|
- lib/project_types/script/layers/infrastructure/api_clients/script_service_api_client.rb
|
|
@@ -305,7 +323,6 @@ files:
|
|
|
305
323
|
- lib/project_types/script/layers/infrastructure/script_uploader.rb
|
|
306
324
|
- lib/project_types/script/layers/infrastructure/service_locator.rb
|
|
307
325
|
- lib/project_types/script/messages/messages.rb
|
|
308
|
-
- lib/project_types/script/tasks/ensure_env.rb
|
|
309
326
|
- lib/project_types/script/ui/error_handler.rb
|
|
310
327
|
- lib/project_types/script/ui/printing_spinner.rb
|
|
311
328
|
- lib/project_types/script/ui/strict_spinner.rb
|
|
@@ -396,6 +413,8 @@ files:
|
|
|
396
413
|
- lib/shopify_cli/options.rb
|
|
397
414
|
- lib/shopify_cli/packager.rb
|
|
398
415
|
- lib/shopify_cli/partners_api.rb
|
|
416
|
+
- lib/shopify_cli/partners_api/app_extensions.rb
|
|
417
|
+
- lib/shopify_cli/partners_api/app_extensions/job.rb
|
|
399
418
|
- lib/shopify_cli/partners_api/organizations.rb
|
|
400
419
|
- lib/shopify_cli/php_deps.rb
|
|
401
420
|
- lib/shopify_cli/process_supervision.rb
|
|
@@ -437,12 +456,14 @@ files:
|
|
|
437
456
|
- lib/shopify_cli/tasks/select_org_and_shop.rb
|
|
438
457
|
- lib/shopify_cli/tasks/update_dashboard_urls.rb
|
|
439
458
|
- lib/shopify_cli/theme/dev_server.rb
|
|
459
|
+
- lib/shopify_cli/theme/dev_server/cdn_fonts.rb
|
|
440
460
|
- lib/shopify_cli/theme/dev_server/certificate_manager.rb
|
|
441
461
|
- lib/shopify_cli/theme/dev_server/header_hash.rb
|
|
442
462
|
- lib/shopify_cli/theme/dev_server/hot-reload.js
|
|
443
463
|
- lib/shopify_cli/theme/dev_server/hot_reload.rb
|
|
444
464
|
- lib/shopify_cli/theme/dev_server/local_assets.rb
|
|
445
465
|
- lib/shopify_cli/theme/dev_server/proxy.rb
|
|
466
|
+
- lib/shopify_cli/theme/dev_server/proxy/template_param_builder.rb
|
|
446
467
|
- lib/shopify_cli/theme/dev_server/sse.rb
|
|
447
468
|
- lib/shopify_cli/theme/dev_server/watcher.rb
|
|
448
469
|
- lib/shopify_cli/theme/dev_server/web_server.rb
|
|
@@ -451,7 +472,12 @@ files:
|
|
|
451
472
|
- lib/shopify_cli/theme/ignore_filter.rb
|
|
452
473
|
- lib/shopify_cli/theme/mime_type.rb
|
|
453
474
|
- lib/shopify_cli/theme/syncer.rb
|
|
475
|
+
- lib/shopify_cli/theme/syncer/error_reporter.rb
|
|
476
|
+
- lib/shopify_cli/theme/syncer/operation.rb
|
|
477
|
+
- lib/shopify_cli/theme/syncer/standard_reporter.rb
|
|
454
478
|
- lib/shopify_cli/theme/theme.rb
|
|
479
|
+
- lib/shopify_cli/thread_pool.rb
|
|
480
|
+
- lib/shopify_cli/thread_pool/job.rb
|
|
455
481
|
- lib/shopify_cli/transform_data_structure.rb
|
|
456
482
|
- lib/shopify_cli/tunnel.rb
|
|
457
483
|
- lib/shopify_cli/version.rb
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
query AllOrgs ($type: String) {
|
|
2
|
-
organizations {
|
|
3
|
-
nodes {
|
|
4
|
-
id
|
|
5
|
-
businessName
|
|
6
|
-
website
|
|
7
|
-
apps(first: 500) {
|
|
8
|
-
nodes {
|
|
9
|
-
id
|
|
10
|
-
title
|
|
11
|
-
apiKey
|
|
12
|
-
apiSecretKeys{
|
|
13
|
-
secret
|
|
14
|
-
}
|
|
15
|
-
appType
|
|
16
|
-
extensionRegistrations(specificationIdentifier: $type) {
|
|
17
|
-
id
|
|
18
|
-
type
|
|
19
|
-
uuid
|
|
20
|
-
title
|
|
21
|
-
draftVersion {
|
|
22
|
-
registrationId
|
|
23
|
-
context
|
|
24
|
-
lastUserInteractionAt
|
|
25
|
-
location
|
|
26
|
-
validationErrors { field message }
|
|
27
|
-
|
|
28
|
-
id
|
|
29
|
-
uuid
|
|
30
|
-
versionTag
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|