shopify-cli 2.1.0 → 2.2.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/CHANGELOG.md +7 -0
- data/Gemfile.lock +2 -2
- data/lib/graphql/get_variant_id.graphql +16 -0
- data/lib/project_types/extension/cli.rb +9 -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_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_ui_extension.rb +10 -2
- 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/theme/forms/select.rb +1 -1
- data/lib/shopify-cli/core/monorail.rb +2 -1
- data/lib/shopify-cli/version.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c65ab33bf57676cb65c04773cba1ae81a3852fd516283dde697a74f145c411e6
|
4
|
+
data.tar.gz: f74e40e7dcad523257c9535de75a121044bdc2f98acd1ac13dffd5310c4f9337
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 850bff5ac8a7b39f4574bfd77e6a9a20030a5c6bbc4dd03167839950cb52b8a365c928d54b261992634445eb081addb51103e178840d1899c8e49bf412cbaee2
|
7
|
+
data.tar.gz: 912ddbef4eb07b6a2f7587a64e27425cdf5f821a94bad31f9b56fd021f89960f34a37d885eaa9e04472c95eae56ae43025f414c872805ee935b6556b3e1cca91
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
Unreleased
|
2
2
|
------
|
3
3
|
|
4
|
+
Version 2.2.0
|
5
|
+
------
|
6
|
+
* [#1424](https://github.com/Shopify/shopify-cli/pull/1424/): Add `--resourceUrl` flag to extension serve command
|
7
|
+
* [#1419](https://github.com/Shopify/shopify-cli/pull/1419): Remove analytics prompt when used in CI
|
8
|
+
* [#1418](https://github.com/Shopify/shopify-cli/pull/1418): Auto configure resource URL for Checkout Extensions
|
9
|
+
* [#1399](https://github.com/Shopify/shopify-cli/pull/1399): Fix error when running `shopify extension serve` in a theme app extension project
|
10
|
+
|
4
11
|
Version 2.1.0
|
5
12
|
-------------
|
6
13
|
* [#1357](https://github.com/Shopify/shopify-cli/pull/1357): Update Theme-Check to 1.1
|
data/Gemfile.lock
CHANGED
@@ -40,12 +40,14 @@ module Extension
|
|
40
40
|
autoload :ChooseNextAvailablePort, Project.project_filepath("tasks/choose_next_available_port")
|
41
41
|
autoload :FindNpmPackages, Project.project_filepath("tasks/find_npm_packages")
|
42
42
|
autoload :GetExtensions, Project.project_filepath("tasks/get_extensions")
|
43
|
+
autoload :GetProduct, Project.project_filepath("tasks/get_product")
|
43
44
|
|
44
45
|
module Converters
|
45
46
|
autoload :RegistrationConverter, Project.project_filepath("tasks/converters/registration_converter")
|
46
47
|
autoload :VersionConverter, Project.project_filepath("tasks/converters/version_converter")
|
47
48
|
autoload :ValidationErrorConverter, Project.project_filepath("tasks/converters/validation_error_converter")
|
48
49
|
autoload :AppConverter, Project.project_filepath("tasks/converters/app_converter")
|
50
|
+
autoload :ProductConverter, Project.project_filepath("tasks/converters/product_converter")
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
@@ -63,6 +65,12 @@ module Extension
|
|
63
65
|
end
|
64
66
|
|
65
67
|
module Features
|
68
|
+
module Runtimes
|
69
|
+
autoload :Admin, Project.project_filepath("features/runtimes/admin")
|
70
|
+
autoload :Base, Project.project_filepath("features/runtimes/base")
|
71
|
+
autoload :CheckoutPostPurchase, Project.project_filepath("features/runtimes/checkout_post_purchase")
|
72
|
+
autoload :CheckoutUiExtension, Project.project_filepath("features/runtimes/checkout_ui_extension")
|
73
|
+
end
|
66
74
|
autoload :ArgoServe, Project.project_filepath("features/argo_serve")
|
67
75
|
autoload :ArgoServeOptions, Project.project_filepath("features/argo_serve_options")
|
68
76
|
autoload :ArgoSetup, Project.project_filepath("features/argo_setup")
|
@@ -77,7 +85,6 @@ module Extension
|
|
77
85
|
module Models
|
78
86
|
module SpecificationHandlers
|
79
87
|
autoload :Default, Project.project_filepath("models/specification_handlers/default")
|
80
|
-
autoload :CheckoutArgoExtension, Project.project_filepath("models/specification_handlers/checkout_ui_extension")
|
81
88
|
end
|
82
89
|
|
83
90
|
autoload :App, Project.project_filepath("models/app")
|
@@ -88,6 +95,7 @@ module Extension
|
|
88
95
|
autoload :Specifications, Project.project_filepath("models/specifications")
|
89
96
|
autoload :LazySpecificationHandler, Project.project_filepath("models/lazy_specification_handler")
|
90
97
|
autoload :NpmPackage, Project.project_filepath("models/npm_package")
|
98
|
+
autoload :Product, Project.project_filepath("models/product")
|
91
99
|
end
|
92
100
|
|
93
101
|
autoload :ExtensionProjectKeys, Project.project_filepath("extension_project_keys")
|
@@ -9,19 +9,24 @@ module Extension
|
|
9
9
|
|
10
10
|
options do |parser, flags|
|
11
11
|
parser.on("-t", "--[no-]tunnel", "Establish an ngrok tunnel") { |tunnel| flags[:tunnel] = tunnel }
|
12
|
+
parser.on("--resourceUrl=RESOURCE_URL", "Provide a resource URL") do |resource_url|
|
13
|
+
flags[:resource_url] = resource_url
|
14
|
+
end
|
12
15
|
end
|
13
16
|
|
14
17
|
class RuntimeConfiguration
|
15
18
|
include SmartProperties
|
16
19
|
|
17
20
|
property :tunnel_url, accepts: String, default: nil
|
21
|
+
property :resource_url, accepts: String, default: nil
|
18
22
|
property! :tunnel_requested, accepts: [true, false], reader: :tunnel_requested?, default: true
|
19
23
|
property! :port, accepts: (1...(2**16)), default: DEFAULT_PORT
|
20
24
|
end
|
21
25
|
|
22
26
|
def call(_args, _command_name)
|
23
27
|
config = RuntimeConfiguration.new(
|
24
|
-
tunnel_requested: tunnel_requested
|
28
|
+
tunnel_requested: tunnel_requested?,
|
29
|
+
resource_url: options.flags[:resource_url]
|
25
30
|
)
|
26
31
|
|
27
32
|
ShopifyCli::Result
|
@@ -74,7 +79,8 @@ module Extension
|
|
74
79
|
specification_handler.serve(
|
75
80
|
context: @ctx,
|
76
81
|
tunnel_url: runtime_configuration.tunnel_url,
|
77
|
-
port: runtime_configuration.port
|
82
|
+
port: runtime_configuration.port,
|
83
|
+
resource_url: runtime_configuration.resource_url
|
78
84
|
)
|
79
85
|
runtime_configuration
|
80
86
|
end
|
@@ -14,6 +14,24 @@ module Extension
|
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
|
+
def update_env_file(context:, **updates)
|
18
|
+
current_config = {
|
19
|
+
title: current.title,
|
20
|
+
shop: current.env.shop,
|
21
|
+
api_key: current.app.api_key,
|
22
|
+
api_secret: current.app.secret,
|
23
|
+
registration_id: current.registration_id,
|
24
|
+
registration_uuid: current.registration_uuid,
|
25
|
+
resource_url: current.resource_url,
|
26
|
+
}
|
27
|
+
|
28
|
+
write_env_file(
|
29
|
+
context: context,
|
30
|
+
**current_config,
|
31
|
+
**updates
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
17
35
|
def write_env_file(
|
18
36
|
context:,
|
19
37
|
title:,
|
@@ -21,11 +39,13 @@ module Extension
|
|
21
39
|
api_secret: "",
|
22
40
|
registration_id: nil,
|
23
41
|
registration_uuid: nil,
|
24
|
-
resource_url: nil
|
42
|
+
resource_url: nil,
|
43
|
+
shop: nil
|
25
44
|
)
|
26
45
|
ShopifyCli::Resources::EnvFile.new(
|
27
46
|
api_key: api_key,
|
28
47
|
secret: api_secret,
|
48
|
+
shop: shop,
|
29
49
|
extra: {
|
30
50
|
ExtensionProjectKeys::TITLE_KEY => title,
|
31
51
|
ExtensionProjectKeys::REGISTRATION_ID_KEY => registration_id,
|
@@ -1,46 +1,14 @@
|
|
1
1
|
module Extension
|
2
2
|
module Features
|
3
3
|
class ArgoRuntime
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
ADMIN_RUN_FLAGS = [
|
10
|
-
:api_key,
|
11
|
-
:name,
|
12
|
-
:port,
|
13
|
-
:public_url,
|
14
|
-
:renderer_version,
|
15
|
-
:shop,
|
16
|
-
:uuid,
|
4
|
+
RUNTIMES = [
|
5
|
+
Runtimes::Admin.new,
|
6
|
+
Runtimes::CheckoutPostPurchase.new,
|
7
|
+
Runtimes::CheckoutUiExtension.new,
|
17
8
|
]
|
18
9
|
|
19
|
-
|
20
|
-
|
21
|
-
:public_url,
|
22
|
-
]
|
23
|
-
|
24
|
-
property! :renderer, accepts: Models::NpmPackage
|
25
|
-
property! :cli, accepts: Models::NpmPackage
|
26
|
-
|
27
|
-
def supports?(flag)
|
28
|
-
case cli
|
29
|
-
when admin?
|
30
|
-
ADMIN_RUN_FLAGS.include?(flag.to_sym)
|
31
|
-
when checkout?
|
32
|
-
CHECKOUT_RUN_FLAGS.include?(flag.to_sym)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def admin?
|
39
|
-
->(cli) { cli.name == UI_EXTENSIONS_ADMIN_RUN }
|
40
|
-
end
|
41
|
-
|
42
|
-
def checkout?
|
43
|
-
->(cli) { cli.name == UI_EXTENSIONS_CHECKOUT_RUN }
|
10
|
+
def self.find(cli_package:, identifier:)
|
11
|
+
RUNTIMES.find { |runtime| runtime.active_runtime?(cli_package, identifier) }
|
44
12
|
end
|
45
13
|
end
|
46
14
|
end
|
@@ -7,11 +7,12 @@ module Extension
|
|
7
7
|
NPM_SERVE_COMMAND = %w(run-script server)
|
8
8
|
|
9
9
|
property! :specification_handler, accepts: Extension::Models::SpecificationHandlers::Default
|
10
|
-
property! :argo_runtime, accepts: Features::
|
10
|
+
property! :argo_runtime, accepts: -> (runtime) { runtime.class < Features::Runtimes::Base }
|
11
11
|
property! :context, accepts: ShopifyCli::Context
|
12
12
|
property! :port, accepts: Integer, default: 39351
|
13
13
|
property :tunnel_url, accepts: String, default: nil
|
14
14
|
property! :js_system, accepts: ->(jss) { jss.respond_to?(:call) }, default: ShopifyCli::JsSystem
|
15
|
+
property :resource_url, accepts: String, default: nil
|
15
16
|
|
16
17
|
def call
|
17
18
|
validate_env!
|
@@ -22,6 +23,10 @@ module Extension
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
26
|
+
def resource_url
|
27
|
+
super || ExtensionProject.current(force_reload: true).resource_url
|
28
|
+
end
|
29
|
+
|
25
30
|
private
|
26
31
|
|
27
32
|
def start_server
|
@@ -57,6 +62,7 @@ module Extension
|
|
57
62
|
ShopifyCli::Tasks::EnsureDevStore.call(context) if required_fields.include?(:shop)
|
58
63
|
|
59
64
|
project = ExtensionProject.current
|
65
|
+
ensure_resource_resource_url! if specification_handler.supplies_resource_url?
|
60
66
|
|
61
67
|
return if required_fields.all? do |field|
|
62
68
|
value = project.env.public_send(field)
|
@@ -77,8 +83,31 @@ module Extension
|
|
77
83
|
options << "--uuid=#{project.registration_uuid}" if argo_runtime.supports?(:uuid)
|
78
84
|
options << "--publicUrl=#{tunnel_url}" if !tunnel_url.nil? && argo_runtime.supports?(:public_url)
|
79
85
|
options << "--name=#{project.title}" if argo_runtime.supports?(:name)
|
86
|
+
options << "--resourceUrl=#{resource_url}" if !resource_url.nil? && argo_runtime.supports?(:resource_url)
|
80
87
|
end
|
81
88
|
end
|
89
|
+
|
90
|
+
def ensure_resource_resource_url!
|
91
|
+
project = ExtensionProject.current(force_reload: true)
|
92
|
+
|
93
|
+
ShopifyCli::Result
|
94
|
+
.wrap(project.resource_url)
|
95
|
+
.rescue { specification_handler.build_resource_url(shop: project.env.shop, context: context) }
|
96
|
+
.then(&method(:persist_resource_url))
|
97
|
+
.unwrap do |nil_or_exception|
|
98
|
+
case nil_or_exception
|
99
|
+
when nil
|
100
|
+
context.warn(context.message("warnings.resource_url_auto_generation_failed", project.env.shop))
|
101
|
+
else
|
102
|
+
context.abort(nil_or_exception)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def persist_resource_url(resource_url)
|
108
|
+
ExtensionProject.update_env_file(context: context, resource_url: resource_url)
|
109
|
+
resource_url
|
110
|
+
end
|
82
111
|
end
|
83
112
|
end
|
84
113
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Extension
|
2
|
+
module Features
|
3
|
+
module Runtimes
|
4
|
+
class Admin < Base
|
5
|
+
ADMIN_UI_EXTENSIONS_RUN = "@shopify/admin-ui-extensions-run"
|
6
|
+
PRODUCT_SUBSCRIPTION = "PRODUCT_SUBSCRIPTION"
|
7
|
+
|
8
|
+
AVAILABLE_FLAGS = [
|
9
|
+
:api_key,
|
10
|
+
:name,
|
11
|
+
:port,
|
12
|
+
:public_url,
|
13
|
+
:renderer_version,
|
14
|
+
:resource_url,
|
15
|
+
:shop,
|
16
|
+
:uuid,
|
17
|
+
]
|
18
|
+
|
19
|
+
def available_flags
|
20
|
+
AVAILABLE_FLAGS
|
21
|
+
end
|
22
|
+
|
23
|
+
def active_runtime?(cli_package, identifier)
|
24
|
+
cli_package.name == ADMIN_UI_EXTENSIONS_RUN && identifier == PRODUCT_SUBSCRIPTION
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Extension
|
2
|
+
module Features
|
3
|
+
module Runtimes
|
4
|
+
class Base
|
5
|
+
def available_flags
|
6
|
+
[]
|
7
|
+
end
|
8
|
+
|
9
|
+
def supports?(flag)
|
10
|
+
available_flags.include?(flag)
|
11
|
+
end
|
12
|
+
|
13
|
+
def active_runtime?(cli_package, identifier)
|
14
|
+
raise NotImplementedError
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Extension
|
2
|
+
module Features
|
3
|
+
module Runtimes
|
4
|
+
class CheckoutPostPurchase < Base
|
5
|
+
CHECKOUT_UI_EXTENSIONS_RUN = "@shopify/checkout-ui-extensions-run"
|
6
|
+
CHECKOUT_POST_PURCHASE = "CHECKOUT_POST_PURCHASE"
|
7
|
+
|
8
|
+
AVAILABLE_FLAGS = [
|
9
|
+
:port,
|
10
|
+
:public_url,
|
11
|
+
]
|
12
|
+
|
13
|
+
def available_flags
|
14
|
+
AVAILABLE_FLAGS
|
15
|
+
end
|
16
|
+
|
17
|
+
def active_runtime?(cli_package, identifier)
|
18
|
+
cli_package.name == CHECKOUT_UI_EXTENSIONS_RUN && identifier == CHECKOUT_POST_PURCHASE
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Extension
|
2
|
+
module Features
|
3
|
+
module Runtimes
|
4
|
+
class CheckoutUiExtension < Base
|
5
|
+
CHECKOUT_UI_EXTENSIONS_RUN = "@shopify/checkout-ui-extensions-run"
|
6
|
+
|
7
|
+
IDENTIFIERS = [
|
8
|
+
"CHECKOUT_ARGO_EXTENSION",
|
9
|
+
"CHECKOUT_UI_EXTENSION",
|
10
|
+
]
|
11
|
+
|
12
|
+
AVAILABLE_FLAGS = [
|
13
|
+
:port,
|
14
|
+
:public_url,
|
15
|
+
:resource_url,
|
16
|
+
:shop,
|
17
|
+
]
|
18
|
+
|
19
|
+
def available_flags
|
20
|
+
AVAILABLE_FLAGS
|
21
|
+
end
|
22
|
+
|
23
|
+
def active_runtime?(cli_package, identifier)
|
24
|
+
cli_package.name == CHECKOUT_UI_EXTENSIONS_RUN && IDENTIFIERS.include?(identifier)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -166,12 +166,18 @@ module Extension
|
|
166
166
|
tasks: {
|
167
167
|
errors: {
|
168
168
|
parse_error: "Unable to parse response from Partners Dashboard.",
|
169
|
+
store_error: "There was an error getting store data. Try again later.",
|
169
170
|
},
|
170
171
|
},
|
171
172
|
errors: {
|
172
173
|
unknown_type: "Unknown extension type %s",
|
173
174
|
package_not_found: "`%s` package not found.",
|
174
175
|
},
|
176
|
+
warnings: {
|
177
|
+
resource_url_auto_generation_failed: "{{*}} {{yellow:Warning:}} Unable to auto generate " \
|
178
|
+
"the extension resource URL because %s does not have any products. " \
|
179
|
+
"Please run {{bold:shopify populate products}} to generate sample products.",
|
180
|
+
},
|
175
181
|
}
|
176
182
|
|
177
183
|
TYPES = {
|
@@ -200,6 +206,9 @@ module Extension
|
|
200
206
|
{{*}} You’re ready to start building {{green:%s}}!
|
201
207
|
MESSAGE
|
202
208
|
},
|
209
|
+
serve: {
|
210
|
+
unsupported: "shopify extension serve is not supported for theme app extensions",
|
211
|
+
},
|
203
212
|
},
|
204
213
|
},
|
205
214
|
}
|
@@ -12,9 +12,17 @@ module Extension
|
|
12
12
|
**argo.config(context),
|
13
13
|
}
|
14
14
|
end
|
15
|
-
end
|
16
15
|
|
17
|
-
|
16
|
+
def supplies_resource_url?
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def build_resource_url(context:, shop:)
|
21
|
+
product = Tasks::GetProduct.call(context, shop)
|
22
|
+
return unless product
|
23
|
+
format("/cart/%<variant_id>d:%<quantity>d", variant_id: product.variant_id, quantity: 1)
|
24
|
+
end
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
20
28
|
end
|
@@ -50,13 +50,14 @@ module Extension
|
|
50
50
|
argo_runtime(context).supports?(:public_url)
|
51
51
|
end
|
52
52
|
|
53
|
-
def serve(context:, port:, tunnel_url:)
|
53
|
+
def serve(context:, port:, tunnel_url:, resource_url:)
|
54
54
|
Features::ArgoServe.new(
|
55
55
|
specification_handler: self,
|
56
56
|
argo_runtime: argo_runtime(context),
|
57
57
|
context: context,
|
58
58
|
port: port,
|
59
59
|
tunnel_url: tunnel_url,
|
60
|
+
resource_url: resource_url
|
60
61
|
).call
|
61
62
|
end
|
62
63
|
|
@@ -65,9 +66,9 @@ module Extension
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def argo_runtime(context)
|
68
|
-
@argo_runtime ||= Features::ArgoRuntime.
|
69
|
-
|
70
|
-
|
69
|
+
@argo_runtime ||= Features::ArgoRuntime.find(
|
70
|
+
cli_package: cli_package(context),
|
71
|
+
identifier: identifier
|
71
72
|
)
|
72
73
|
end
|
73
74
|
|
@@ -90,6 +91,14 @@ module Extension
|
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
94
|
+
def supplies_resource_url?
|
95
|
+
false
|
96
|
+
end
|
97
|
+
|
98
|
+
def build_resource_url(shop)
|
99
|
+
raise NotImplementedError
|
100
|
+
end
|
101
|
+
|
93
102
|
protected
|
94
103
|
|
95
104
|
def argo
|
@@ -60,6 +60,18 @@ module Extension
|
|
60
60
|
"Theme App Extension"
|
61
61
|
end
|
62
62
|
|
63
|
+
def choose_port?(ctx)
|
64
|
+
ctx.abort(ctx.message("serve.unsupported"))
|
65
|
+
end
|
66
|
+
|
67
|
+
def establish_tunnel?(ctx)
|
68
|
+
ctx.abort(ctx.message("serve.unsupported"))
|
69
|
+
end
|
70
|
+
|
71
|
+
def serve(ctx)
|
72
|
+
ctx.abort(ctx.message("serve.unsupported"))
|
73
|
+
end
|
74
|
+
|
63
75
|
private
|
64
76
|
|
65
77
|
def validate(filename)
|
@@ -46,6 +46,7 @@ module Extension
|
|
46
46
|
checkout: {
|
47
47
|
git_template: "https://github.com/Shopify/checkout-ui-extensions-template",
|
48
48
|
renderer_package_name: "@shopify/checkout-ui-extensions",
|
49
|
+
required_fields: [:shop],
|
49
50
|
cli_package_name: "@shopify/checkout-ui-extensions-run",
|
50
51
|
},
|
51
52
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "shopify_cli"
|
3
|
+
|
4
|
+
module Extension
|
5
|
+
module Tasks
|
6
|
+
module Converters
|
7
|
+
module ProductConverter
|
8
|
+
VARIANT_PATH = ["data", "products", "edges", 0, "node", "variants", "edges", 0, "node", "id"]
|
9
|
+
|
10
|
+
def self.from_hash(hash)
|
11
|
+
return nil if hash.nil?
|
12
|
+
variant = hash.dig(*VARIANT_PATH)
|
13
|
+
return unless variant
|
14
|
+
Models::Product.new(
|
15
|
+
variant_id: ShopifyCli::API.gid_to_id(variant)
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "shopify_cli"
|
3
|
+
|
4
|
+
module Extension
|
5
|
+
module Tasks
|
6
|
+
class GetProduct < ShopifyCli::Task
|
7
|
+
API_VERSION = "2021-07"
|
8
|
+
GRAPHQL_FILE = "get_variant_id"
|
9
|
+
|
10
|
+
def call(context, shop)
|
11
|
+
response = ShopifyCli::AdminAPI.query(
|
12
|
+
context,
|
13
|
+
GRAPHQL_FILE,
|
14
|
+
shop: shop,
|
15
|
+
api_version: API_VERSION
|
16
|
+
)
|
17
|
+
context.abort(context.message("tasks.errors.store_error")) if response.nil?
|
18
|
+
Converters::ProductConverter.from_hash(response)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -34,7 +34,7 @@ module Script
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.help
|
37
|
-
allowed_values = Script::Layers::Application::ExtensionPoints.
|
37
|
+
allowed_values = Script::Layers::Application::ExtensionPoints.available_types.map { |type| "{{cyan:#{type}}}" }
|
38
38
|
ShopifyCli::Context.message("script.create.help", ShopifyCli::TOOL_NAME, allowed_values.join(", "))
|
39
39
|
end
|
40
40
|
end
|
@@ -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")
|
data/lib/shopify-cli/version.rb
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.2.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-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -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
|