shopify-cli 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- data/CHANGELOG.md +9 -1
- data/Gemfile.lock +1 -1
- data/lib/project_types/extension/cli.rb +6 -2
- data/lib/project_types/extension/commands/serve.rb +69 -1
- data/lib/project_types/extension/commands/tunnel.rb +3 -1
- data/lib/project_types/extension/extension_project.rb +1 -0
- data/lib/project_types/extension/features/argo.rb +15 -24
- data/lib/project_types/extension/features/argo_runtime.rb +63 -0
- data/lib/project_types/extension/features/argo_serve.rb +35 -25
- data/lib/project_types/extension/features/argo_serve_options.rb +40 -0
- data/lib/project_types/extension/messages/messages.rb +3 -0
- data/lib/project_types/extension/models/npm_package.rb +14 -0
- data/lib/project_types/extension/models/specification.rb +1 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_argo_extension.rb +18 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +28 -3
- data/lib/project_types/extension/tasks/choose_next_available_port.rb +36 -0
- data/lib/project_types/extension/tasks/configure_features.rb +2 -0
- data/lib/project_types/extension/tasks/find_npm_packages.rb +106 -0
- data/lib/project_types/script/cli.rb +1 -0
- data/lib/project_types/script/layers/domain/errors.rb +0 -2
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +12 -17
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +13 -7
- data/lib/project_types/script/layers/infrastructure/command_runner.rb +19 -0
- data/lib/project_types/script/layers/infrastructure/errors.rb +12 -3
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +4 -4
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +9 -10
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +5 -6
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +2 -28
- data/lib/project_types/script/layers/infrastructure/script_service.rb +1 -1
- data/lib/project_types/script/messages/messages.rb +6 -4
- data/lib/project_types/script/tasks/ensure_env.rb +10 -2
- data/lib/project_types/script/ui/error_handler.rb +7 -6
- data/lib/shopify-cli/messages/messages.rb +47 -43
- data/lib/shopify-cli/method_object.rb +4 -4
- data/lib/shopify-cli/oauth.rb +7 -1
- data/lib/shopify-cli/partners_api/organizations.rb +3 -3
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +6 -4
- data/lib/shopify-cli/tunnel.rb +22 -1
- data/lib/shopify-cli/version.rb +1 -1
- metadata +10 -4
- data/lib/project_types/extension/features/argo_renderer_package.rb +0 -47
data/lib/shopify-cli/oauth.rb
CHANGED
@@ -80,7 +80,13 @@ module ShopifyCli
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def output_authentication_info(uri)
|
83
|
-
login_location =
|
83
|
+
login_location = if service == "admin"
|
84
|
+
ctx.message("core.oauth.location.admin")
|
85
|
+
elsif Shopifolk.acting_as_shopify_organization?
|
86
|
+
ctx.message("core.oauth.location.shopifolk")
|
87
|
+
else
|
88
|
+
ctx.message("core.oauth.location.partner")
|
89
|
+
end
|
84
90
|
ctx.puts(ctx.message("core.oauth.authentication_required", login_location))
|
85
91
|
ctx.open_url!(uri)
|
86
92
|
end
|
@@ -4,7 +4,7 @@ module ShopifyCli
|
|
4
4
|
class << self
|
5
5
|
def fetch_all(ctx)
|
6
6
|
resp = PartnersAPI.query(ctx, "all_organizations")
|
7
|
-
(resp
|
7
|
+
(resp&.dig("data", "organizations", "nodes") || []).map do |org|
|
8
8
|
org["stores"] = (org.dig("stores", "nodes") || [])
|
9
9
|
org
|
10
10
|
end
|
@@ -12,7 +12,7 @@ module ShopifyCli
|
|
12
12
|
|
13
13
|
def fetch(ctx, id:)
|
14
14
|
resp = PartnersAPI.query(ctx, "find_organization", id: id)
|
15
|
-
org = resp
|
15
|
+
org = resp&.dig("data", "organizations", "nodes")&.first
|
16
16
|
return nil if org.nil?
|
17
17
|
org["stores"] = (org.dig("stores", "nodes") || [])
|
18
18
|
org
|
@@ -20,7 +20,7 @@ module ShopifyCli
|
|
20
20
|
|
21
21
|
def fetch_with_app(ctx)
|
22
22
|
resp = PartnersAPI.query(ctx, "all_orgs_with_apps")
|
23
|
-
(resp
|
23
|
+
(resp&.dig("data", "organizations", "nodes") || []).map do |org|
|
24
24
|
org["stores"] = (org.dig("stores", "nodes") || [])
|
25
25
|
org["apps"] = (org.dig("apps", "nodes") || [])
|
26
26
|
org
|
@@ -35,14 +35,16 @@ module ShopifyCli
|
|
35
35
|
@organization ||= if !organization_id.nil?
|
36
36
|
org = ShopifyCli::PartnersAPI::Organizations.fetch(ctx, id: organization_id)
|
37
37
|
if org.nil?
|
38
|
-
ctx.puts(ctx.message("core.tasks.select_org_and_shop.
|
38
|
+
ctx.puts(ctx.message("core.tasks.select_org_and_shop.authentication_issue", ShopifyCli::TOOL_NAME))
|
39
39
|
ctx.abort(ctx.message("core.tasks.select_org_and_shop.error.organization_not_found"))
|
40
40
|
end
|
41
41
|
org
|
42
42
|
elsif organizations.count == 0
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
if Shopifolk.acting_as_shopify_organization?
|
44
|
+
ctx.abort(ctx.message("core.tasks.select_org_and_shop.error.shopifolk_notice", ShopifyCli::TOOL_NAME))
|
45
|
+
else
|
46
|
+
ctx.abort(ctx.message("core.tasks.select_org_and_shop.error.no_organizations"))
|
47
|
+
end
|
46
48
|
elsif organizations.count == 1
|
47
49
|
org = organizations.first
|
48
50
|
ctx.puts(ctx.message("core.tasks.select_org_and_shop.organization", org["businessName"], org["id"]))
|
data/lib/shopify-cli/tunnel.rb
CHANGED
@@ -2,6 +2,7 @@ require "json"
|
|
2
2
|
require "fileutils"
|
3
3
|
require "shopify_cli"
|
4
4
|
require "forwardable"
|
5
|
+
require "uri"
|
5
6
|
|
6
7
|
module ShopifyCli
|
7
8
|
##
|
@@ -11,7 +12,7 @@ module ShopifyCli
|
|
11
12
|
class Tunnel
|
12
13
|
extend SingleForwardable
|
13
14
|
|
14
|
-
def_delegators :new, :start, :stop, :auth, :stats, :urls
|
15
|
+
def_delegators :new, :start, :stop, :auth, :stats, :urls, :running_on?
|
15
16
|
|
16
17
|
class FetchUrlError < RuntimeError; end
|
17
18
|
class NgrokError < RuntimeError; end
|
@@ -26,6 +27,7 @@ module ShopifyCli
|
|
26
27
|
|
27
28
|
NGROK_TUNNELS_URI = URI.parse("http://localhost:4040/api/tunnels")
|
28
29
|
TUNNELS_FIELD = "tunnels"
|
30
|
+
TUNNEL_ADDRESS_KEY_PATH = ["config", "addr"]
|
29
31
|
PUBLIC_URL_FIELD = "public_url"
|
30
32
|
|
31
33
|
##
|
@@ -120,6 +122,25 @@ module ShopifyCli
|
|
120
122
|
[]
|
121
123
|
end
|
122
124
|
|
125
|
+
##
|
126
|
+
# Returns Boolean if a tunnel is running on a given port
|
127
|
+
#
|
128
|
+
# #### Parameters
|
129
|
+
#
|
130
|
+
# * `port` - port to check
|
131
|
+
#
|
132
|
+
# #### Returns
|
133
|
+
#
|
134
|
+
# * true / false
|
135
|
+
#
|
136
|
+
def running_on?(port)
|
137
|
+
extract_port = ->(tunnel) { URI(tunnel.dig(*TUNNEL_ADDRESS_KEY_PATH)).port }
|
138
|
+
matches_port = ->(occupied_port) { occupied_port == port }
|
139
|
+
stats.fetch(TUNNELS_FIELD, []).map(&extract_port).any?(&matches_port)
|
140
|
+
rescue
|
141
|
+
false
|
142
|
+
end
|
143
|
+
|
123
144
|
private
|
124
145
|
|
125
146
|
def install(ctx)
|
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: 1.
|
4
|
+
version: 1.11.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-05-
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,8 +144,9 @@ files:
|
|
144
144
|
- lib/project_types/extension/features/argo.rb
|
145
145
|
- lib/project_types/extension/features/argo_config.rb
|
146
146
|
- lib/project_types/extension/features/argo_dependencies.rb
|
147
|
-
- lib/project_types/extension/features/
|
147
|
+
- lib/project_types/extension/features/argo_runtime.rb
|
148
148
|
- lib/project_types/extension/features/argo_serve.rb
|
149
|
+
- lib/project_types/extension/features/argo_serve_options.rb
|
149
150
|
- lib/project_types/extension/features/argo_setup.rb
|
150
151
|
- lib/project_types/extension/features/argo_setup_step.rb
|
151
152
|
- lib/project_types/extension/features/argo_setup_steps.rb
|
@@ -157,13 +158,16 @@ files:
|
|
157
158
|
- lib/project_types/extension/messages/messages.rb
|
158
159
|
- lib/project_types/extension/models/app.rb
|
159
160
|
- lib/project_types/extension/models/lazy_specification_handler.rb
|
161
|
+
- lib/project_types/extension/models/npm_package.rb
|
160
162
|
- lib/project_types/extension/models/registration.rb
|
161
163
|
- lib/project_types/extension/models/specification.rb
|
164
|
+
- lib/project_types/extension/models/specification_handlers/checkout_argo_extension.rb
|
162
165
|
- lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb
|
163
166
|
- lib/project_types/extension/models/specification_handlers/default.rb
|
164
167
|
- lib/project_types/extension/models/specifications.rb
|
165
168
|
- lib/project_types/extension/models/validation_error.rb
|
166
169
|
- lib/project_types/extension/models/version.rb
|
170
|
+
- lib/project_types/extension/tasks/choose_next_available_port.rb
|
167
171
|
- lib/project_types/extension/tasks/configure_features.rb
|
168
172
|
- lib/project_types/extension/tasks/converters/app_converter.rb
|
169
173
|
- lib/project_types/extension/tasks/converters/registration_converter.rb
|
@@ -171,6 +175,7 @@ files:
|
|
171
175
|
- lib/project_types/extension/tasks/converters/version_converter.rb
|
172
176
|
- lib/project_types/extension/tasks/create_extension.rb
|
173
177
|
- lib/project_types/extension/tasks/fetch_specifications.rb
|
178
|
+
- lib/project_types/extension/tasks/find_npm_packages.rb
|
174
179
|
- lib/project_types/extension/tasks/get_app.rb
|
175
180
|
- lib/project_types/extension/tasks/get_apps.rb
|
176
181
|
- lib/project_types/extension/tasks/update_draft.rb
|
@@ -230,6 +235,7 @@ files:
|
|
230
235
|
- lib/project_types/script/layers/domain/script_project.rb
|
231
236
|
- lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb
|
232
237
|
- lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb
|
238
|
+
- lib/project_types/script/layers/infrastructure/command_runner.rb
|
233
239
|
- lib/project_types/script/layers/infrastructure/errors.rb
|
234
240
|
- lib/project_types/script/layers/infrastructure/extension_point_repository.rb
|
235
241
|
- lib/project_types/script/layers/infrastructure/project_creator.rb
|
@@ -465,7 +471,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
465
471
|
- !ruby/object:Gem::Version
|
466
472
|
version: '0'
|
467
473
|
requirements: []
|
468
|
-
rubygems_version: 3.
|
474
|
+
rubygems_version: 3.2.17
|
469
475
|
signing_key:
|
470
476
|
specification_version: 4
|
471
477
|
summary: Shopify CLI helps you build Shopify apps faster.
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module Extension
|
2
|
-
module Features
|
3
|
-
class ArgoRendererPackage
|
4
|
-
include SmartProperties
|
5
|
-
|
6
|
-
ARGO_CHECKOUT = "@shopify/argo-checkout"
|
7
|
-
ARGO_ADMIN = "@shopify/argo-admin"
|
8
|
-
ARGO_POST_PURCHASE = "@shopify/argo-post-purchase"
|
9
|
-
|
10
|
-
PACKAGE_NAMES = [
|
11
|
-
ARGO_CHECKOUT,
|
12
|
-
ARGO_ADMIN,
|
13
|
-
ARGO_POST_PURCHASE,
|
14
|
-
].freeze
|
15
|
-
MINIMUM_ARGO_VERSION = "0.9.3".freeze
|
16
|
-
|
17
|
-
property! :package_name, accepts: PACKAGE_NAMES
|
18
|
-
property! :version, accepts: String
|
19
|
-
|
20
|
-
class << self
|
21
|
-
def from_package_manager(package_manager_output)
|
22
|
-
pattern = /(?<name>#{PACKAGE_NAMES.join("|")})@(?<version>\d.*)$/
|
23
|
-
match = package_manager_output.match(pattern)
|
24
|
-
raise PackageNotFound, package_manager_output if match.nil?
|
25
|
-
new(package_name: match[:name], version: match[:version].strip)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def checkout?
|
30
|
-
package_name == ARGO_CHECKOUT
|
31
|
-
end
|
32
|
-
|
33
|
-
def admin?
|
34
|
-
package_name == ARGO_ADMIN
|
35
|
-
end
|
36
|
-
|
37
|
-
##
|
38
|
-
# Temporarily returns false in all cases as the argo webpack server is
|
39
|
-
# unable to handle the UUID flag.
|
40
|
-
def supports_uuid_flag?
|
41
|
-
false
|
42
|
-
# return false if checkout?
|
43
|
-
# Gem::Version.new(version) > Gem::Version.new(MINIMUM_ARGO_VERSION)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|