shopify-cli 1.8.0 → 1.12.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/PULL_REQUEST_TEMPLATE.md +1 -0
- data/.github/workflows/build.yml +28 -0
- data/.rubocop_todo.yml +15 -2
- data/CHANGELOG.md +24 -1
- data/Gemfile.lock +4 -4
- data/README.md +2 -1
- data/dev.yml +3 -0
- data/lib/graphql/extension_create.graphql +17 -2
- data/lib/project_types/extension/cli.rb +8 -0
- data/lib/project_types/extension/commands/extension_command.rb +4 -4
- data/lib/project_types/extension/commands/push.rb +2 -2
- data/lib/project_types/extension/commands/register.rb +4 -3
- data/lib/project_types/extension/commands/serve.rb +62 -28
- data/lib/project_types/extension/commands/tunnel.rb +3 -1
- data/lib/project_types/extension/extension_project.rb +16 -4
- data/lib/project_types/extension/extension_project_keys.rb +2 -1
- data/lib/project_types/extension/features/argo.rb +19 -44
- data/lib/project_types/extension/features/argo_runtime.rb +84 -0
- data/lib/project_types/extension/features/argo_serve.rb +80 -0
- data/lib/project_types/extension/features/argo_serve_options.rb +41 -0
- data/lib/project_types/extension/features/argo_setup.rb +1 -1
- data/lib/project_types/extension/messages/message_loading.rb +3 -1
- data/lib/project_types/extension/messages/messages.rb +5 -4
- data/lib/project_types/extension/models/npm_package.rb +14 -0
- data/lib/project_types/extension/models/registration.rb +1 -0
- data/lib/project_types/extension/models/specification.rb +3 -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 +49 -1
- data/lib/project_types/extension/models/version.rb +1 -1
- data/lib/project_types/extension/tasks/choose_next_available_port.rb +36 -0
- data/lib/project_types/extension/tasks/configure_features.rb +4 -0
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +2 -0
- data/lib/project_types/extension/tasks/find_npm_packages.rb +106 -0
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/node/messages/messages.rb +4 -4
- data/lib/project_types/rails/messages/messages.rb +4 -4
- data/lib/project_types/script/cli.rb +7 -8
- data/lib/project_types/script/commands/create.rb +0 -7
- data/lib/project_types/script/commands/push.rb +3 -3
- data/lib/project_types/script/config/extension_points.yml +4 -0
- data/lib/project_types/script/errors.rb +0 -19
- data/lib/project_types/script/forms/create.rb +3 -14
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +5 -5
- data/lib/project_types/script/graphql/get_app_scripts.graphql +6 -0
- data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
- data/lib/project_types/script/layers/application/build_script.rb +1 -2
- data/lib/project_types/script/layers/application/create_script.rb +30 -51
- data/lib/project_types/script/layers/application/extension_points.rb +3 -2
- data/lib/project_types/script/layers/application/push_script.rb +5 -5
- data/lib/project_types/script/layers/domain/errors.rb +0 -2
- data/lib/project_types/script/layers/domain/extension_point.rb +56 -46
- data/lib/project_types/script/layers/domain/metadata.rb +18 -25
- data/lib/project_types/script/layers/domain/push_package.rb +4 -4
- data/lib/project_types/script/layers/domain/script_project.rb +54 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +15 -16
- 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 +40 -11
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +12 -13
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +9 -10
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +6 -7
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +172 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +21 -72
- data/lib/project_types/script/messages/messages.rb +20 -50
- data/lib/project_types/script/tasks/ensure_env.rb +85 -0
- data/lib/project_types/script/ui/error_handler.rb +32 -30
- data/lib/shopify-cli/context.rb +28 -0
- data/lib/shopify-cli/js_system.rb +2 -2
- data/lib/shopify-cli/messages/messages.rb +50 -45
- data/lib/shopify-cli/method_object.rb +4 -4
- data/lib/shopify-cli/oauth.rb +9 -3
- data/lib/shopify-cli/packager.rb +1 -1
- data/lib/shopify-cli/partners_api/organizations.rb +3 -3
- data/lib/shopify-cli/resolve_constant.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +1 -1
- data/lib/shopify-cli/shopifolk.rb +1 -1
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +6 -4
- data/lib/shopify-cli/transform_data_structure.rb +1 -1
- data/lib/shopify-cli/tunnel.rb +22 -1
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +0 -1
- data/vendor/deps/smart_properties/REVISION +1 -1
- data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
- data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
- metadata +16 -12
- data/.travis.yml +0 -14
- data/lib/project_types/script/commands/disable.rb +0 -25
- data/lib/project_types/script/commands/enable.rb +0 -80
- data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
- data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
- data/lib/project_types/script/layers/application/disable_script.rb +0 -21
- data/lib/project_types/script/layers/application/enable_script.rb +0 -23
- data/lib/project_types/script/layers/infrastructure/config_ui_repository.rb +0 -46
- data/lib/project_types/script/script_project.rb +0 -64
|
@@ -52,8 +52,8 @@ module ShopifyCli
|
|
|
52
52
|
# invokes the original `call` implementation and wraps its return value
|
|
53
53
|
# into a result object.
|
|
54
54
|
#
|
|
55
|
-
def call(*args, **kwargs)
|
|
56
|
-
Result.wrap { super(*args, **kwargs) }.call
|
|
55
|
+
def call(*args, **kwargs, &block)
|
|
56
|
+
Result.wrap { kwargs.any? ? super(*args, **kwargs, &block) : super(*args, &block) }.call
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -64,10 +64,10 @@ module ShopifyCli
|
|
|
64
64
|
# initializer or to `call`. If the keyword argument matches the name of
|
|
65
65
|
# property, it is forwarded to the initializer, otherwise to call.
|
|
66
66
|
#
|
|
67
|
-
def call(*args, **kwargs)
|
|
67
|
+
def call(*args, **kwargs, &block)
|
|
68
68
|
properties.keys.yield_self do |properties|
|
|
69
69
|
new(**kwargs.slice(*properties))
|
|
70
|
-
.call(*args, **kwargs.slice(*(kwargs.keys - properties)))
|
|
70
|
+
.call(*args, **kwargs.slice(*(kwargs.keys - properties)), &block)
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
|
data/lib/shopify-cli/oauth.rb
CHANGED
|
@@ -24,10 +24,10 @@ module ShopifyCli
|
|
|
24
24
|
property! :service, accepts: String
|
|
25
25
|
property! :client_id, accepts: String
|
|
26
26
|
property! :scopes
|
|
27
|
-
property :store, default: ShopifyCli::DB.new
|
|
27
|
+
property :store, default: -> { ShopifyCli::DB.new }
|
|
28
28
|
property :secret, accepts: String
|
|
29
29
|
property :request_exchange, accepts: String
|
|
30
|
-
property :options, default: {}, accepts: Hash
|
|
30
|
+
property :options, default: -> { {} }, accepts: Hash
|
|
31
31
|
property :auth_path, default: "/authorize", accepts: ->(path) { path.is_a?(String) && path.start_with?("/") }
|
|
32
32
|
property :token_path, default: "/token", accepts: ->(path) { path.is_a?(String) && path.start_with?("/") }
|
|
33
33
|
property :state_token, accepts: String, default: SecureRandom.hex(30)
|
|
@@ -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
|
data/lib/shopify-cli/packager.rb
CHANGED
|
@@ -99,7 +99,7 @@ module ShopifyCli
|
|
|
99
99
|
raise <<~MESSAGE
|
|
100
100
|
|
|
101
101
|
Could not find program #{program} which is required to build the package.
|
|
102
|
-
You can install it by running
|
|
102
|
+
You can install it by running #{installation_cmd}.
|
|
103
103
|
|
|
104
104
|
MESSAGE
|
|
105
105
|
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
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
module ShopifyCli
|
|
12
12
|
class ResolveConstant
|
|
13
13
|
include ShopifyCli::MethodObject
|
|
14
|
-
property! :namespace, accepts: ->(ns) { ns.respond_to?(:const_get) }, default: Kernel
|
|
14
|
+
property! :namespace, accepts: ->(ns) { ns.respond_to?(:const_get) }, default: -> { Kernel }
|
|
15
15
|
|
|
16
16
|
def call(name)
|
|
17
17
|
name
|
|
@@ -33,7 +33,7 @@ module ShopifyCli
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def acting_as_shopify_organization?
|
|
36
|
-
|
|
36
|
+
!!(@acting_as_shopify_organization || (Project.has_current? && Project.current.config["shopify_organization"]))
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def reset
|
|
@@ -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"]))
|
|
@@ -42,7 +42,7 @@ module ShopifyCli
|
|
|
42
42
|
property! :symbolize_keys, accepts: [true, false], default: false, reader: :symbolize_keys?
|
|
43
43
|
property! :associative_array_container,
|
|
44
44
|
accepts: ->(c) { c.respond_to?(:new) && c.method_defined?(:[]=) },
|
|
45
|
-
default: Hash
|
|
45
|
+
default: -> { Hash }
|
|
46
46
|
|
|
47
47
|
def call(object)
|
|
48
48
|
case object
|
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
data/lib/shopify_cli.rb
CHANGED
|
@@ -110,7 +110,6 @@ module ShopifyCli
|
|
|
110
110
|
autoload :JsSystem, "shopify-cli/js_system"
|
|
111
111
|
autoload :MethodObject, "shopify-cli/method_object"
|
|
112
112
|
autoload :LazyDelegator, "shopify-cli/lazy_delegator"
|
|
113
|
-
autoload :Log, "shopify-cli/log"
|
|
114
113
|
autoload :OAuth, "shopify-cli/oauth"
|
|
115
114
|
autoload :Options, "shopify-cli/options"
|
|
116
115
|
autoload :PartnersAPI, "shopify-cli/partners_api"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
cfe83ef361e68ba7c471af75144f2b85cf1e1ec6
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module SmartProperties
|
|
2
2
|
class Property
|
|
3
3
|
MODULE_REFERENCE = :"@_smart_properties_method_scope"
|
|
4
|
+
ALLOWED_DEFAULT_CLASSES = [Proc, Numeric, String, Range, TrueClass, FalseClass, NilClass, Symbol, Module].freeze
|
|
4
5
|
|
|
5
6
|
attr_reader :name
|
|
6
7
|
attr_reader :converter
|
|
@@ -27,6 +28,11 @@ module SmartProperties
|
|
|
27
28
|
|
|
28
29
|
@instance_variable_name = :"@#{name}"
|
|
29
30
|
|
|
31
|
+
unless ALLOWED_DEFAULT_CLASSES.any? { |cls| @default.is_a?(cls) }
|
|
32
|
+
raise ConfigurationError, "Default attribute value #{@default.inspect} cannot be specified as literal, "\
|
|
33
|
+
"use the syntax `default: -> { ... }` instead."
|
|
34
|
+
end
|
|
35
|
+
|
|
30
36
|
unless attrs.empty?
|
|
31
37
|
raise ConfigurationError, "SmartProperties do not support the following configuration options: #{attrs.keys.map { |m| m.to_s }.sort.join(', ')}."
|
|
32
38
|
end
|
|
@@ -66,7 +72,7 @@ module SmartProperties
|
|
|
66
72
|
end
|
|
67
73
|
|
|
68
74
|
def default(scope)
|
|
69
|
-
@default.kind_of?(Proc) ? scope.instance_exec(&@default) : @default
|
|
75
|
+
@default.kind_of?(Proc) ? scope.instance_exec(&@default) : @default.dup
|
|
70
76
|
end
|
|
71
77
|
|
|
72
78
|
def accepts?(value, scope)
|
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.12.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-05-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -77,6 +77,7 @@ files:
|
|
|
77
77
|
- ".github/ISSUE_TEMPLATE.md"
|
|
78
78
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
79
79
|
- ".github/probots.yml"
|
|
80
|
+
- ".github/workflows/build.yml"
|
|
80
81
|
- ".github/workflows/release.yml"
|
|
81
82
|
- ".github/workflows/triage.yml"
|
|
82
83
|
- ".gitignore"
|
|
@@ -85,7 +86,6 @@ files:
|
|
|
85
86
|
- ".ruby-version"
|
|
86
87
|
- ".tmp/.gitkeep"
|
|
87
88
|
- ".tmp/sv/.gitkeep"
|
|
88
|
-
- ".travis.yml"
|
|
89
89
|
- CHANGELOG.md
|
|
90
90
|
- Gemfile
|
|
91
91
|
- Gemfile.lock
|
|
@@ -144,6 +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/argo_runtime.rb
|
|
148
|
+
- lib/project_types/extension/features/argo_serve.rb
|
|
149
|
+
- lib/project_types/extension/features/argo_serve_options.rb
|
|
147
150
|
- lib/project_types/extension/features/argo_setup.rb
|
|
148
151
|
- lib/project_types/extension/features/argo_setup_step.rb
|
|
149
152
|
- lib/project_types/extension/features/argo_setup_steps.rb
|
|
@@ -155,13 +158,16 @@ files:
|
|
|
155
158
|
- lib/project_types/extension/messages/messages.rb
|
|
156
159
|
- lib/project_types/extension/models/app.rb
|
|
157
160
|
- lib/project_types/extension/models/lazy_specification_handler.rb
|
|
161
|
+
- lib/project_types/extension/models/npm_package.rb
|
|
158
162
|
- lib/project_types/extension/models/registration.rb
|
|
159
163
|
- lib/project_types/extension/models/specification.rb
|
|
164
|
+
- lib/project_types/extension/models/specification_handlers/checkout_argo_extension.rb
|
|
160
165
|
- lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb
|
|
161
166
|
- lib/project_types/extension/models/specification_handlers/default.rb
|
|
162
167
|
- lib/project_types/extension/models/specifications.rb
|
|
163
168
|
- lib/project_types/extension/models/validation_error.rb
|
|
164
169
|
- lib/project_types/extension/models/version.rb
|
|
170
|
+
- lib/project_types/extension/tasks/choose_next_available_port.rb
|
|
165
171
|
- lib/project_types/extension/tasks/configure_features.rb
|
|
166
172
|
- lib/project_types/extension/tasks/converters/app_converter.rb
|
|
167
173
|
- lib/project_types/extension/tasks/converters/registration_converter.rb
|
|
@@ -169,6 +175,7 @@ files:
|
|
|
169
175
|
- lib/project_types/extension/tasks/converters/version_converter.rb
|
|
170
176
|
- lib/project_types/extension/tasks/create_extension.rb
|
|
171
177
|
- lib/project_types/extension/tasks/fetch_specifications.rb
|
|
178
|
+
- lib/project_types/extension/tasks/find_npm_packages.rb
|
|
172
179
|
- lib/project_types/extension/tasks/get_app.rb
|
|
173
180
|
- lib/project_types/extension/tasks/get_apps.rb
|
|
174
181
|
- lib/project_types/extension/tasks/update_draft.rb
|
|
@@ -208,20 +215,15 @@ files:
|
|
|
208
215
|
- lib/project_types/rails/ruby.rb
|
|
209
216
|
- lib/project_types/script/cli.rb
|
|
210
217
|
- lib/project_types/script/commands/create.rb
|
|
211
|
-
- lib/project_types/script/commands/disable.rb
|
|
212
|
-
- lib/project_types/script/commands/enable.rb
|
|
213
218
|
- lib/project_types/script/commands/push.rb
|
|
214
219
|
- lib/project_types/script/config/extension_points.yml
|
|
215
220
|
- lib/project_types/script/errors.rb
|
|
216
221
|
- lib/project_types/script/forms/create.rb
|
|
217
222
|
- lib/project_types/script/graphql/app_script_update_or_create.graphql
|
|
223
|
+
- lib/project_types/script/graphql/get_app_scripts.graphql
|
|
218
224
|
- lib/project_types/script/graphql/script_service_proxy.graphql
|
|
219
|
-
- lib/project_types/script/graphql/shop_script_delete.graphql
|
|
220
|
-
- lib/project_types/script/graphql/shop_script_update_or_create.graphql
|
|
221
225
|
- lib/project_types/script/layers/application/build_script.rb
|
|
222
226
|
- lib/project_types/script/layers/application/create_script.rb
|
|
223
|
-
- lib/project_types/script/layers/application/disable_script.rb
|
|
224
|
-
- lib/project_types/script/layers/application/enable_script.rb
|
|
225
227
|
- lib/project_types/script/layers/application/extension_points.rb
|
|
226
228
|
- lib/project_types/script/layers/application/project_dependencies.rb
|
|
227
229
|
- lib/project_types/script/layers/application/push_script.rb
|
|
@@ -230,19 +232,21 @@ files:
|
|
|
230
232
|
- lib/project_types/script/layers/domain/extension_point.rb
|
|
231
233
|
- lib/project_types/script/layers/domain/metadata.rb
|
|
232
234
|
- lib/project_types/script/layers/domain/push_package.rb
|
|
235
|
+
- lib/project_types/script/layers/domain/script_project.rb
|
|
233
236
|
- lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb
|
|
234
237
|
- lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb
|
|
235
|
-
- lib/project_types/script/layers/infrastructure/
|
|
238
|
+
- lib/project_types/script/layers/infrastructure/command_runner.rb
|
|
236
239
|
- lib/project_types/script/layers/infrastructure/errors.rb
|
|
237
240
|
- lib/project_types/script/layers/infrastructure/extension_point_repository.rb
|
|
238
241
|
- lib/project_types/script/layers/infrastructure/project_creator.rb
|
|
239
242
|
- lib/project_types/script/layers/infrastructure/push_package_repository.rb
|
|
240
243
|
- lib/project_types/script/layers/infrastructure/rust_project_creator.rb
|
|
241
244
|
- lib/project_types/script/layers/infrastructure/rust_task_runner.rb
|
|
245
|
+
- lib/project_types/script/layers/infrastructure/script_project_repository.rb
|
|
242
246
|
- lib/project_types/script/layers/infrastructure/script_service.rb
|
|
243
247
|
- lib/project_types/script/layers/infrastructure/task_runner.rb
|
|
244
248
|
- lib/project_types/script/messages/messages.rb
|
|
245
|
-
- lib/project_types/script/
|
|
249
|
+
- lib/project_types/script/tasks/ensure_env.rb
|
|
246
250
|
- lib/project_types/script/ui/error_handler.rb
|
|
247
251
|
- lib/project_types/script/ui/printing_spinner.rb
|
|
248
252
|
- lib/project_types/script/ui/strict_spinner.rb
|
|
@@ -467,7 +471,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
467
471
|
- !ruby/object:Gem::Version
|
|
468
472
|
version: '0'
|
|
469
473
|
requirements: []
|
|
470
|
-
rubygems_version: 3.
|
|
474
|
+
rubygems_version: 3.2.17
|
|
471
475
|
signing_key:
|
|
472
476
|
specification_version: 4
|
|
473
477
|
summary: Shopify CLI helps you build Shopify apps faster.
|
data/.travis.yml
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Script
|
|
4
|
-
module Commands
|
|
5
|
-
class Disable < ShopifyCli::Command
|
|
6
|
-
def call(_args, _name)
|
|
7
|
-
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
|
8
|
-
project = ScriptProject.current
|
|
9
|
-
Layers::Application::DisableScript.call(
|
|
10
|
-
ctx: @ctx,
|
|
11
|
-
api_key: project.env[:api_key],
|
|
12
|
-
shop_domain: project.env[:shop],
|
|
13
|
-
extension_point_type: project.extension_point_type
|
|
14
|
-
)
|
|
15
|
-
@ctx.puts(@ctx.message("script.disable.script_disabled"))
|
|
16
|
-
rescue StandardError => e
|
|
17
|
-
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.disable.error.operation_failed"))
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def self.help
|
|
21
|
-
ShopifyCli::Context.message("script.disable.help", ShopifyCli::TOOL_NAME)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Script
|
|
4
|
-
module Commands
|
|
5
|
-
class Enable < ShopifyCli::Command
|
|
6
|
-
options do |parser, flags|
|
|
7
|
-
parser.on("--config_props=KEYVALUEPAIRS", Array) { |t| flags[:config_props] = t }
|
|
8
|
-
parser.on("--config-props=KEYVALUEPAIRS", Array) { |t| flags[:config_props] = t }
|
|
9
|
-
parser.on("--config_file=CONFIGFILEPATH") { |t| flags[:config_file] = t }
|
|
10
|
-
parser.on("--config-file=CONFIGFILEPATH") { |t| flags[:config_file] = t }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def call(_args, _name)
|
|
14
|
-
ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
|
|
15
|
-
project = ScriptProject.current
|
|
16
|
-
api_key = project.env[:api_key]
|
|
17
|
-
shop_domain = project.env[:shop]
|
|
18
|
-
|
|
19
|
-
Layers::Application::EnableScript.call(
|
|
20
|
-
ctx: @ctx,
|
|
21
|
-
api_key: api_key,
|
|
22
|
-
shop_domain: shop_domain,
|
|
23
|
-
configuration: acquire_configuration(**slice(options.flags, :config_file, :config_props)),
|
|
24
|
-
extension_point_type: project.extension_point_type,
|
|
25
|
-
title: project.script_name
|
|
26
|
-
)
|
|
27
|
-
@ctx.puts(@ctx.message(
|
|
28
|
-
"script.enable.script_enabled",
|
|
29
|
-
api_key: api_key,
|
|
30
|
-
shop_domain: shop_domain,
|
|
31
|
-
type: project.extension_point_type.capitalize,
|
|
32
|
-
title: project.script_name
|
|
33
|
-
))
|
|
34
|
-
@ctx.puts(@ctx.message("script.enable.info"))
|
|
35
|
-
rescue Errors::InvalidConfigYAMLError => e
|
|
36
|
-
UI::ErrorHandler.pretty_print_and_raise(e)
|
|
37
|
-
rescue StandardError => e
|
|
38
|
-
UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message("script.enable.error.operation_failed"))
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def self.help
|
|
42
|
-
ShopifyCli::Context.message("script.enable.help", ShopifyCli::TOOL_NAME)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
private
|
|
46
|
-
|
|
47
|
-
def acquire_configuration(config_file: nil, config_props: nil)
|
|
48
|
-
properties = {}
|
|
49
|
-
properties = YAML.load(File.read(config_file)) unless config_file.nil?
|
|
50
|
-
properties = properties.merge(parse_config_props(config_props)) unless config_props.nil?
|
|
51
|
-
|
|
52
|
-
configuration = { entries: [] }
|
|
53
|
-
properties.each do |key, value|
|
|
54
|
-
configuration[:entries].push({
|
|
55
|
-
key: key,
|
|
56
|
-
value: value,
|
|
57
|
-
})
|
|
58
|
-
end
|
|
59
|
-
configuration
|
|
60
|
-
rescue Errno::ENOENT, Psych::SyntaxError
|
|
61
|
-
raise Errors::InvalidConfigYAMLError, options.flags[:config_file]
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def parse_config_props(config_props)
|
|
65
|
-
Hash[
|
|
66
|
-
config_props.map do |s|
|
|
67
|
-
args = s.split(":").map(&:strip)
|
|
68
|
-
raise Errors::InvalidConfigProps unless args.size == 2
|
|
69
|
-
args
|
|
70
|
-
end
|
|
71
|
-
]
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
# No slice pre Ruby 2.5 so roll our own
|
|
75
|
-
def slice(hash, *keys)
|
|
76
|
-
Hash[hash.to_a - hash.select { |key, _value| !keys.include?(key) }.to_a]
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|