shopify-cli 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +0 -4
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +4 -4
- data/lib/graphql/get_variant_id.graphql +16 -0
- data/lib/project_types/extension/cli.rb +9 -1
- data/lib/project_types/extension/commands/push.rb +0 -1
- data/lib/project_types/extension/commands/serve.rb +8 -2
- data/lib/project_types/extension/extension_project.rb +21 -1
- data/lib/project_types/extension/features/argo.rb +1 -11
- data/lib/project_types/extension/features/argo_runtime.rb +6 -38
- data/lib/project_types/extension/features/argo_serve.rb +30 -1
- data/lib/project_types/extension/features/runtimes/admin.rb +29 -0
- data/lib/project_types/extension/features/runtimes/base.rb +19 -0
- data/lib/project_types/extension/features/runtimes/checkout_post_purchase.rb +23 -0
- data/lib/project_types/extension/features/runtimes/checkout_ui_extension.rb +29 -0
- data/lib/project_types/extension/messages/messages.rb +9 -0
- data/lib/project_types/extension/models/product.rb +12 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +10 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +11 -3
- data/lib/project_types/extension/models/specification_handlers/default.rb +13 -4
- data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +12 -0
- data/lib/project_types/extension/tasks/configure_features.rb +1 -0
- data/lib/project_types/extension/tasks/converters/product_converter.rb +21 -0
- data/lib/project_types/extension/tasks/get_product.rb +22 -0
- data/lib/project_types/script/commands/create.rb +1 -1
- data/lib/project_types/script/graphql/app_script_set.graphql +40 -0
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +0 -44
- data/lib/project_types/script/graphql/module_upload_url_generate.graphql +9 -0
- data/lib/project_types/script/layers/domain/push_package.rb +1 -2
- data/lib/project_types/script/layers/infrastructure/errors.rb +2 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +0 -1
- data/lib/project_types/script/layers/infrastructure/script_service.rb +95 -45
- data/lib/project_types/script/messages/messages.rb +3 -0
- data/lib/project_types/script/ui/error_handler.rb +5 -0
- data/lib/project_types/theme/commands/pull.rb +6 -0
- data/lib/project_types/theme/commands/push.rb +6 -0
- data/lib/project_types/theme/forms/select.rb +1 -1
- data/lib/shopify-cli/core/monorail.rb +2 -1
- data/lib/shopify-cli/process_supervision.rb +14 -14
- data/lib/shopify-cli/theme/dev_server/header_hash.rb +4 -0
- data/lib/shopify-cli/theme/dev_server/proxy.rb +13 -1
- data/lib/shopify-cli/theme/file.rb +11 -3
- data/lib/shopify-cli/theme/ignore_filter.rb +7 -0
- data/lib/shopify-cli/theme/syncer.rb +1 -1
- data/lib/shopify-cli/version.rb +1 -1
- data/shopify-cli.gemspec +1 -1
- metadata +14 -4
@@ -141,6 +141,9 @@ module Script
|
|
141
141
|
web_assembly_binary_not_found_suggestion: "No WebAssembly binary found." \
|
142
142
|
"Check that your build npm script outputs the generated binary to the root of the directory." \
|
143
143
|
"Generated binary should match the script name: <script_name>.wasm",
|
144
|
+
|
145
|
+
script_upload_cause: "Fail to upload script.",
|
146
|
+
script_upload_help: "Try again.",
|
144
147
|
},
|
145
148
|
|
146
149
|
create: {
|
@@ -237,6 +237,11 @@ module Script
|
|
237
237
|
cause_of_error: ShopifyCli::Context.message("script.error.web_assembly_binary_not_found"),
|
238
238
|
help_suggestion: ShopifyCli::Context.message("script.error.web_assembly_binary_not_found_suggestion"),
|
239
239
|
}
|
240
|
+
when Layers::Infrastructure::Errors::ScriptUploadError
|
241
|
+
{
|
242
|
+
cause_of_error: ShopifyCli::Context.message("script.error.script_upload_cause"),
|
243
|
+
help_suggestion: ShopifyCli::Context.message("script.error.script_upload_help"),
|
244
|
+
}
|
240
245
|
end
|
241
246
|
end
|
242
247
|
end
|
@@ -9,6 +9,10 @@ module Theme
|
|
9
9
|
options do |parser, flags|
|
10
10
|
parser.on("-n", "--nodelete") { flags[:nodelete] = true }
|
11
11
|
parser.on("-i", "--themeid=ID") { |theme_id| flags[:theme_id] = theme_id }
|
12
|
+
parser.on("-x", "--ignore=PATTERN") do |pattern|
|
13
|
+
flags[:ignores] ||= []
|
14
|
+
flags[:ignores] << pattern
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
def call(args, _name)
|
@@ -29,6 +33,8 @@ module Theme
|
|
29
33
|
end
|
30
34
|
|
31
35
|
ignore_filter = ShopifyCli::Theme::IgnoreFilter.from_path(root)
|
36
|
+
ignore_filter.add_patterns(options.flags[:ignores]) if options.flags[:ignores]
|
37
|
+
|
32
38
|
syncer = ShopifyCli::Theme::Syncer.new(@ctx, theme: theme, ignore_filter: ignore_filter)
|
33
39
|
begin
|
34
40
|
syncer.start_threads
|
@@ -15,6 +15,10 @@ module Theme
|
|
15
15
|
parser.on("-j", "--json") { flags[:json] = true }
|
16
16
|
parser.on("-a", "--allow-live") { flags[:allow_live] = true }
|
17
17
|
parser.on("-p", "--publish") { flags[:publish] = true }
|
18
|
+
parser.on("-x", "--ignore=PATTERN") do |pattern|
|
19
|
+
flags[:ignores] ||= []
|
20
|
+
flags[:ignores] << pattern
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
def call(args, _name)
|
@@ -48,6 +52,8 @@ module Theme
|
|
48
52
|
end
|
49
53
|
|
50
54
|
ignore_filter = ShopifyCli::Theme::IgnoreFilter.from_path(root)
|
55
|
+
ignore_filter.add_patterns(options.flags[:ignores]) if options.flags[:ignores]
|
56
|
+
|
51
57
|
syncer = ShopifyCli::Theme::Syncer.new(@ctx, theme: theme, ignore_filter: ignore_filter)
|
52
58
|
begin
|
53
59
|
syncer.start_threads
|
@@ -46,7 +46,7 @@ module ShopifyCli
|
|
46
46
|
|
47
47
|
# we only want to send Monorail events in production or when explicitly developing
|
48
48
|
def enabled?
|
49
|
-
Context.new.system? || ENV["MONORAIL_REAL_EVENTS"] == "1"
|
49
|
+
(Context.new.system? || ENV["MONORAIL_REAL_EVENTS"] == "1") && !Context.new.ci?
|
50
50
|
end
|
51
51
|
|
52
52
|
def consented?
|
@@ -54,6 +54,7 @@ module ShopifyCli
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def prompt_for_consent
|
57
|
+
return if Context.new.ci?
|
57
58
|
return unless enabled?
|
58
59
|
return if ShopifyCli::Config.get_section("analytics").key?("enabled")
|
59
60
|
msg = Context.message("core.monorail.consent_prompt")
|
@@ -59,10 +59,20 @@ module ShopifyCli
|
|
59
59
|
def start(identifier, args)
|
60
60
|
return for_ident(identifier) if running?(identifier)
|
61
61
|
|
62
|
-
#
|
63
|
-
# that means that it dies along with the original process if it is interrupted.
|
64
|
-
# that it doesn't have to be restarted on every run.
|
65
|
-
if
|
62
|
+
# Some systems don't support forking process without extra gems, so we resort to spawning a new child process -
|
63
|
+
# that means that it dies along with the original process if it is interrupted. If possible, we fork the process
|
64
|
+
# so that it doesn't have to be restarted on every run.
|
65
|
+
if Process.respond_to?(:fork)
|
66
|
+
fork do
|
67
|
+
pid_file = new(identifier, pid: Process.pid)
|
68
|
+
pid_file.write
|
69
|
+
STDOUT.reopen(pid_file.log_path, "w")
|
70
|
+
STDERR.reopen(pid_file.log_path, "w")
|
71
|
+
STDIN.reopen("/dev/null", "r")
|
72
|
+
Process.setsid
|
73
|
+
exec(*args)
|
74
|
+
end
|
75
|
+
else
|
66
76
|
pid_file = new(identifier)
|
67
77
|
|
68
78
|
# Make sure the file exists and is empty, otherwise Windows fails
|
@@ -77,16 +87,6 @@ module ShopifyCli
|
|
77
87
|
pid_file.write
|
78
88
|
|
79
89
|
Process.detach(pid)
|
80
|
-
else
|
81
|
-
fork do
|
82
|
-
pid_file = new(identifier, pid: Process.pid)
|
83
|
-
pid_file.write
|
84
|
-
STDOUT.reopen(pid_file.log_path, "w")
|
85
|
-
STDERR.reopen(pid_file.log_path, "w")
|
86
|
-
STDIN.reopen("/dev/null", "r")
|
87
|
-
Process.setsid
|
88
|
-
exec(*args)
|
89
|
-
end
|
90
90
|
end
|
91
91
|
|
92
92
|
sleep(0.1)
|
@@ -47,6 +47,10 @@ module ShopifyCli
|
|
47
47
|
super(k) || super(@names[k.downcase])
|
48
48
|
end
|
49
49
|
|
50
|
+
def fetch(k, default = nil)
|
51
|
+
self[k] || super(@names[k.downcase], default)
|
52
|
+
end
|
53
|
+
|
50
54
|
def []=(k, v)
|
51
55
|
canonical = k.downcase.freeze
|
52
56
|
# .delete is expensive, don't invoke it unless necessary
|
@@ -155,11 +155,16 @@ module ShopifyCli
|
|
155
155
|
Time.now - @last_session_cookie_refresh >= SESSION_COOKIE_MAX_AGE
|
156
156
|
end
|
157
157
|
|
158
|
+
def extract_secure_session_id_from_response_headers(headers)
|
159
|
+
return unless headers["set-cookie"]
|
160
|
+
headers["set-cookie"][SESSION_COOKIE_REGEXP, 1]
|
161
|
+
end
|
162
|
+
|
158
163
|
def secure_session_id
|
159
164
|
if secure_session_id_expired?
|
160
165
|
@ctx.debug("Refreshing preview _secure_session_id cookie")
|
161
166
|
response = request("HEAD", "/", query: { preview_theme_id: @theme.id })
|
162
|
-
@secure_session_id = response
|
167
|
+
@secure_session_id = extract_secure_session_id_from_response_headers(response)
|
163
168
|
@last_session_cookie_refresh = Time.now
|
164
169
|
end
|
165
170
|
|
@@ -179,6 +184,13 @@ module ShopifyCli
|
|
179
184
|
response_headers["location"].gsub!(%r{(https://#{@theme.shop})}, "http://127.0.0.1:9292")
|
180
185
|
end
|
181
186
|
|
187
|
+
new_session_id = extract_secure_session_id_from_response_headers(response_headers)
|
188
|
+
if new_session_id
|
189
|
+
@ctx.debug("New _secure_session_id cookie from response")
|
190
|
+
@secure_session_id = new_session_id
|
191
|
+
@last_session_cookie_refresh = Time.now
|
192
|
+
end
|
193
|
+
|
182
194
|
response_headers
|
183
195
|
end
|
184
196
|
|
@@ -17,12 +17,20 @@ module ShopifyCli
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def read
|
20
|
-
|
20
|
+
if text?
|
21
|
+
path.read
|
22
|
+
else
|
23
|
+
path.read(mode: "rb")
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
|
-
def write(
|
27
|
+
def write(content)
|
24
28
|
path.parent.mkpath unless path.parent.directory?
|
25
|
-
|
29
|
+
if text?
|
30
|
+
path.write(content)
|
31
|
+
else
|
32
|
+
path.write(content, 0, mode: "wb")
|
33
|
+
end
|
26
34
|
end
|
27
35
|
|
28
36
|
def delete
|
@@ -256,7 +256,7 @@ module ShopifyCli
|
|
256
256
|
|
257
257
|
attachment = body.dig("asset", "attachment")
|
258
258
|
value = if attachment
|
259
|
-
file.write(Base64.decode64(attachment)
|
259
|
+
file.write(Base64.decode64(attachment))
|
260
260
|
else
|
261
261
|
file.write(body.dig("asset", "value"))
|
262
262
|
end
|
data/lib/shopify-cli/version.rb
CHANGED
data/shopify-cli.gemspec
CHANGED
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.
|
4
|
+
version: 2.3.0
|
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-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '1.
|
81
|
+
version: '1.2'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '1.
|
88
|
+
version: '1.2'
|
89
89
|
description: |
|
90
90
|
Shopify CLI helps you build Shopify apps faster. It quickly scaffolds Node.js
|
91
91
|
and Ruby on Rails embedded apps. It also automates many common tasks in the
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/graphql/find_organization.graphql
|
160
160
|
- lib/graphql/get_app_by_api_key.graphql
|
161
161
|
- lib/graphql/get_app_urls.graphql
|
162
|
+
- lib/graphql/get_variant_id.graphql
|
162
163
|
- lib/graphql/update_dashboard_urls.graphql
|
163
164
|
- lib/project_types/extension/cli.rb
|
164
165
|
- lib/project_types/extension/commands/build.rb
|
@@ -182,6 +183,10 @@ files:
|
|
182
183
|
- lib/project_types/extension/features/argo_setup.rb
|
183
184
|
- lib/project_types/extension/features/argo_setup_step.rb
|
184
185
|
- lib/project_types/extension/features/argo_setup_steps.rb
|
186
|
+
- lib/project_types/extension/features/runtimes/admin.rb
|
187
|
+
- lib/project_types/extension/features/runtimes/base.rb
|
188
|
+
- lib/project_types/extension/features/runtimes/checkout_post_purchase.rb
|
189
|
+
- lib/project_types/extension/features/runtimes/checkout_ui_extension.rb
|
185
190
|
- lib/project_types/extension/forms/connect.rb
|
186
191
|
- lib/project_types/extension/forms/create.rb
|
187
192
|
- lib/project_types/extension/forms/questions/ask_app.rb
|
@@ -193,6 +198,7 @@ files:
|
|
193
198
|
- lib/project_types/extension/models/app.rb
|
194
199
|
- lib/project_types/extension/models/lazy_specification_handler.rb
|
195
200
|
- lib/project_types/extension/models/npm_package.rb
|
201
|
+
- lib/project_types/extension/models/product.rb
|
196
202
|
- lib/project_types/extension/models/registration.rb
|
197
203
|
- lib/project_types/extension/models/specification.rb
|
198
204
|
- lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb
|
@@ -206,6 +212,7 @@ files:
|
|
206
212
|
- lib/project_types/extension/tasks/configure_features.rb
|
207
213
|
- lib/project_types/extension/tasks/configure_options.rb
|
208
214
|
- lib/project_types/extension/tasks/converters/app_converter.rb
|
215
|
+
- lib/project_types/extension/tasks/converters/product_converter.rb
|
209
216
|
- lib/project_types/extension/tasks/converters/registration_converter.rb
|
210
217
|
- lib/project_types/extension/tasks/converters/validation_error_converter.rb
|
211
218
|
- lib/project_types/extension/tasks/converters/version_converter.rb
|
@@ -215,6 +222,7 @@ files:
|
|
215
222
|
- lib/project_types/extension/tasks/get_app.rb
|
216
223
|
- lib/project_types/extension/tasks/get_apps.rb
|
217
224
|
- lib/project_types/extension/tasks/get_extensions.rb
|
225
|
+
- lib/project_types/extension/tasks/get_product.rb
|
218
226
|
- lib/project_types/extension/tasks/update_draft.rb
|
219
227
|
- lib/project_types/extension/tasks/user_errors.rb
|
220
228
|
- lib/project_types/node/cli.rb
|
@@ -248,8 +256,10 @@ files:
|
|
248
256
|
- lib/project_types/script/config/extension_points.yml
|
249
257
|
- lib/project_types/script/errors.rb
|
250
258
|
- lib/project_types/script/forms/create.rb
|
259
|
+
- lib/project_types/script/graphql/app_script_set.graphql
|
251
260
|
- lib/project_types/script/graphql/app_script_update_or_create.graphql
|
252
261
|
- lib/project_types/script/graphql/get_app_scripts.graphql
|
262
|
+
- lib/project_types/script/graphql/module_upload_url_generate.graphql
|
253
263
|
- lib/project_types/script/graphql/script_service_proxy.graphql
|
254
264
|
- lib/project_types/script/layers/application/build_script.rb
|
255
265
|
- lib/project_types/script/layers/application/create_script.rb
|