shopify-cli 2.34.0 → 2.35.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +2 -2
- data/lib/project_types/extension/commands/serve.rb +10 -0
- data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +1 -1
- data/lib/project_types/theme/commands/push.rb +1 -0
- data/lib/project_types/theme/commands/serve.rb +1 -0
- data/lib/shopify_cli/messages/messages.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/hot_reload/script_injector.rb +1 -1
- data/lib/shopify_cli/theme/dev_server/hot_reload.rb +9 -2
- data/lib/shopify_cli/theme/dev_server/local_assets.rb +8 -3
- data/lib/shopify_cli/theme/dev_server.rb +5 -1
- data/lib/shopify_cli/theme/extension/dev_server.rb +7 -4
- data/lib/shopify_cli/theme/extension/host_theme.rb +19 -14
- data/lib/shopify_cli/theme/syncer/standard_reporter.rb +2 -2
- data/lib/shopify_cli/theme/syncer.rb +1 -1
- data/lib/shopify_cli/version.rb +1 -1
- data/shopify-cli.gemspec +1 -1
- data/vendor/deps/smart_properties/lib/smart_properties/property.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7ff4aa2c4934ffc7d8ea74b5411396057302d3c689de0118e8d575dffe1f80e
|
4
|
+
data.tar.gz: 3f6c1e379cf651d615f12f399bb219f791cf9881e910f0b253a2d7511acdb3af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63f11f8ba2303796b678fcc0a0b30163ec556bdb3551ed6b3f0b036e2bf2564c9c8adfde10a23d9cd45bfaa67f5fcff678fc25055243edd2b99c2445fbb7a8e7
|
7
|
+
data.tar.gz: eca42fd71a12ed6fd22547b55590c2bcf64e0ed675420478de0b771e9483d4a42e5c959d967a301cc5814b7393ca51b29444cbd4873349249122f3af9d962e1d
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## Version 2.35.0 - 2023-02-22
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
* [#2721](https://github.com/Shopify/shopify-cli/pull/2721): Do not `replace_asset_urls` in font bodies
|
9
|
+
* [#2729](https://github.com/Shopify/shopify-cli/pull/2729): Do not inject hot-reload code into web-pixels-manager sandbox (from cli#1370)
|
10
|
+
* [#2731](https://github.com/Shopify/shopify-cli/pull/2731): The CLI should not report IO messages when the `--json` flag is passed
|
11
|
+
|
12
|
+
### Added
|
13
|
+
* [#2724](https://github.com/Shopify/shopify-cli/pull/2724): Introduce hidden `--overwrite-json` flag
|
14
|
+
* [#2729](https://github.com/Shopify/shopify-cli/pull/2729): Introduce hidden `--generate_tmp_theme` flag (from cli#1264)
|
15
|
+
|
5
16
|
## Version 2.34.0 - 2023-01-11
|
6
17
|
|
7
18
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shopify-cli (2.
|
4
|
+
shopify-cli (2.35.0)
|
5
5
|
bugsnag (~> 6.22)
|
6
6
|
listen (~> 3.7.0)
|
7
7
|
theme-check (~> 1.14.0)
|
@@ -165,7 +165,7 @@ PLATFORMS
|
|
165
165
|
ruby
|
166
166
|
|
167
167
|
DEPENDENCIES
|
168
|
-
bundler (
|
168
|
+
bundler (>= 2.3.11)
|
169
169
|
byebug
|
170
170
|
colorize (~> 0.8.1)
|
171
171
|
cucumber (~> 7.0)
|
@@ -20,6 +20,9 @@ module Extension
|
|
20
20
|
parser.on("-T", "--theme=NAME_OR_ID", "Theme ID or name of the theme app extension host theme.") do |theme|
|
21
21
|
flags[:theme] = theme
|
22
22
|
end
|
23
|
+
parser.on("--generate-tmp-theme", "Populate host theme, created by CLI 3, with assets") do |generate_tmp_theme|
|
24
|
+
flags[:generate_tmp_theme] = generate_tmp_theme
|
25
|
+
end
|
23
26
|
parser.on("--api-key=API_KEY", "Connect your extension and app by inserting your app's API key") do |api_key|
|
24
27
|
flags[:api_key] = api_key.gsub('"', "")
|
25
28
|
end
|
@@ -45,6 +48,7 @@ module Extension
|
|
45
48
|
property! :tunnel_requested, accepts: [true, false], reader: :tunnel_requested?, default: true
|
46
49
|
property :port, accepts: (1...(2**16))
|
47
50
|
property :theme, accepts: String, default: nil
|
51
|
+
property :generate_tmp_theme, accepts: [true, false], reader: :generate_tmp_theme?, default: false
|
48
52
|
property :api_key, accepts: String, default: nil
|
49
53
|
property :api_secret, accepts: String, default: nil
|
50
54
|
property :registration_id, accepts: String, default: nil
|
@@ -60,6 +64,7 @@ module Extension
|
|
60
64
|
resource_url: options.flags[:resource_url],
|
61
65
|
port: options.flags[:port],
|
62
66
|
theme: options.flags[:theme],
|
67
|
+
generate_tmp_theme: generate_tmp_theme?,
|
63
68
|
api_key: options.flags[:api_key],
|
64
69
|
api_secret: options.flags[:api_secret],
|
65
70
|
registration_id: options.flags[:registration_id],
|
@@ -103,6 +108,10 @@ module Extension
|
|
103
108
|
tunnel.nil? || !!tunnel
|
104
109
|
end
|
105
110
|
|
111
|
+
def generate_tmp_theme?
|
112
|
+
options.flags[:generate_tmp_theme] == true
|
113
|
+
end
|
114
|
+
|
106
115
|
def find_available_port(runtime_configuration)
|
107
116
|
return runtime_configuration unless runtime_configuration.port.nil?
|
108
117
|
return runtime_configuration unless specification_handler.choose_port?(@ctx)
|
@@ -137,6 +146,7 @@ module Extension
|
|
137
146
|
tunnel_url: runtime_configuration.tunnel_url,
|
138
147
|
port: runtime_configuration.port,
|
139
148
|
theme: runtime_configuration.theme,
|
149
|
+
generate_tmp_theme: runtime_configuration.generate_tmp_theme?,
|
140
150
|
api_key: runtime_configuration.api_key,
|
141
151
|
api_secret: runtime_configuration.api_secret,
|
142
152
|
registration_id: runtime_configuration.registration_id,
|
@@ -313,7 +313,7 @@ module ShopifyCLI
|
|
313
313
|
},
|
314
314
|
error_reporting: {
|
315
315
|
unhandled_error: {
|
316
|
-
message: "{{x}} {{red:An unexpected error
|
316
|
+
message: "{{x}} {{red:An unexpected error occurred.}}",
|
317
317
|
issue_message: "{{red:\tTo \e]8;;%s\e\\submit an issue\e]8;;\e\\"\
|
318
318
|
" include the stack trace.}}",
|
319
319
|
stacktrace_message: "{{red:\tTo print the stack trace, add the environment variable %s.}}",
|
@@ -16,12 +16,15 @@ module ShopifyCLI
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call(env)
|
19
|
-
|
19
|
+
path = env["PATH_INFO"]
|
20
|
+
if path == "/hot-reload"
|
20
21
|
create_stream
|
21
22
|
else
|
22
23
|
status, headers, body = @app.call(env)
|
23
24
|
|
24
|
-
|
25
|
+
if request_is_html?(headers) && leads_to_injectable_body?(path)
|
26
|
+
body = inject_hot_reload_javascript(body)
|
27
|
+
end
|
25
28
|
|
26
29
|
[status, headers, body]
|
27
30
|
end
|
@@ -43,6 +46,10 @@ module ShopifyCLI
|
|
43
46
|
headers["content-type"]&.start_with?("text/html")
|
44
47
|
end
|
45
48
|
|
49
|
+
def leads_to_injectable_body?(path)
|
50
|
+
path !~ /web-pixels-manager.+sandbox/
|
51
|
+
end
|
52
|
+
|
46
53
|
def inject_hot_reload_javascript(body)
|
47
54
|
@script_injector&.inject(body: body, dir: __dir__, mode: @mode)
|
48
55
|
end
|
@@ -29,13 +29,14 @@ module ShopifyCLI
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def call(env)
|
32
|
-
|
32
|
+
path_info = env["PATH_INFO"]
|
33
|
+
if path_info.start_with?("/assets")
|
33
34
|
# Serve from disk
|
34
|
-
serve_file(
|
35
|
+
serve_file(path_info)
|
35
36
|
else
|
36
37
|
# Proxy the request, and replace the URLs in the response
|
37
38
|
status, headers, body = @app.call(env)
|
38
|
-
body = replace_asset_urls(body)
|
39
|
+
body = replace_asset_urls(body) unless path_info.start_with?("/fonts")
|
39
40
|
[status, headers, body]
|
40
41
|
end
|
41
42
|
end
|
@@ -53,6 +54,10 @@ module ShopifyCLI
|
|
53
54
|
end
|
54
55
|
|
55
56
|
[replaced_body]
|
57
|
+
rescue ArgumentError => error
|
58
|
+
return [body.join] if error.message.include?("invalid byte sequence")
|
59
|
+
|
60
|
+
raise error
|
56
61
|
end
|
57
62
|
|
58
63
|
def serve_fail(status, body)
|
@@ -41,6 +41,7 @@ module ShopifyCLI
|
|
41
41
|
port: 9292,
|
42
42
|
poll: false,
|
43
43
|
editor_sync: false,
|
44
|
+
overwrite_json: false,
|
44
45
|
stable: false,
|
45
46
|
mode: ReloadMode.default,
|
46
47
|
includes: nil,
|
@@ -55,6 +56,7 @@ module ShopifyCLI
|
|
55
56
|
port,
|
56
57
|
poll,
|
57
58
|
editor_sync,
|
59
|
+
overwrite_json,
|
58
60
|
stable,
|
59
61
|
mode,
|
60
62
|
includes,
|
@@ -78,6 +80,7 @@ module ShopifyCLI
|
|
78
80
|
port,
|
79
81
|
poll,
|
80
82
|
editor_sync,
|
83
|
+
overwrite_json,
|
81
84
|
stable,
|
82
85
|
mode,
|
83
86
|
includes,
|
@@ -91,6 +94,7 @@ module ShopifyCLI
|
|
91
94
|
@port = port
|
92
95
|
@poll = poll
|
93
96
|
@editor_sync = editor_sync
|
97
|
+
@overwrite_json = overwrite_json
|
94
98
|
@stable = stable
|
95
99
|
@mode = mode
|
96
100
|
@includes = includes
|
@@ -199,7 +203,7 @@ module ShopifyCLI
|
|
199
203
|
theme: theme,
|
200
204
|
include_filter: include_filter,
|
201
205
|
ignore_filter: ignore_filter,
|
202
|
-
overwrite_json: !editor_sync,
|
206
|
+
overwrite_json: !editor_sync || @overwrite_json,
|
203
207
|
stable: stable
|
204
208
|
)
|
205
209
|
end
|
@@ -26,12 +26,13 @@ module ShopifyCLI
|
|
26
26
|
# Extensions
|
27
27
|
ScriptInjector = ShopifyCLI::Theme::Extension::DevServer::HotReload::ScriptInjector
|
28
28
|
|
29
|
-
attr_accessor :project, :specification_handler
|
29
|
+
attr_accessor :project, :specification_handler, :generate_tmp_theme
|
30
30
|
|
31
31
|
class << self
|
32
|
-
def start(ctx, root, port: 9292, theme: nil, project:, specification_handler:)
|
32
|
+
def start(ctx, root, port: 9292, theme: nil, generate_tmp_theme: false, project:, specification_handler:)
|
33
33
|
instance.project = project
|
34
34
|
instance.specification_handler = specification_handler
|
35
|
+
instance.generate_tmp_theme = generate_tmp_theme
|
35
36
|
|
36
37
|
super(ctx, root, port: port, theme: theme)
|
37
38
|
end
|
@@ -66,8 +67,10 @@ module ShopifyCLI
|
|
66
67
|
|
67
68
|
def theme
|
68
69
|
@theme ||= if theme_identifier
|
69
|
-
theme =
|
70
|
-
|
70
|
+
theme = HostTheme.find_by_identifier(ctx, identifier: theme_identifier)
|
71
|
+
ctx.abort(not_found_error_message) unless theme
|
72
|
+
theme.generate_tmp_theme if generate_tmp_theme
|
73
|
+
theme
|
71
74
|
else
|
72
75
|
HostTheme.find_or_create!(ctx)
|
73
76
|
end
|
@@ -61,20 +61,9 @@ module ShopifyCLI
|
|
61
61
|
new(ctx, root: nil).ensure_exists!
|
62
62
|
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
hostname = Socket.gethostname.split(".").shift
|
68
|
-
hash = SecureRandom.hex(3)
|
69
|
-
|
70
|
-
theme_name = "App Ext. Host ()"
|
71
|
-
hostname_character_limit = API_NAME_LIMIT - theme_name.length - hash.length - 1
|
72
|
-
identifier = encode_identifier("#{hash}-#{hostname[0, hostname_character_limit]}")
|
73
|
-
theme_name = "App Ext. Host (#{identifier})"
|
74
|
-
|
75
|
-
ShopifyCLI::DB.set(host_theme_name: theme_name)
|
76
|
-
|
77
|
-
theme_name
|
64
|
+
def self.find_by_identifier(ctx, root: nil, identifier:)
|
65
|
+
ShopifyCLI::DB.set(host_theme_id: identifier)
|
66
|
+
find(ctx, root: root)
|
78
67
|
end
|
79
68
|
|
80
69
|
def generate_tmp_theme
|
@@ -98,6 +87,22 @@ module ShopifyCLI
|
|
98
87
|
end
|
99
88
|
end
|
100
89
|
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def generate_host_theme_name
|
94
|
+
hostname = Socket.gethostname.split(".").shift
|
95
|
+
hash = SecureRandom.hex(3)
|
96
|
+
|
97
|
+
theme_name = "App Ext. Host ()"
|
98
|
+
hostname_character_limit = API_NAME_LIMIT - theme_name.length - hash.length - 1
|
99
|
+
identifier = encode_identifier("#{hash}-#{hostname[0, hostname_character_limit]}")
|
100
|
+
theme_name = "App Ext. Host (#{identifier})"
|
101
|
+
|
102
|
+
ShopifyCLI::DB.set(host_theme_name: theme_name)
|
103
|
+
|
104
|
+
theme_name
|
105
|
+
end
|
101
106
|
end
|
102
107
|
end
|
103
108
|
end
|
@@ -5,7 +5,7 @@ module ShopifyCLI
|
|
5
5
|
class Syncer
|
6
6
|
##
|
7
7
|
# ShopifyCLI::Theme::Syncer::StdReporter allows disabling/enabling
|
8
|
-
# messages reported in the standard output (ShopifyCLI::Context#puts).
|
8
|
+
# messages reported in the standard error output (ShopifyCLI::Context#puts).
|
9
9
|
#
|
10
10
|
class StandardReporter
|
11
11
|
attr_reader :ctx
|
@@ -24,7 +24,7 @@ module ShopifyCLI
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def report(message)
|
27
|
-
ctx.
|
27
|
+
ctx.error(message) if @enabled
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -33,7 +33,7 @@ module ShopifyCLI
|
|
33
33
|
:union_merge, # - Union merges the local file content with the remote file content
|
34
34
|
]
|
35
35
|
|
36
|
-
attr_reader :ctx, :theme, :checksums, :error_checksums, :api_client, :pending
|
36
|
+
attr_reader :ctx, :theme, :checksums, :error_checksums, :api_client, :pending, :standard_reporter
|
37
37
|
attr_accessor :include_filter, :ignore_filter
|
38
38
|
|
39
39
|
def_delegators :@error_reporter, :has_any_error?
|
data/lib/shopify_cli/version.rb
CHANGED
data/shopify-cli.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.require_paths = ["lib", "vendor"]
|
36
36
|
spec.executables << "shopify"
|
37
37
|
|
38
|
-
spec.add_development_dependency("bundler", "
|
38
|
+
spec.add_development_dependency("bundler", ">= 2.3.11")
|
39
39
|
spec.add_development_dependency("rake", "~> 12.3", ">= 12.3.3")
|
40
40
|
spec.add_development_dependency("minitest", "~> 5.0")
|
41
41
|
|
@@ -157,7 +157,7 @@ module SmartProperties
|
|
157
157
|
rescue NoMethodError => error
|
158
158
|
# BasicObject does not respond to #nil? by default, so we need to double
|
159
159
|
# check if somebody implemented it and it fails internally or if the
|
160
|
-
# error
|
160
|
+
# error occurred because the method is actually not present. In the former
|
161
161
|
# case, we want to raise the exception because there is something wrong
|
162
162
|
# with the implementation of object#nil?. In the latter case we treat the
|
163
163
|
# object as truthy because we don't know better.
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.35.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.3.11
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.3.11
|
27
27
|
- !ruby/object:Gem::Dependency
|